]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _button.i | |
3 | // Purpose: SWIG interface defs for wxButton, wxBitmapButton | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 10-June-1998 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | %newgroup; | |
18 | ||
19 | ||
20 | %{ | |
21 | DECLARE_DEF_STRING(ButtonNameStr); | |
22 | %} | |
23 | ||
24 | enum { | |
25 | wxBU_LEFT, | |
26 | wxBU_TOP, | |
27 | wxBU_RIGHT, | |
28 | wxBU_BOTTOM, | |
29 | ||
30 | wxBU_EXACTFIT, | |
31 | wxBU_AUTODRAW, | |
32 | }; | |
33 | ||
34 | //--------------------------------------------------------------------------- | |
35 | ||
1e0c8722 RD |
36 | DocStr(wxButton, |
37 | "A button is a control that contains a text string, and is one of the most\n" | |
38 | "common elements of a GUI. It may be placed on a dialog box or panel, or\n" | |
39 | "indeed almost any other window."); | |
40 | ||
41 | RefDoc(wxButton, " | |
42 | Styles | |
43 | wxBU_LEFT: Left-justifies the label. WIN32 only. | |
44 | wxBU_TOP: Aligns the label to the top of the button. WIN32 only. | |
45 | wxBU_RIGHT: Right-justifies the bitmap label. WIN32 only. | |
46 | wxBU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only. | |
47 | wxBU_EXACTFIT: Creates the button as small as possible instead of making | |
48 | it of the standard size (which is the default behaviour.) | |
49 | ||
50 | Events | |
51 | EVT_BUTTON(win,id,func): | |
52 | Sent when the button is clicked. | |
53 | "); | |
54 | ||
d14a1e28 RD |
55 | class wxButton : public wxControl |
56 | { | |
57 | public: | |
58 | %addtofunc wxButton "self._setOORInfo(self)" | |
59 | %addtofunc wxButton() "" | |
60 | ||
61 | ||
1e0c8722 | 62 | DocStr(wxButton, "Create and show a button.") |
d14a1e28 RD |
63 | wxButton(wxWindow* parent, wxWindowID id, const wxString& label, |
64 | const wxPoint& pos = wxDefaultPosition, | |
65 | const wxSize& size = wxDefaultSize, | |
66 | long style = 0, | |
67 | const wxValidator& validator = wxDefaultValidator, | |
68 | const wxString& name = wxPyButtonNameStr); | |
69 | ||
1e0c8722 | 70 | DocStr(wxButton(), "Precreate a Button for 2-phase creation."); |
d14a1e28 RD |
71 | %name(PreButton)wxButton(); |
72 | ||
1e0c8722 | 73 | DocStr(Create, "Acutally create the GUI Button for 2-phase creation."); |
d14a1e28 RD |
74 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, |
75 | const wxPoint& pos = wxDefaultPosition, | |
76 | const wxSize& size = wxDefaultSize, | |
77 | long style = 0, | |
78 | const wxValidator& validator = wxDefaultValidator, | |
79 | const wxString& name = wxPyButtonNameStr); | |
80 | ||
81 | ||
1e0c8722 | 82 | DocStr(SetDefault, "This sets the button to be the default item for the panel or dialog box."); |
d14a1e28 RD |
83 | void SetDefault(); |
84 | ||
85 | ||
86 | #ifdef __WXMSW__ | |
87 | // show the image in the button in addition to the label | |
88 | void SetImageLabel(const wxBitmap& bitmap); | |
89 | ||
90 | // set the margins around the image | |
91 | void SetImageMargins(wxCoord x, wxCoord y); | |
92 | #endif | |
93 | ||
1e0c8722 | 94 | DocStr(GetDefaultButtonSize, "Returns the default button size for this platform."); |
d14a1e28 RD |
95 | static wxSize GetDefaultSize(); |
96 | }; | |
97 | ||
98 | ||
99 | ||
100 | //--------------------------------------------------------------------------- | |
101 | ||
1e0c8722 RD |
102 | |
103 | DocStr(wxBitmapButton, "A Buttont that contains a bitmap."); | |
104 | ||
d14a1e28 RD |
105 | class wxBitmapButton : public wxButton |
106 | { | |
107 | public: | |
108 | %addtofunc wxBitmapButton "self._setOORInfo(self)" | |
109 | %addtofunc wxBitmapButton() "" | |
110 | ||
1e0c8722 | 111 | DocStr(wxBitmapButton, "Create and show a button.") |
d14a1e28 RD |
112 | wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, |
113 | const wxPoint& pos = wxDefaultPosition, | |
114 | const wxSize& size = wxDefaultSize, | |
115 | long style = wxBU_AUTODRAW, | |
116 | const wxValidator& validator = wxDefaultValidator, | |
117 | const wxString& name = wxPyButtonNameStr); | |
1e0c8722 RD |
118 | |
119 | DocStr(wxBitmapButton(), "Precreate a BitmapButton for 2-phase creation."); | |
d14a1e28 RD |
120 | %name(PreBitmapButton)wxBitmapButton(); |
121 | ||
1e0c8722 | 122 | DocStr(Create, "Acutally create the GUI BitmapButton for 2-phase creation."); |
d14a1e28 | 123 | bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, |
1e0c8722 RD |
124 | const wxPoint& pos = wxDefaultPosition, |
125 | const wxSize& size = wxDefaultSize, | |
126 | long style = wxBU_AUTODRAW, | |
127 | const wxValidator& validator = wxDefaultValidator, | |
d14a1e28 RD |
128 | const wxString& name = wxPyButtonNameStr); |
129 | ||
1e0c8722 | 130 | DocStr(GetBitmapLabel, "Returns the label bitmap (the one passed to the constructor)."); |
d14a1e28 | 131 | wxBitmap GetBitmapLabel(); |
1e0c8722 RD |
132 | |
133 | DocStr(GetBitmapDisabled, "Returns the bitmap for the disabled state."); | |
d14a1e28 | 134 | wxBitmap GetBitmapDisabled(); |
1e0c8722 RD |
135 | |
136 | DocStr(GetBitmapFocus, "Returns the bitmap for the focused state."); | |
d14a1e28 | 137 | wxBitmap GetBitmapFocus(); |
1e0c8722 RD |
138 | |
139 | DocStr(GetBitmapSelected, "Returns the bitmap for the selected state."); | |
d14a1e28 | 140 | wxBitmap GetBitmapSelected(); |
1e0c8722 RD |
141 | |
142 | DocStr(SetBitmapDisabled, "Sets the bitmap for the disabled button appearance."); | |
d14a1e28 | 143 | void SetBitmapDisabled(const wxBitmap& bitmap); |
1e0c8722 RD |
144 | |
145 | DocStr(SetBitmapFocus, "Sets the bitmap for the button appearance when it has the keyboard focus."); | |
d14a1e28 | 146 | void SetBitmapFocus(const wxBitmap& bitmap); |
1e0c8722 RD |
147 | |
148 | DocStr(SetBitmapSelected, "Sets the bitmap for the selected (depressed) button appearance."); | |
d14a1e28 | 149 | void SetBitmapSelected(const wxBitmap& bitmap); |
1e0c8722 RD |
150 | |
151 | DocStr(SetBitmapLabel, | |
152 | "Sets the bitmap label for the button. This is the bitmap used for the\n" | |
153 | "unselected state, and for all other states if no other bitmaps are provided."); | |
d14a1e28 RD |
154 | void SetBitmapLabel(const wxBitmap& bitmap); |
155 | ||
156 | void SetMargins(int x, int y); | |
157 | int GetMarginX() const; | |
158 | int GetMarginY() const; | |
159 | }; | |
160 | ||
161 | ||
162 | //--------------------------------------------------------------------------- |