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