bmpbuttn.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: bmpbuttn.h
  3. // Purpose: interface of wxBitmapButton
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxBitmapButton
  9. A bitmap button is a control that contains a bitmap.
  10. Notice that since wxWidgets 2.9.1 bitmap display is supported by the base
  11. wxButton class itself and the only tiny advantage of using this class is
  12. that it allows to specify the bitmap in its constructor, unlike wxButton.
  13. Please see the base class documentation for more information about images
  14. support in wxButton.
  15. @beginStyleTable
  16. @style{wxBU_LEFT}
  17. Left-justifies the bitmap label.
  18. @style{wxBU_TOP}
  19. Aligns the bitmap label to the top of the button.
  20. @style{wxBU_RIGHT}
  21. Right-justifies the bitmap label.
  22. @style{wxBU_BOTTOM}
  23. Aligns the bitmap label to the bottom of the button.
  24. @endStyleTable
  25. Note that the wxBU_EXACTFIT style supported by wxButton is not used by this
  26. class as bitmap buttons don't have any minimal standard size by default.
  27. @beginEventEmissionTable{wxCommandEvent}
  28. @event{EVT_BUTTON(id, func)}
  29. Process a @c wxEVT_BUTTON event, when the button is clicked.
  30. @endEventTable
  31. @library{wxcore}
  32. @category{ctrl}
  33. @appearance{bitmapbutton}
  34. @see wxButton
  35. */
  36. class wxBitmapButton : public wxButton
  37. {
  38. public:
  39. /**
  40. Default ctor.
  41. */
  42. wxBitmapButton();
  43. /**
  44. Constructor, creating and showing a button.
  45. @param parent
  46. Parent window. Must not be @NULL.
  47. @param id
  48. Button identifier. The value wxID_ANY indicates a default value.
  49. @param bitmap
  50. Bitmap to be displayed.
  51. @param pos
  52. Button position.
  53. If ::wxDefaultPosition is specified then a default position is chosen.
  54. @param size
  55. Button size.
  56. If ::wxDefaultSize is specified then the button is sized appropriately
  57. for the bitmap.
  58. @param style
  59. Window style. See wxBitmapButton.
  60. @param validator
  61. Window validator.
  62. @param name
  63. Window name.
  64. @remarks The bitmap parameter is normally the only bitmap you need to provide,
  65. and wxWidgets will draw the button correctly in its different states.
  66. If you want more control, call any of the functions SetBitmapPressed(),
  67. SetBitmapFocus(), SetBitmapDisabled().
  68. @see Create(), wxValidator
  69. */
  70. wxBitmapButton(wxWindow* parent, wxWindowID id,
  71. const wxBitmap& bitmap,
  72. const wxPoint& pos = wxDefaultPosition,
  73. const wxSize& size = wxDefaultSize,
  74. long style = wxBU_AUTODRAW,
  75. const wxValidator& validator = wxDefaultValidator,
  76. const wxString& name = wxButtonNameStr);
  77. /**
  78. Button creation function for two-step creation.
  79. For more details, see wxBitmapButton().
  80. */
  81. bool Create(wxWindow* parent, wxWindowID id,
  82. const wxBitmap& bitmap,
  83. const wxPoint& pos = wxDefaultPosition,
  84. const wxSize& size = wxDefaultSize,
  85. long style = wxBU_AUTODRAW,
  86. const wxValidator& validator = wxDefaultValidator,
  87. const wxString& name = wxButtonNameStr);
  88. /**
  89. Helper function creating a standard-looking "Close" button.
  90. To get the best results, platform-specific code may need to be used to
  91. create a small, title bar-like "Close" button. This function is
  92. provided to avoid the need to test for the current platform and creates
  93. the button with as native look as possible.
  94. @param parent The button parent window, must be non-@NULL.
  95. @param winid The identifier for the new button.
  96. @return The new button.
  97. @since 2.9.5
  98. */
  99. static wxBitmapButton* NewCloseButton(wxWindow* parent, wxWindowID winid);
  100. };