Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 129 lines (116 sloc) 5.337 kb
45cf7d8c » lylejohnson
2009-02-02 initial checkin of r2610 from trunk
1 /***********************************************************************
2 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
b8219ec7 » lylejohnson
2009-11-09 Updated copyright notice for all SWIG interface files
3 * Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
45cf7d8c » lylejohnson
2009-02-02 initial checkin of r2610 from trunk
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * For further information please contact the author by e-mail
a934547f » lylejohnson
2009-11-09 Replaced e-mail address "lyle@users.sourceforge.net" with
20 * at "lyle@lylejohnson.name".
45cf7d8c » lylejohnson
2009-02-02 initial checkin of r2610 from trunk
21 ***********************************************************************/
22
23 /// Button state bits
24 enum {
25 STATE_UP = 0, /// Button is up
26 STATE_DOWN = 1, /// Button is down
27 STATE_ENGAGED = 2, /// Button is engaged
28 STATE_UNCHECKED = STATE_UP, /// Same as STATE_UP (used for check buttons or radio buttons)
29 STATE_CHECKED = STATE_ENGAGED /// Same as STATE_ENGAGED (used for check buttons or radio buttons)
30 };
31
32
33 enum {
34 BUTTON_AUTOGRAY = 0x00800000, /// Automatically gray out when not updated
35 BUTTON_AUTOHIDE = 0x01000000, /// Automatically hide button when not updated
36 BUTTON_TOOLBAR = 0x02000000, /// Toolbar style button [flat look]
37 BUTTON_DEFAULT = 0x04000000, /// May become default button when receiving focus
38 BUTTON_INITIAL = 0x08000000, /// This button is the initial default button
39 BUTTON_NORMAL = (FRAME_RAISED|FRAME_THICK|JUSTIFY_NORMAL|ICON_BEFORE_TEXT)
40 };
41
42 /// FXButton provides a push button. Buttons can have icons and/or labels.
43 class FXButton : public FXLabel {
44 protected:
45 FXuchar state;
46 protected:
47 FXButton();
48 public:
49 long onPaint(FXObject*,FXSelector,void* PTR_EVENT);
50 long onUpdate(FXObject*,FXSelector,void* PTR_NULL);
51 long onEnter(FXObject*,FXSelector,void* PTR_EVENT);
52 long onLeave(FXObject*,FXSelector,void* PTR_EVENT);
53 long onFocusIn(FXObject*,FXSelector,void* PTR_EVENT);
54 long onFocusOut(FXObject*,FXSelector,void* PTR_EVENT);
55 long onUngrabbed(FXObject*,FXSelector,void* PTR_EVENT);
56 long onLeftBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
57 long onLeftBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
58 long onKeyPress(FXObject*,FXSelector,void* PTR_EVENT);
59 long onKeyRelease(FXObject*,FXSelector,void* PTR_EVENT);
60 long onHotKeyPress(FXObject*,FXSelector,void* PTR_EVENT);
61 long onHotKeyRelease(FXObject*,FXSelector,void* PTR_EVENT);
62 long onCheck(FXObject*,FXSelector,void* PTR_NULL);
63 long onUncheck(FXObject*,FXSelector,void* PTR_NULL);
64 long onCmdSetValue(FXObject*,FXSelector,void* PTR_INT);
65 long onCmdSetIntValue(FXObject*,FXSelector,void* PTR_PINT);
66 long onCmdGetIntValue(FXObject*,FXSelector,void* PTR_NULL); // FIXME
67 public:
68 %extend {
69 /// Construct button with text and icon
70 FXButton(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=BUTTON_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD){
71 return new FXRbButton(p,text,ic,tgt,sel,opts,x,y,w,h,pl,pr,pt,pb);
72 }
73 }
74
75 /// Set the button state
76 void setState(FXuint s);
77
78 /// Get the button state
79 FXuint getState() const;
80
81 /// Set the button style flags
82 void setButtonStyle(FXuint style);
83
84 /// Get the button style flags
85 FXuint getButtonStyle() const;
86
87 /// Destructor
88 virtual ~FXButton();
89 };
90
91
92 DECLARE_FXOBJECT_VIRTUALS(FXButton)
93 DECLARE_FXID_VIRTUALS(FXButton)
94 DECLARE_FXDRAWABLE_VIRTUALS(FXButton)
95 DECLARE_FXWINDOW_VIRTUALS(FXButton)
96
97 %{
98 static swig_type_info *FXButton_dynamic_cast(void **ptr) {
99 FXButton **ppButton = reinterpret_cast<FXButton **>(ptr);
100 FXMDIDeleteButton *pMDIDeleteButton=dynamic_cast<FXMDIDeleteButton*>(*ppButton);
101 if(pMDIDeleteButton){
102 *ptr=reinterpret_cast<void*>(pMDIDeleteButton);
103 return SWIG_TypeQuery("FXMDIDeleteButton *");
104 }
105 FXMDIMaximizeButton *pMDIMaximizeButton=dynamic_cast<FXMDIMaximizeButton*>(*ppButton);
106 if(pMDIMaximizeButton){
107 *ptr=reinterpret_cast<void*>(pMDIMaximizeButton);
108 return SWIG_TypeQuery("FXMDIMaximizeButton *");
109 }
110 FXMDIMinimizeButton *pMDIMinimizeButton=dynamic_cast<FXMDIMinimizeButton*>(*ppButton);
111 if(pMDIMinimizeButton){
112 *ptr=reinterpret_cast<void*>(pMDIMinimizeButton);
113 return SWIG_TypeQuery("FXMDIMinimizeButton *");
114 }
115 FXMDIRestoreButton *pMDIRestoreButton=dynamic_cast<FXMDIRestoreButton*>(*ppButton);
116 if(pMDIRestoreButton){
117 *ptr=reinterpret_cast<void*>(pMDIRestoreButton);
118 return SWIG_TypeQuery("FXMDIRestoreButton *");
119 }
120 FXPicker *pPicker=dynamic_cast<FXPicker*>(*ppButton);
121 if(pPicker){
122 *ptr=reinterpret_cast<void*>(pPicker);
123 return SWIG_TypeQuery("FXPicker *");
124 }
125 return 0;
126 }
127 %}
128
129 DYNAMIC_CAST(SWIGTYPE_p_FXButton, FXButton_dynamic_cast);
130
Something went wrong with that request. Please try again.