X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..da8d6ffa5790529ae784345cb4441a3956751193:/wxPython/src/_button.i diff --git a/wxPython/src/_button.i b/wxPython/src/_button.i index a256519b40..320f480990 100644 --- a/wxPython/src/_button.i +++ b/wxPython/src/_button.i @@ -16,10 +16,7 @@ //--------------------------------------------------------------------------- %newgroup; - -%{ - DECLARE_DEF_STRING(ButtonNameStr); -%} +MAKE_CONST_WXSTRING(ButtonNameStr); enum { wxBU_LEFT, @@ -33,40 +30,33 @@ enum { //--------------------------------------------------------------------------- -// A button is a control that contains a text string, and is one of the most -// common elements of a GUI. It may be placed on a dialog box or panel, or -// indeed almost any other window. -// -// Styles -// wxBU_LEFT: Left-justifies the label. WIN32 only. -// wxBU_TOP: Aligns the label to the top of the button. WIN32 only. -// wxBU_RIGHT: Right-justifies the bitmap label. WIN32 only. -// wxBU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only. -// wxBU_EXACTFIT: Creates the button as small as possible instead of making -// it of the standard size (which is the default behaviour.) -// -// Events -// EVT_BUTTON(win,id,func): -// Sent when the button is clicked. -// +DocStr(wxButton, + "A button is a control that contains a text string, and is one of the most\n" + "common elements of a GUI. It may be placed on a dialog box or panel, or\n" + "indeed almost any other window."); + +RefDoc(wxButton, " + Styles + wx.BU_LEFT: Left-justifies the label. WIN32 only. + wx.BU_TOP: Aligns the label to the top of the button. WIN32 only. + wx.BU_RIGHT: Right-justifies the bitmap label. WIN32 only. + wx.BU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only. + wx.BU_EXACTFIT: Creates the button as small as possible instead of making + it of the standard size (which is the default behaviour.) + + Events + EVT_BUTTON: Sent when the button is clicked. +"); + class wxButton : public wxControl { public: - %addtofunc wxButton "self._setOORInfo(self)" - %addtofunc wxButton() "" - - - // Constructor, creating and showing a button. - // - // parent: Parent window. Must not be None. - // id: Button identifier. A value of -1 indicates a default value. - // label: The text to be displayed on the button. - // pos: The button position on it's parent. - // size: Button size. If the default size (-1, -1) is specified then the - // button is sized appropriately for the text. - // style: Window style. See wxButton. - // validator: Window validator. - // name: Window name. + %pythonAppend wxButton "self._setOORInfo(self)" + %pythonAppend wxButton() "" + + + DocStr(wxButton, "Create and show a button."); + RefDoc(wxButton, ""); wxButton(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -74,10 +64,10 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxPyButtonNameStr); - // Default constructor + DocStr(wxButton(), "Precreate a Button for 2-phase creation."); %name(PreButton)wxButton(); - // Button creation function for two-step creation. + DocStr(Create, "Acutally create the GUI Button for 2-phase creation."); bool Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -86,25 +76,19 @@ public: const wxString& name = wxPyButtonNameStr); - // This sets the button to be the default item for the panel or dialog box. - // - // Under Windows, only dialog box buttons respond to this function. As - // normal under Windows and Motif, pressing return causes the default - // button to be depressed when the return key is pressed. See also - // wxWindow.SetFocus which sets the keyboard focus for windows and text - // panel items, and wxPanel.SetDefaultItem. + DocStr(SetDefault, "This sets the button to be the default item for the panel or dialog box."); void SetDefault(); -#ifdef __WXMSW__ - // show the image in the button in addition to the label - void SetImageLabel(const wxBitmap& bitmap); +// #ifdef __WXMSW__ +// // show the image in the button in addition to the label +// void SetImageLabel(const wxBitmap& bitmap); - // set the margins around the image - void SetImageMargins(wxCoord x, wxCoord y); -#endif +// // set the margins around the image +// void SetImageMargins(wxCoord x, wxCoord y); +// #endif - // returns the default button size for this platform + DocStr(GetDefaultButtonSize, "Returns the default button size for this platform."); static wxSize GetDefaultSize(); }; @@ -112,34 +96,83 @@ public: //--------------------------------------------------------------------------- + +DocStr(wxBitmapButton, +"A Button that contains a bitmap. A bitmap button can be supplied with a +single bitmap, and wxWindows will draw all button states using this bitmap. If +the application needs more control, additional bitmaps for the selected state, +unpressed focused state, and greyed-out state may be supplied. +"); + +RefDoc(wxBitmapButton, " + Styles + wx.BU_AUTODRAW: If this is specified, the button will be drawn + automatically using the label bitmap only, providing a + 3D-look border. If this style is not specified, the button + will be drawn without borders and using all provided + bitmaps. WIN32 only. + wx.BU_LEFT: Left-justifies the label. WIN32 only. + wx.BU_TOP: Aligns the label to the top of the button. WIN32 only. + wx.BU_RIGHT: Right-justifies the bitmap label. WIN32 only. + wx.BU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only. + wx.BU_EXACTFIT: Creates the button as small as possible instead of making + it of the standard size (which is the default behaviour.) + + Events + EVT_BUTTON: Sent when the button is clicked. +"); + class wxBitmapButton : public wxButton { public: - %addtofunc wxBitmapButton "self._setOORInfo(self)" - %addtofunc wxBitmapButton() "" + %pythonAppend wxBitmapButton "self._setOORInfo(self)" + %pythonAppend wxBitmapButton() "" + DocStr(wxBitmapButton, "Create and show a button with a bitmap for the label.") + RefDoc(wxBitmapButton, ""); // turn it off for the ctors + wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxPyButtonNameStr); + + DocStr(wxBitmapButton(), "Precreate a BitmapButton for 2-phase creation."); %name(PreBitmapButton)wxBitmapButton(); + DocStr(Create, "Acutally create the GUI BitmapButton for 2-phase creation."); bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBU_AUTODRAW, - const wxValidator& validator = wxDefaultValidator, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBU_AUTODRAW, + const wxValidator& validator = wxDefaultValidator, const wxString& name = wxPyButtonNameStr); + DocStr(GetBitmapLabel, "Returns the label bitmap (the one passed to the constructor)."); wxBitmap GetBitmapLabel(); + + DocStr(GetBitmapDisabled, "Returns the bitmap for the disabled state."); wxBitmap GetBitmapDisabled(); + + DocStr(GetBitmapFocus, "Returns the bitmap for the focused state."); wxBitmap GetBitmapFocus(); + + DocStr(GetBitmapSelected, "Returns the bitmap for the selected state."); wxBitmap GetBitmapSelected(); + + DocStr(SetBitmapDisabled, "Sets the bitmap for the disabled button appearance."); void SetBitmapDisabled(const wxBitmap& bitmap); + + DocStr(SetBitmapFocus, "Sets the bitmap for the button appearance when it has the keyboard focus."); void SetBitmapFocus(const wxBitmap& bitmap); + + DocStr(SetBitmapSelected, "Sets the bitmap for the selected (depressed) button appearance."); void SetBitmapSelected(const wxBitmap& bitmap); + + DocStr(SetBitmapLabel, + "Sets the bitmap label for the button. This is the bitmap used for the\n" + "unselected state, and for all other states if no other bitmaps are provided."); void SetBitmapLabel(const wxBitmap& bitmap); void SetMargins(int x, int y);