xref: /aoo42x/main/toolkit/source/awt/vclxbutton.cxx (revision b0724fc6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "vclxbutton.hxx"
25 
26 #include <layout/core/helper.hxx>
27 #include <com/sun/star/awt/ImagePosition.hpp>
28 #include <vcl/button.hxx>
29 
30 namespace css = com::sun::star;
31 
32 namespace layoutimpl
33 {
34 
VCLXIconButton(Window * p,rtl::OUString aDefaultLabel,char const * pGraphName)35 VCLXIconButton::VCLXIconButton( Window *p, rtl::OUString aDefaultLabel, char const *pGraphName )
36     : VCLXButton()
37 {
38     /* FIXME: before Window is set, setLabel, setProperty->setImage
39      * are silent no-ops.  */
40     p->SetComponentInterface( this );
41 
42     setLabel( aDefaultLabel );
43     setProperty( rtl::OUString::createFromAscii( "Graphic" ),
44                  css::uno::Any( layoutimpl::loadGraphic( pGraphName ) ) );
45     setProperty( rtl::OUString::createFromAscii( "ImagePosition" ),
46                  css::uno::Any( css::awt::ImagePosition::LeftCenter ) );
47     setProperty( rtl::OUString::createFromAscii( "Align" ),
48                  css::uno::Any( (sal_Int16) 1 /* magic - center */ ) );
49 }
50 
51 // FIXME: l10n/i18n of Reset & Apply
52 
VCLXOKButton(Window * p)53 VCLXOKButton::VCLXOKButton( Window *p )
54     : VCLXIconButton( p, Button::GetStandardText( BUTTON_OK ),
55                          "res/commandimagelist/sc_ok.png" )
56 {
57 }
58 
VCLXCancelButton(Window * p)59 VCLXCancelButton::VCLXCancelButton( Window *p )
60     : VCLXIconButton( p, Button::GetStandardText( BUTTON_CANCEL ),
61 //    : VCLXIconButton( xButton, rtl::OUString::createFromAscii( "~Cancel " ),
62                          "res/commandimagelist/sc_cancel.png" )
63 {
64 }
65 
VCLXYesButton(Window * p)66 VCLXYesButton::VCLXYesButton( Window *p )
67     : VCLXIconButton( p, Button::GetStandardText( BUTTON_YES ),
68                   "res/commandimagelist/sc_yes.png" )
69 {
70 }
71 
VCLXNoButton(Window * p)72 VCLXNoButton::VCLXNoButton( Window *p )
73     : VCLXIconButton( p, Button::GetStandardText( BUTTON_NO ),
74                   "res/commandimagelist/sc_no.png" )
75 {
76 }
77 
VCLXRetryButton(Window * p)78 VCLXRetryButton::VCLXRetryButton( Window *p )
79     : VCLXIconButton( p, Button::GetStandardText( BUTTON_RETRY ),
80                   "res/commandimagelist/sc_retry.png" )
81 {
82 }
83 
VCLXIgnoreButton(Window * p)84 VCLXIgnoreButton::VCLXIgnoreButton( Window *p )
85     : VCLXIconButton( p, Button::GetStandardText( BUTTON_IGNORE ),
86                   "res/commandimagelist/sc_ignore.png" )
87 {
88 }
89 
VCLXResetButton(Window * p)90 VCLXResetButton::VCLXResetButton( Window *p )
91     : VCLXIconButton( p, rtl::OUString::createFromAscii( "~Reset " ),
92                   "res/commandimagelist/sc_reset.png" )
93 {
94 }
95 
VCLXApplyButton(Window * p)96 VCLXApplyButton::VCLXApplyButton( Window *p )
97     : VCLXIconButton( p, rtl::OUString::createFromAscii( "Apply" ),
98                   "res/commandimagelist/sc_apply.png" )
99 {
100 }
101 
VCLXHelpButton(Window * p)102 VCLXHelpButton::VCLXHelpButton( Window *p )
103     : VCLXIconButton( p, Button::GetStandardText( BUTTON_HELP ),
104                   "res/commandimagelist/sc_help.png" )
105 {
106 }
107 
VCLXMoreButton(Window * p)108 VCLXMoreButton::VCLXMoreButton( Window *p )
109     : VCLXIconButton( p, Button::GetStandardText( BUTTON_MORE ),
110 //    : VCLXIconButton( p, rtl::OUString::createFromAscii( "More " ),
111                   "res/commandimagelist/sc_more.png" )
112 {
113 }
114 
VCLXAdvancedButton(Window * p)115 VCLXAdvancedButton::VCLXAdvancedButton( Window *p )
116 //    : VCLXIconButton( p, Button::GetStandardText( BUTTON_ADVANCED ),
117     : VCLXIconButton( p, rtl::OUString::createFromAscii( "Advanced " ),
118                   "res/commandimagelist/sc_advanced.png" )
119 {
120 }
121 
122 } // namespace layoutimpl
123