1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     SWIG interface defs for wxButton, wxBitmapButton
 
   7 // Created:     10-June-1998
 
   9 // Copyright:   (c) 2003 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  16 //---------------------------------------------------------------------------
 
  19 MAKE_CONST_WXSTRING(ButtonNameStr);
 
  31 //---------------------------------------------------------------------------
 
  34 "A button is a control that contains a text string, and is one of the most
 
  35 common elements of a GUI.  It may be placed on a dialog box or panel, or
 
  36 indeed almost any other window.", "
 
  40     ==============   ==========================================
 
  41     wx.BU_LEFT       Left-justifies the label. Windows and GTK+ only.
 
  42     wx.BU_TOP        Aligns the label to the top of the button.
 
  43                      Windows and GTK+ only.
 
  44     wx.BU_RIGHT      Right-justifies the bitmap label. Windows and GTK+ only.
 
  45     wx.BU_BOTTOM     Aligns the label to the bottom of the button.
 
  46                      Windows and GTK+ only.
 
  47     wx.BU_EXACTFIT   Creates the button as small as possible
 
  48                      instead of making it of the standard size
 
  49                      (which is the default behaviour.)
 
  50     ==============   ==========================================
 
  54     ============     ==========================================
 
  55     EVT_BUTTON       Sent when the button is clicked.
 
  56     ============     ==========================================
 
  58 :see: `wx.BitmapButton`
 
  62 MustHaveApp(wxButton);
 
  64 class wxButton : public wxControl
 
  67     %pythonAppend wxButton         "self._setOORInfo(self)"
 
  68     %pythonAppend wxButton()       ""
 
  69     %typemap(out) wxButton*;    // turn off this typemap
 
  73         wxButton(wxWindow* parent, wxWindowID id=-1,
 
  74                  const wxString& label=wxPyEmptyString,
 
  75                  const wxPoint& pos = wxDefaultPosition,
 
  76                  const wxSize& size = wxDefaultSize,
 
  78                  const wxValidator& validator = wxDefaultValidator,
 
  79                  const wxString& name = wxPyButtonNameStr),
 
  80         "Create and show a button.  The preferred way to create standard
 
  81 buttons is to use a standard ID and an empty label.  In this case
 
  82 wxWigets will automatically use a stock label that coresponds to the
 
  83 ID given.  In additon, the button will be decorated with stock icons
 
  86 The stock IDs and coresponding labels are
 
  88     =====================   ======================
 
  92     wx.ID_CANCEL            '\&Cancel'
 
  97     wx.ID_DELETE            '\&Delete'
 
  99     wx.ID_REPLACE           'Find and rep\&lace'
 
 100     wx.ID_BACKWARD          '\&Back'
 
 102     wx.ID_FORWARD           '\&Forward'
 
 106     wx.ID_INDENT            'Indent'
 
 107     wx.ID_INDEX             '\&Index'
 
 108     wx.ID_ITALIC            '\&Italic'
 
 109     wx.ID_JUSTIFY_CENTER    'Centered'
 
 110     wx.ID_JUSTIFY_FILL      'Justified'
 
 111     wx.ID_JUSTIFY_LEFT      'Align Left'
 
 112     wx.ID_JUSTIFY_RIGHT     'Align Right'
 
 117     wx.ID_PASTE             '\&Paste'
 
 118     wx.ID_PREFERENCES       '\&Preferences'
 
 119     wx.ID_PRINT             '\&Print'
 
 120     wx.ID_PREVIEW           'Print previe\&w'
 
 121     wx.ID_PROPERTIES        '\&Properties'
 
 124     wx.ID_REFRESH           'Refresh'
 
 125     wx.ID_REMOVE            'Remove'
 
 126     wx.ID_REVERT_TO_SAVED   'Revert to Saved'
 
 128     wx.ID_SAVEAS            'Save \&As...'
 
 130     wx.ID_UNDELETE          'Undelete'
 
 131     wx.ID_UNDERLINE         '\&Underline'
 
 133     wx.ID_UNINDENT          '\&Unindent'
 
 135     wx.ID_ZOOM_100          '\&Actual Size'
 
 136     wx.ID_ZOOM_FIT          'Zoom to \&Fit'
 
 137     wx.ID_ZOOM_IN           'Zoom \&In'
 
 138     wx.ID_ZOOM_OUT          'Zoom \&Out'
 
 139     =====================   ======================
 
 144         "Precreate a Button for 2-phase creation.", "",
 
 147     // Turn it back on again
 
 148     %typemap(out) wxButton* { $result = wxPyMake_wxObject($1, $owner); }
 
 152         bool , Create(wxWindow* parent, wxWindowID id=-1,
 
 153                       const wxString& label=wxPyEmptyString,
 
 154                       const wxPoint& pos = wxDefaultPosition,
 
 155                       const wxSize& size = wxDefaultSize,
 
 157                       const wxValidator& validator = wxDefaultValidator,
 
 158                       const wxString& name = wxPyButtonNameStr),
 
 159         "Acutally create the GUI Button for 2-phase creation.", "");
 
 165         "This sets the button to be the default item for the panel or dialog box.", "");
 
 169         static wxSize , GetDefaultSize(),
 
 170         "Returns the default button size for this platform.", "");   
 
 172     static wxVisualAttributes
 
 173     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
 178 //---------------------------------------------------------------------------
 
 181 DocStr(wxBitmapButton,
 
 182 "A Button that contains a bitmap.  A bitmap button can be supplied with a
 
 183 single bitmap, and wxWidgets will draw all button states using this bitmap. If
 
 184 the application needs more control, additional bitmaps for the selected state,
 
 185 unpressed focused state, and greyed-out state may be supplied.", "       
 
 189     ==============  =============================================
 
 190     wx.BU_AUTODRAW  If this is specified, the button will be drawn
 
 191                     automatically using the label bitmap only,
 
 192                     providing a 3D-look border. If this style is
 
 193                     not specified, the button will be drawn
 
 194                     without borders and using all provided
 
 196     wx.BU_LEFT      Left-justifies the label. WIN32 only.
 
 197     wx.BU_TOP       Aligns the label to the top of the button. WIN32
 
 199     wx.BU_RIGHT     Right-justifies the bitmap label. WIN32 only.
 
 200     wx.BU_BOTTOM    Aligns the label to the bottom of the
 
 202     wx.BU_EXACTFIT  Creates the button as small as possible
 
 203                     instead of making it of the standard size
 
 204                     (which is the default behaviour.)
 
 205     ==============  =============================================
 
 209      ===========   ==================================
 
 210      EVT_BUTTON    Sent when the button is clicked.
 
 211      ===========   ==================================
 
 213 :see: `wx.Button`, `wx.Bitmap`
 
 216 MustHaveApp(wxBitmapButton);
 
 218 class wxBitmapButton : public wxButton
 
 221     %pythonAppend wxBitmapButton         "self._setOORInfo(self)"
 
 222     %pythonAppend wxBitmapButton()       ""
 
 223     %typemap(out) wxBitmapButton*;    // turn off this typemap
 
 226         wxBitmapButton(wxWindow* parent, wxWindowID id=-1,
 
 227                        const wxBitmap& bitmap = wxNullBitmap,
 
 228                        const wxPoint& pos = wxDefaultPosition,
 
 229                        const wxSize& size = wxDefaultSize,
 
 230                        long style = wxBU_AUTODRAW,
 
 231                        const wxValidator& validator = wxDefaultValidator,
 
 232                        const wxString& name = wxPyButtonNameStr),
 
 233         "Create and show a button with a bitmap for the label.", "");
 
 237         "Precreate a BitmapButton for 2-phase creation.", "",
 
 240     // Turn it back on again
 
 241     %typemap(out) wxBitmapButton* { $result = wxPyMake_wxObject($1, $owner); }
 
 245         bool , Create(wxWindow* parent, wxWindowID id=-1,
 
 246                       const wxBitmap& bitmap = wxNullBitmap,
 
 247                       const wxPoint& pos = wxDefaultPosition,
 
 248                       const wxSize& size = wxDefaultSize,
 
 249                       long style = wxBU_AUTODRAW,
 
 250                       const wxValidator& validator = wxDefaultValidator,
 
 251                       const wxString& name = wxPyButtonNameStr),
 
 252         "Acutally create the GUI BitmapButton for 2-phase creation.", "");
 
 256         wxBitmap , GetBitmapLabel(),
 
 257         "Returns the label bitmap (the one passed to the constructor).", "");
 
 260         wxBitmap , GetBitmapDisabled(),
 
 261         "Returns the bitmap for the disabled state.", "");
 
 264         wxBitmap , GetBitmapFocus(),
 
 265         "Returns the bitmap for the focused state.", "");
 
 269         wxBitmap , GetBitmapSelected(),
 
 270         "Returns the bitmap for the selected state.", "");
 
 274         void , SetBitmapDisabled(const wxBitmap& bitmap),
 
 275         "Sets the bitmap for the disabled button appearance.", "");
 
 279         void , SetBitmapFocus(const wxBitmap& bitmap),
 
 280         "Sets the bitmap for the button appearance when it has the keyboard focus.", "");
 
 284         void , SetBitmapSelected(const wxBitmap& bitmap),
 
 285         "Sets the bitmap for the selected (depressed) button appearance.", "");
 
 289         void , SetBitmapLabel(const wxBitmap& bitmap),
 
 290         "Sets the bitmap label for the button.  This is the bitmap used for the
 
 291 unselected state, and for all other states if no other bitmaps are provided.", "");
 
 294     void SetMargins(int x, int y);
 
 295     int GetMarginX() const;
 
 296     int GetMarginY() const;
 
 300 //---------------------------------------------------------------------------