]>
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 | ||
36 | // A button is a control that contains a text string, and is one of the most | |
37 | // common elements of a GUI. It may be placed on a dialog box or panel, or | |
38 | // indeed almost any other window. | |
39 | // | |
40 | // Styles | |
41 | // wxBU_LEFT: Left-justifies the label. WIN32 only. | |
42 | // wxBU_TOP: Aligns the label to the top of the button. WIN32 only. | |
43 | // wxBU_RIGHT: Right-justifies the bitmap label. WIN32 only. | |
44 | // wxBU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only. | |
45 | // wxBU_EXACTFIT: Creates the button as small as possible instead of making | |
46 | // it of the standard size (which is the default behaviour.) | |
47 | // | |
48 | // Events | |
49 | // EVT_BUTTON(win,id,func): | |
50 | // Sent when the button is clicked. | |
51 | // | |
52 | class wxButton : public wxControl | |
53 | { | |
54 | public: | |
55 | %addtofunc wxButton "self._setOORInfo(self)" | |
56 | %addtofunc wxButton() "" | |
57 | ||
58 | ||
59 | // Constructor, creating and showing a button. | |
60 | // | |
61 | // parent: Parent window. Must not be None. | |
62 | // id: Button identifier. A value of -1 indicates a default value. | |
63 | // label: The text to be displayed on the button. | |
64 | // pos: The button position on it's parent. | |
65 | // size: Button size. If the default size (-1, -1) is specified then the | |
66 | // button is sized appropriately for the text. | |
67 | // style: Window style. See wxButton. | |
68 | // validator: Window validator. | |
69 | // name: Window name. | |
70 | wxButton(wxWindow* parent, wxWindowID id, const wxString& label, | |
71 | const wxPoint& pos = wxDefaultPosition, | |
72 | const wxSize& size = wxDefaultSize, | |
73 | long style = 0, | |
74 | const wxValidator& validator = wxDefaultValidator, | |
75 | const wxString& name = wxPyButtonNameStr); | |
76 | ||
77 | // Default constructor | |
78 | %name(PreButton)wxButton(); | |
79 | ||
80 | // Button creation function for two-step creation. | |
81 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
82 | const wxPoint& pos = wxDefaultPosition, | |
83 | const wxSize& size = wxDefaultSize, | |
84 | long style = 0, | |
85 | const wxValidator& validator = wxDefaultValidator, | |
86 | const wxString& name = wxPyButtonNameStr); | |
87 | ||
88 | ||
89 | // This sets the button to be the default item for the panel or dialog box. | |
90 | // | |
91 | // Under Windows, only dialog box buttons respond to this function. As | |
92 | // normal under Windows and Motif, pressing return causes the default | |
93 | // button to be depressed when the return key is pressed. See also | |
94 | // wxWindow.SetFocus which sets the keyboard focus for windows and text | |
95 | // panel items, and wxPanel.SetDefaultItem. | |
96 | void SetDefault(); | |
97 | ||
98 | ||
99 | #ifdef __WXMSW__ | |
100 | // show the image in the button in addition to the label | |
101 | void SetImageLabel(const wxBitmap& bitmap); | |
102 | ||
103 | // set the margins around the image | |
104 | void SetImageMargins(wxCoord x, wxCoord y); | |
105 | #endif | |
106 | ||
107 | // returns the default button size for this platform | |
108 | static wxSize GetDefaultSize(); | |
109 | }; | |
110 | ||
111 | ||
112 | ||
113 | //--------------------------------------------------------------------------- | |
114 | ||
115 | class wxBitmapButton : public wxButton | |
116 | { | |
117 | public: | |
118 | %addtofunc wxBitmapButton "self._setOORInfo(self)" | |
119 | %addtofunc wxBitmapButton() "" | |
120 | ||
121 | wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, | |
122 | const wxPoint& pos = wxDefaultPosition, | |
123 | const wxSize& size = wxDefaultSize, | |
124 | long style = wxBU_AUTODRAW, | |
125 | const wxValidator& validator = wxDefaultValidator, | |
126 | const wxString& name = wxPyButtonNameStr); | |
127 | %name(PreBitmapButton)wxBitmapButton(); | |
128 | ||
129 | bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, | |
130 | const wxPoint& pos = wxDefaultPosition, | |
131 | const wxSize& size = wxDefaultSize, | |
132 | long style = wxBU_AUTODRAW, | |
133 | const wxValidator& validator = wxDefaultValidator, | |
134 | const wxString& name = wxPyButtonNameStr); | |
135 | ||
136 | wxBitmap GetBitmapLabel(); | |
137 | wxBitmap GetBitmapDisabled(); | |
138 | wxBitmap GetBitmapFocus(); | |
139 | wxBitmap GetBitmapSelected(); | |
140 | void SetBitmapDisabled(const wxBitmap& bitmap); | |
141 | void SetBitmapFocus(const wxBitmap& bitmap); | |
142 | void SetBitmapSelected(const wxBitmap& bitmap); | |
143 | void SetBitmapLabel(const wxBitmap& bitmap); | |
144 | ||
145 | void SetMargins(int x, int y); | |
146 | int GetMarginX() const; | |
147 | int GetMarginY() const; | |
148 | }; | |
149 | ||
150 | ||
151 | //--------------------------------------------------------------------------- |