]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_button.i
Noted where the documentation was
[wxWidgets.git] / wxPython / src / _button.i
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 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
55 class wxButton : public wxControl
56 {
57 public:
58 %addtofunc wxButton "self._setOORInfo(self)"
59 %addtofunc wxButton() ""
60
61
62 DocStr(wxButton, "Create and show a button.")
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
70 DocStr(wxButton(), "Precreate a Button for 2-phase creation.");
71 %name(PreButton)wxButton();
72
73 DocStr(Create, "Acutally create the GUI Button for 2-phase creation.");
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
82 DocStr(SetDefault, "This sets the button to be the default item for the panel or dialog box.");
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
94 DocStr(GetDefaultButtonSize, "Returns the default button size for this platform.");
95 static wxSize GetDefaultSize();
96 };
97
98
99
100 //---------------------------------------------------------------------------
101
102
103 DocStr(wxBitmapButton, "A Buttont that contains a bitmap.");
104
105 class wxBitmapButton : public wxButton
106 {
107 public:
108 %addtofunc wxBitmapButton "self._setOORInfo(self)"
109 %addtofunc wxBitmapButton() ""
110
111 DocStr(wxBitmapButton, "Create and show a button.")
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);
118
119 DocStr(wxBitmapButton(), "Precreate a BitmapButton for 2-phase creation.");
120 %name(PreBitmapButton)wxBitmapButton();
121
122 DocStr(Create, "Acutally create the GUI BitmapButton for 2-phase creation.");
123 bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
124 const wxPoint& pos = wxDefaultPosition,
125 const wxSize& size = wxDefaultSize,
126 long style = wxBU_AUTODRAW,
127 const wxValidator& validator = wxDefaultValidator,
128 const wxString& name = wxPyButtonNameStr);
129
130 DocStr(GetBitmapLabel, "Returns the label bitmap (the one passed to the constructor).");
131 wxBitmap GetBitmapLabel();
132
133 DocStr(GetBitmapDisabled, "Returns the bitmap for the disabled state.");
134 wxBitmap GetBitmapDisabled();
135
136 DocStr(GetBitmapFocus, "Returns the bitmap for the focused state.");
137 wxBitmap GetBitmapFocus();
138
139 DocStr(GetBitmapSelected, "Returns the bitmap for the selected state.");
140 wxBitmap GetBitmapSelected();
141
142 DocStr(SetBitmapDisabled, "Sets the bitmap for the disabled button appearance.");
143 void SetBitmapDisabled(const wxBitmap& bitmap);
144
145 DocStr(SetBitmapFocus, "Sets the bitmap for the button appearance when it has the keyboard focus.");
146 void SetBitmapFocus(const wxBitmap& bitmap);
147
148 DocStr(SetBitmapSelected, "Sets the bitmap for the selected (depressed) button appearance.");
149 void SetBitmapSelected(const wxBitmap& bitmap);
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.");
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 //---------------------------------------------------------------------------