Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_BUTTON_HXX
21 : #define INCLUDED_VCL_BUTTON_HXX
22 :
23 : #include <tools/solar.h>
24 : #include <tools/color.hxx>
25 : #include <vcl/dllapi.h>
26 : #include <vcl/image.hxx>
27 : #include <vcl/ctrl.hxx>
28 : #include <vcl/bitmap.hxx>
29 : #include <vcl/salnativewidgets.hxx>
30 : #include <rsc/rsc-vcl-shared-types.hxx>
31 :
32 : #include <vector>
33 :
34 : class UserDrawEvent;
35 : class ImplCommonButtonData;
36 :
37 :
38 : // - Button -
39 :
40 :
41 : class VCL_DLLPUBLIC Button : public Control
42 : {
43 : private:
44 : ImplCommonButtonData *mpButtonData;
45 : Link maClickHdl;
46 :
47 : // Copy assignment is forbidden and not implemented.
48 : SAL_DLLPRIVATE Button (const Button &);
49 : SAL_DLLPRIVATE Button & operator= (const Button &);
50 : public:
51 : SAL_DLLPRIVATE sal_uInt16 ImplGetButtonState() const;
52 : SAL_DLLPRIVATE sal_uInt16& ImplGetButtonState();
53 : SAL_DLLPRIVATE sal_uInt16 ImplGetTextStyle( OUString& rText, WinBits nWinStyle, sal_uLong nDrawFlags );
54 : SAL_DLLPRIVATE void ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize,
55 : bool bLayout, sal_uLong nImageSep, sal_uLong nDrawFlags,
56 : sal_uInt16 nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false );
57 : SAL_DLLPRIVATE void ImplSetFocusRect( const Rectangle &rFocusRect );
58 : SAL_DLLPRIVATE const Rectangle& ImplGetFocusRect() const;
59 : SAL_DLLPRIVATE void ImplSetSymbolAlign( SymbolAlign eAlign );
60 : /// The x-coordinate of the vertical separator line, use in MenuButton subclass only.
61 : SAL_DLLPRIVATE long ImplGetSeparatorX() const;
62 : SAL_DLLPRIVATE void ImplSetSeparatorX( long nX );
63 :
64 : protected:
65 : explicit Button( WindowType nType );
66 :
67 : public:
68 : virtual ~Button();
69 :
70 : virtual void Click();
71 :
72 0 : void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
73 0 : const Link& GetClickHdl() const { return maClickHdl; }
74 :
75 : static OUString GetStandardText( StandardButtonType eButton );
76 :
77 : bool SetModeImage( const Image& rImage );
78 : const Image GetModeImage( ) const;
79 : bool HasImage() const;
80 : void SetImageAlign( ImageAlign eAlign );
81 : ImageAlign GetImageAlign() const;
82 :
83 : void EnableImageDisplay( bool bEnable );
84 : void EnableTextDisplay( bool bEnable );
85 :
86 : void SetFocusRect( const Rectangle& rFocusRect );
87 : bool IsSmallSymbol() const;
88 : void SetSmallSymbol(bool bSmall = true);
89 : virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
90 : };
91 :
92 :
93 : // - PushButton-Types -
94 :
95 :
96 : #define PUSHBUTTON_DROPDOWN_TOOLBOX ((sal_uInt16)0x0001)
97 : #define PUSHBUTTON_DROPDOWN_MENUBUTTON ((sal_uInt16)0x0002)
98 :
99 :
100 : // - PushButton -
101 :
102 :
103 : class VCL_DLLPUBLIC PushButton : public Button
104 : {
105 : protected:
106 : SymbolType meSymbol;
107 : TriState meState;
108 : TriState meSaveValue;
109 : sal_uInt16 mnDDStyle;
110 : bool mbPressed;
111 : bool mbInUserDraw;
112 : Link maToggleHdl;
113 :
114 : SAL_DLLPRIVATE void ImplInitPushButtonData();
115 : SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle );
116 : SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
117 : SAL_DLLPRIVATE void ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawFlags,
118 : const Rectangle& rRect, bool bLayout, bool bMenuBtnSep );
119 : SAL_DLLPRIVATE void ImplDrawPushButton( bool bLayout = false );
120 : using Button::ImplGetTextStyle;
121 : SAL_DLLPRIVATE sal_uInt16 ImplGetTextStyle( sal_uLong nDrawFlags ) const;
122 0 : SAL_DLLPRIVATE bool IsSymbol() const { return ( (meSymbol != SYMBOL_NOSYMBOL) && (meSymbol != SYMBOL_IMAGE) ); }
123 0 : SAL_DLLPRIVATE bool IsImage() const { return Button::HasImage(); }
124 :
125 : // Copy assignment is forbidden and not implemented.
126 : SAL_DLLPRIVATE PushButton( const PushButton & );
127 : SAL_DLLPRIVATE PushButton& operator=( const PushButton & );
128 :
129 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
130 :
131 : using Control::ImplInitSettings;
132 : using Window::ImplInit;
133 : public:
134 : SAL_DLLPRIVATE void ImplSetDefButton( bool bSet );
135 : SAL_DLLPRIVATE static void ImplDrawPushButtonFrame( Window* pDev, Rectangle& rRect, sal_uInt16 nStyle );
136 : SAL_DLLPRIVATE static bool ImplHitTestPushButton( Window* pDev, const Point& rPos );
137 : SAL_DLLPRIVATE bool ImplIsDefButton() const;
138 :
139 : protected:
140 : explicit PushButton( WindowType nType );
141 :
142 : virtual void FillLayoutData() const SAL_OVERRIDE;
143 : virtual const Font&
144 : GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
145 : virtual const Color&
146 : GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
147 : public:
148 : explicit PushButton( Window* pParent, WinBits nStyle = 0 );
149 : explicit PushButton( Window* pParent, const ResId& );
150 : virtual ~PushButton();
151 :
152 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
153 : virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
154 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
155 : virtual void KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
156 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
157 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
158 : virtual void Resize() SAL_OVERRIDE;
159 : virtual void GetFocus() SAL_OVERRIDE;
160 : virtual void LoseFocus() SAL_OVERRIDE;
161 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
162 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
163 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
164 : virtual void UserDraw( const UserDrawEvent& rUDEvt );
165 :
166 : virtual void Toggle();
167 :
168 : void SetSymbol( SymbolType eSymbol );
169 0 : SymbolType GetSymbol() const { return meSymbol; }
170 : void SetSymbolAlign( SymbolAlign eAlign );
171 :
172 : void SetDropDown( sal_uInt16 nStyle );
173 : sal_uInt16 GetDropDown() const { return mnDDStyle; }
174 :
175 : void SetState( TriState eState );
176 0 : TriState GetState() const { return meState; }
177 :
178 : void Check( bool bCheck = true );
179 : bool IsChecked() const;
180 :
181 : void SetPressed( bool bPressed );
182 0 : bool IsPressed() const { return mbPressed; }
183 :
184 : void EndSelection();
185 :
186 0 : void SaveValue() { meSaveValue = GetState(); }
187 0 : TriState GetSavedValue() const { return meSaveValue; }
188 :
189 : Size CalcMinimumSize( long nMaxWidth = 0 ) const;
190 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
191 :
192 : void SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; }
193 : const Link& GetToggleHdl() const { return maToggleHdl; }
194 : virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
195 : };
196 :
197 0 : inline void PushButton::Check( bool bCheck )
198 : {
199 0 : SetState( (bCheck) ? TRISTATE_TRUE : TRISTATE_FALSE );
200 0 : }
201 :
202 0 : inline bool PushButton::IsChecked() const
203 : {
204 0 : return (GetState() == TRISTATE_TRUE);
205 : }
206 :
207 :
208 : // - OKButton -
209 :
210 :
211 0 : class VCL_DLLPUBLIC OKButton : public PushButton
212 : {
213 : protected:
214 : using PushButton::ImplInit;
215 : private:
216 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
217 :
218 : // Copy assignment is forbidden and not implemented.
219 : SAL_DLLPRIVATE OKButton (const OKButton &);
220 : SAL_DLLPRIVATE OKButton & operator= (const OKButton &);
221 :
222 : public:
223 : explicit OKButton( Window* pParent, WinBits nStyle = WB_DEFBUTTON );
224 : explicit OKButton( Window* pParent, const ResId& );
225 :
226 : virtual void Click() SAL_OVERRIDE;
227 : };
228 :
229 :
230 : // - CancelButton -
231 :
232 :
233 0 : class VCL_DLLPUBLIC CancelButton : public PushButton
234 : {
235 : protected:
236 : using PushButton::ImplInit;
237 : private:
238 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
239 :
240 : // Copy assignment is forbidden and not implemented.
241 : SAL_DLLPRIVATE CancelButton (const CancelButton &);
242 : SAL_DLLPRIVATE CancelButton & operator= (const CancelButton &);
243 :
244 : public:
245 : explicit CancelButton( Window* pParent, WinBits nStyle = 0 );
246 : explicit CancelButton( Window* pParent, const ResId& );
247 :
248 : virtual void Click() SAL_OVERRIDE;
249 : };
250 :
251 0 : class VCL_DLLPUBLIC CloseButton : public CancelButton
252 : {
253 : public:
254 : explicit CloseButton(Window* pParent, WinBits nStyle = 0);
255 : };
256 :
257 :
258 :
259 : // - HelpButton -
260 :
261 :
262 0 : class VCL_DLLPUBLIC HelpButton : public PushButton
263 : {
264 : protected:
265 : using PushButton::ImplInit;
266 : private:
267 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
268 :
269 : // Copy assignment is forbidden and not implemented.
270 : SAL_DLLPRIVATE HelpButton( const HelpButton & );
271 : SAL_DLLPRIVATE HelpButton & operator= ( const HelpButton & );
272 :
273 : public:
274 : explicit HelpButton( Window* pParent, WinBits nStyle = 0 );
275 : explicit HelpButton( Window* pParent, const ResId& );
276 :
277 : virtual void Click() SAL_OVERRIDE;
278 : };
279 :
280 :
281 : // - RadioButton -
282 :
283 :
284 : class VCL_DLLPUBLIC RadioButton : public Button
285 : {
286 : private:
287 : boost::shared_ptr< std::vector<RadioButton*> > m_xGroup;
288 : Rectangle maStateRect;
289 : Rectangle maMouseRect;
290 : Image maImage;
291 : bool mbChecked;
292 : bool mbSaveValue;
293 : bool mbRadioCheck;
294 : bool mbStateChanged;
295 : Link maToggleHdl;
296 : // when mbLegacyNoTextAlign is set then the old behaviour where
297 : // the WB_LEFT, WB_RIGHT & WB_CENTER affect the image placement
298 : // occurs, otherwise the image ( radiobutton circle ) is placed
299 : // to the left or right ( depending on RTL or LTR settings )
300 : bool mbLegacyNoTextAlign;
301 : SAL_DLLPRIVATE void ImplInitRadioButtonData();
302 : SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle );
303 : SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
304 : SAL_DLLPRIVATE void ImplDrawRadioButtonState();
305 : SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
306 : const Point& rPos, const Size& rSize,
307 : const Size& rImageSize, Rectangle& rStateRect,
308 : Rectangle& rMouseRect, bool bLayout = false );
309 : SAL_DLLPRIVATE void ImplDrawRadioButton( bool bLayout = false );
310 : SAL_DLLPRIVATE void ImplInvalidateOrDrawRadioButtonState();
311 : SAL_DLLPRIVATE void ImplUncheckAllOther();
312 : SAL_DLLPRIVATE Size ImplGetRadioImageSize() const;
313 : SAL_DLLPRIVATE long ImplGetImageToTextDistance() const;
314 :
315 : // Copy assignment is forbidden and not implemented.
316 : SAL_DLLPRIVATE RadioButton(const RadioButton &);
317 : SAL_DLLPRIVATE RadioButton& operator= (const RadioButton &);
318 :
319 : protected:
320 : using Control::ImplInitSettings;
321 : using Window::ImplInit;
322 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
323 : SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
324 :
325 : public:
326 : SAL_DLLPRIVATE void ImplCallClick( bool bGrabFocus = false, sal_uInt16 nFocusFlags = 0 );
327 : SAL_DLLPRIVATE void ImplSetMinimumNWFSize();
328 :
329 : protected:
330 : virtual void FillLayoutData() const SAL_OVERRIDE;
331 : virtual const Font&
332 : GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
333 : virtual const Color&
334 : GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
335 :
336 0 : inline void SetMouseRect( const Rectangle& _rMouseRect ) { maMouseRect = _rMouseRect; }
337 : inline const Rectangle& GetMouseRect( ) const { return maMouseRect; }
338 0 : inline void SetStateRect( const Rectangle& _rStateRect ) { maStateRect = _rStateRect; }
339 : inline const Rectangle& GetStateRect( ) const { return maStateRect; }
340 :
341 : // draws the radio button (the knob image), in its current state (pressed/checked)
342 : // at the usual location, which can be overridden with SetStateRect
343 : void DrawRadioButtonState( );
344 :
345 : public:
346 : explicit RadioButton( Window* pParent, WinBits nWinStyle = 0 );
347 : explicit RadioButton( Window* pParent, const ResId& );
348 : virtual ~RadioButton();
349 :
350 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
351 : virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
352 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
353 : virtual void KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
354 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
355 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
356 : virtual void Resize() SAL_OVERRIDE;
357 : virtual void GetFocus() SAL_OVERRIDE;
358 : virtual void LoseFocus() SAL_OVERRIDE;
359 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
360 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
361 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
362 :
363 : virtual void Toggle();
364 :
365 0 : bool IsStateChanged() const { return mbStateChanged; }
366 :
367 0 : void EnableRadioCheck( bool bRadioCheck = true ) { mbRadioCheck = bRadioCheck; }
368 0 : bool IsRadioCheckEnabled() const { return mbRadioCheck; }
369 :
370 : bool SetModeRadioImage( const Image& rImage );
371 : const Image& GetModeRadioImage( ) const;
372 :
373 : void SetState( bool bCheck );
374 : void Check( bool bCheck = true );
375 0 : bool IsChecked() const { return mbChecked; }
376 :
377 0 : void SaveValue() { mbSaveValue = IsChecked(); }
378 0 : bool GetSavedValue() const { return mbSaveValue; }
379 :
380 : static Image GetRadioImage( const AllSettings& rSettings, sal_uInt16 nFlags );
381 :
382 : Size CalcMinimumSize( long nMaxWidth = 0 ) const;
383 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
384 :
385 0 : void SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; }
386 : const Link& GetToggleHdl() const { return maToggleHdl; }
387 :
388 : /** GetRadioButtonGroup returns a list of pointers to <code>RadioButton</code>s in the same group.
389 :
390 : The pointers in the returned list are valid at the time call returns. However rescheduling
391 : or giving up the SolarMutex may mean events get executed that lead to the pointers getting
392 : invalid.
393 :
394 : @param bIncludeThis
395 : defines whether <code>this</code> is contained in the returned list
396 :
397 : @return
398 : on return contains the <code>RadioButton</code>s
399 : in the same group as this <code>RadioButton</code>.
400 : */
401 : std::vector<RadioButton*> GetRadioButtonGroup(bool bIncludeThis = true) const;
402 :
403 : virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
404 :
405 : /*
406 : * Group this RadioButton with another
407 : */
408 : void group(RadioButton &rOther);
409 : };
410 :
411 :
412 : // - CheckBox -
413 :
414 :
415 0 : class VCL_DLLPUBLIC CheckBox : public Button
416 : {
417 : private:
418 : Rectangle maStateRect;
419 : Rectangle maMouseRect;
420 : TriState meState;
421 : TriState meSaveValue;
422 : bool mbTriState;
423 : Link maToggleHdl;
424 : // when mbLegacyNoTextAlign is set then the old behaviour where
425 : // the WB_LEFT, WB_RIGHT & WB_CENTER affect the image placement
426 : // occurs, otherwise the image ( checkbox box ) is placed
427 : // to the left or right ( depending on RTL or LTR settings )
428 : bool mbLegacyNoTextAlign;
429 : SAL_DLLPRIVATE void ImplInitCheckBoxData();
430 : SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle );
431 : SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
432 : SAL_DLLPRIVATE void ImplInvalidateOrDrawCheckBoxState();
433 : SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
434 : const Point& rPos, const Size& rSize,
435 : const Size& rImageSize, Rectangle& rStateRect,
436 : Rectangle& rMouseRect, bool bLayout );
437 : SAL_DLLPRIVATE void ImplDrawCheckBox( bool bLayout = false );
438 : SAL_DLLPRIVATE long ImplGetImageToTextDistance() const;
439 : SAL_DLLPRIVATE Size ImplGetCheckImageSize() const;
440 :
441 : // Copy assignment is forbidden and not implemented.
442 : SAL_DLLPRIVATE CheckBox(const CheckBox &);
443 : SAL_DLLPRIVATE CheckBox& operator= (const CheckBox &);
444 :
445 : protected:
446 : using Control::ImplInitSettings;
447 : using Window::ImplInit;
448 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
449 : SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
450 : virtual void FillLayoutData() const SAL_OVERRIDE;
451 : virtual const Font& GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
452 : virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
453 :
454 : virtual void ImplDrawCheckBoxState();
455 0 : SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; }
456 0 : SAL_DLLPRIVATE const Rectangle& GetMouseRect() const { return maMouseRect; }
457 :
458 : public:
459 : SAL_DLLPRIVATE void ImplCheck();
460 : SAL_DLLPRIVATE void ImplSetMinimumNWFSize();
461 : public:
462 : explicit CheckBox( Window* pParent, WinBits nStyle = 0 );
463 : explicit CheckBox( Window* pParent, const ResId& );
464 :
465 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
466 : virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
467 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
468 : virtual void KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
469 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
470 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
471 : virtual void Resize() SAL_OVERRIDE;
472 : virtual void GetFocus() SAL_OVERRIDE;
473 : virtual void LoseFocus() SAL_OVERRIDE;
474 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
475 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
476 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
477 :
478 : virtual void Toggle();
479 :
480 : void SetState( TriState eState );
481 0 : TriState GetState() const { return meState; }
482 :
483 : void Check( bool bCheck = true );
484 : bool IsChecked() const;
485 :
486 : void EnableTriState( bool bTriState = true );
487 0 : bool IsTriStateEnabled() const { return mbTriState; }
488 :
489 0 : void SaveValue() { meSaveValue = GetState(); }
490 0 : TriState GetSavedValue() const { return meSaveValue; }
491 :
492 : static Image GetCheckImage( const AllSettings& rSettings, sal_uInt16 nFlags );
493 :
494 : Size CalcMinimumSize( long nMaxWidth = 0 ) const;
495 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
496 :
497 0 : void SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; }
498 : const Link& GetToggleHdl() const { return maToggleHdl; }
499 : bool IsLegacyNoTextAlign() { return mbLegacyNoTextAlign; }
500 0 : void SetLegacyNoTextAlign( bool bVal ) { mbLegacyNoTextAlign = bVal; }
501 :
502 : virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
503 : };
504 :
505 0 : inline void CheckBox::Check( bool bCheck )
506 : {
507 0 : SetState( (bCheck) ? TRISTATE_TRUE : TRISTATE_FALSE );
508 0 : }
509 :
510 0 : inline bool CheckBox::IsChecked() const
511 : {
512 0 : return (GetState() == TRISTATE_TRUE);
513 : }
514 :
515 :
516 : // - Control-Layer fuer alten Code -
517 :
518 :
519 : class VCL_DLLPUBLIC ImageButton : public PushButton
520 : {
521 : protected:
522 : using PushButton::ImplInitStyle;
523 : private:
524 : SAL_DLLPRIVATE void ImplInitStyle();
525 :
526 : // Copy assignment is forbidden and not implemented.
527 : SAL_DLLPRIVATE ImageButton( const ImageButton & );
528 : SAL_DLLPRIVATE ImageButton & operator= ( const ImageButton & );
529 :
530 : public:
531 : ImageButton( Window* pParent, WinBits nStyle = 0 );
532 : ImageButton( Window* pParent, const ResId& rResId );
533 : virtual ~ImageButton();
534 : };
535 :
536 : class VCL_DLLPUBLIC ImageRadioButton : public RadioButton
537 : {
538 : // Copy assignment is forbidden and not implemented.
539 : SAL_DLLPRIVATE ImageRadioButton( const ImageRadioButton & );
540 : SAL_DLLPRIVATE ImageRadioButton & operator= ( const ImageRadioButton & );
541 :
542 : public:
543 : explicit ImageRadioButton( Window* pParent, WinBits nStyle = 0 );
544 : virtual ~ImageRadioButton();
545 : };
546 :
547 : class VCL_DLLPUBLIC TriStateBox : public CheckBox
548 : {
549 : // Copy assignment is forbidden and not implemented.
550 : SAL_DLLPRIVATE TriStateBox( const TriStateBox & );
551 : SAL_DLLPRIVATE TriStateBox & operator= ( const TriStateBox & );
552 :
553 : public:
554 : explicit TriStateBox( Window* pParent, WinBits nStyle = 0 );
555 : virtual ~TriStateBox();
556 : };
557 :
558 0 : class VCL_DLLPUBLIC DisclosureButton : public CheckBox
559 : {
560 : protected:
561 : SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState() SAL_OVERRIDE;
562 : public:
563 : explicit DisclosureButton( Window* pParent, WinBits nStyle = 0 );
564 :
565 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
566 : };
567 :
568 : #endif // INCLUDED_VCL_BUTTON_HXX
569 :
570 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|