xref: /aoo41x/main/toolkit/source/awt/vclxbutton.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include "vclxbutton.hxx"
29 
30 #include <layout/core/helper.hxx>
31 #include <com/sun/star/awt/ImagePosition.hpp>
32 #include <vcl/button.hxx>
33 
34 namespace css = com::sun::star;
35 
36 namespace layoutimpl
37 {
38 
39 VCLXIconButton::VCLXIconButton( Window *p, rtl::OUString aDefaultLabel, char const *pGraphName )
40     : VCLXButton()
41 {
42     /* FIXME: before Window is set, setLabel, setProperty->setImage
43      * are silent no-ops.  */
44     p->SetComponentInterface( this );
45 
46     setLabel( aDefaultLabel );
47     setProperty( rtl::OUString::createFromAscii( "Graphic" ),
48                  css::uno::Any( layoutimpl::loadGraphic( pGraphName ) ) );
49     setProperty( rtl::OUString::createFromAscii( "ImagePosition" ),
50                  css::uno::Any( css::awt::ImagePosition::LeftCenter ) );
51     setProperty( rtl::OUString::createFromAscii( "Align" ),
52                  css::uno::Any( (sal_Int16) 1 /* magic - center */ ) );
53 }
54 
55 // FIXME: l10n/i18n of Reset & Apply
56 
57 VCLXOKButton::VCLXOKButton( Window *p )
58     : VCLXIconButton( p, Button::GetStandardText( BUTTON_OK ),
59                          "res/commandimagelist/sc_ok.png" )
60 {
61 }
62 
63 VCLXCancelButton::VCLXCancelButton( Window *p )
64     : VCLXIconButton( p, Button::GetStandardText( BUTTON_CANCEL ),
65 //    : VCLXIconButton( xButton, rtl::OUString::createFromAscii( "~Cancel " ),
66                          "res/commandimagelist/sc_cancel.png" )
67 {
68 }
69 
70 VCLXYesButton::VCLXYesButton( Window *p )
71     : VCLXIconButton( p, Button::GetStandardText( BUTTON_YES ),
72                   "res/commandimagelist/sc_yes.png" )
73 {
74 }
75 
76 VCLXNoButton::VCLXNoButton( Window *p )
77     : VCLXIconButton( p, Button::GetStandardText( BUTTON_NO ),
78                   "res/commandimagelist/sc_no.png" )
79 {
80 }
81 
82 VCLXRetryButton::VCLXRetryButton( Window *p )
83     : VCLXIconButton( p, Button::GetStandardText( BUTTON_RETRY ),
84                   "res/commandimagelist/sc_retry.png" )
85 {
86 }
87 
88 VCLXIgnoreButton::VCLXIgnoreButton( Window *p )
89     : VCLXIconButton( p, Button::GetStandardText( BUTTON_IGNORE ),
90                   "res/commandimagelist/sc_ignore.png" )
91 {
92 }
93 
94 VCLXResetButton::VCLXResetButton( Window *p )
95     : VCLXIconButton( p, rtl::OUString::createFromAscii( "~Reset " ),
96                   "res/commandimagelist/sc_reset.png" )
97 {
98 }
99 
100 VCLXApplyButton::VCLXApplyButton( Window *p )
101     : VCLXIconButton( p, rtl::OUString::createFromAscii( "Apply" ),
102                   "res/commandimagelist/sc_apply.png" )
103 {
104 }
105 
106 VCLXHelpButton::VCLXHelpButton( Window *p )
107     : VCLXIconButton( p, Button::GetStandardText( BUTTON_HELP ),
108                   "res/commandimagelist/sc_help.png" )
109 {
110 }
111 
112 VCLXMoreButton::VCLXMoreButton( Window *p )
113     : VCLXIconButton( p, Button::GetStandardText( BUTTON_MORE ),
114 //    : VCLXIconButton( p, rtl::OUString::createFromAscii( "More " ),
115                   "res/commandimagelist/sc_more.png" )
116 {
117 }
118 
119 VCLXAdvancedButton::VCLXAdvancedButton( Window *p )
120 //    : VCLXIconButton( p, Button::GetStandardText( BUTTON_ADVANCED ),
121     : VCLXIconButton( p, rtl::OUString::createFromAscii( "Advanced " ),
122                   "res/commandimagelist/sc_advanced.png" )
123 {
124 }
125 
126 } // namespace layoutimpl
127