radiobox.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk/radiobox.h
  3. // Purpose:
  4. // Author: Robert Roebling
  5. // Copyright: (c) 1998 Robert Roebling
  6. // Licence: wxWindows licence
  7. /////////////////////////////////////////////////////////////////////////////
  8. #ifndef _WX_GTK_RADIOBOX_H_
  9. #define _WX_GTK_RADIOBOX_H_
  10. #include "wx/bitmap.h"
  11. class WXDLLIMPEXP_FWD_CORE wxGTKRadioButtonInfo;
  12. #include "wx/list.h"
  13. WX_DECLARE_EXPORTED_LIST(wxGTKRadioButtonInfo, wxRadioBoxButtonsInfoList);
  14. //-----------------------------------------------------------------------------
  15. // wxRadioBox
  16. //-----------------------------------------------------------------------------
  17. class WXDLLIMPEXP_CORE wxRadioBox : public wxControl,
  18. public wxRadioBoxBase
  19. {
  20. public:
  21. // ctors and dtor
  22. wxRadioBox() { }
  23. wxRadioBox(wxWindow *parent,
  24. wxWindowID id,
  25. const wxString& title,
  26. const wxPoint& pos = wxDefaultPosition,
  27. const wxSize& size = wxDefaultSize,
  28. int n = 0,
  29. const wxString choices[] = (const wxString *) NULL,
  30. int majorDim = 0,
  31. long style = wxRA_SPECIFY_COLS,
  32. const wxValidator& val = wxDefaultValidator,
  33. const wxString& name = wxRadioBoxNameStr)
  34. {
  35. Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
  36. }
  37. wxRadioBox(wxWindow *parent,
  38. wxWindowID id,
  39. const wxString& title,
  40. const wxPoint& pos,
  41. const wxSize& size,
  42. const wxArrayString& choices,
  43. int majorDim = 0,
  44. long style = wxRA_SPECIFY_COLS,
  45. const wxValidator& val = wxDefaultValidator,
  46. const wxString& name = wxRadioBoxNameStr)
  47. {
  48. Create( parent, id, title, pos, size, choices, majorDim, style, val, name );
  49. }
  50. bool Create(wxWindow *parent,
  51. wxWindowID id,
  52. const wxString& title,
  53. const wxPoint& pos = wxDefaultPosition,
  54. const wxSize& size = wxDefaultSize,
  55. int n = 0,
  56. const wxString choices[] = (const wxString *) NULL,
  57. int majorDim = 0,
  58. long style = wxRA_SPECIFY_COLS,
  59. const wxValidator& val = wxDefaultValidator,
  60. const wxString& name = wxRadioBoxNameStr);
  61. bool Create(wxWindow *parent,
  62. wxWindowID id,
  63. const wxString& title,
  64. const wxPoint& pos,
  65. const wxSize& size,
  66. const wxArrayString& choices,
  67. int majorDim = 0,
  68. long style = wxRA_SPECIFY_COLS,
  69. const wxValidator& val = wxDefaultValidator,
  70. const wxString& name = wxRadioBoxNameStr);
  71. virtual ~wxRadioBox();
  72. // implement wxItemContainerImmutable methods
  73. virtual unsigned int GetCount() const;
  74. virtual wxString GetString(unsigned int n) const;
  75. virtual void SetString(unsigned int n, const wxString& s);
  76. virtual void SetSelection(int n);
  77. virtual int GetSelection() const;
  78. // implement wxRadioBoxBase methods
  79. virtual bool Show(unsigned int n, bool show = true);
  80. virtual bool Enable(unsigned int n, bool enable = true);
  81. virtual bool IsItemEnabled(unsigned int n) const;
  82. virtual bool IsItemShown(unsigned int n) const;
  83. // override some base class methods to operate on radiobox itself too
  84. virtual bool Show( bool show = true );
  85. virtual bool Enable( bool enable = true );
  86. virtual void SetLabel( const wxString& label );
  87. static wxVisualAttributes
  88. GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
  89. virtual int GetItemFromPoint( const wxPoint& pt ) const;
  90. #if wxUSE_HELP
  91. // override virtual wxWindow::GetHelpTextAtPoint to use common platform independent
  92. // wxRadioBoxBase::DoGetHelpTextAtPoint from the platform independent
  93. // base class-interface wxRadioBoxBase.
  94. virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const
  95. {
  96. return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin );
  97. }
  98. #endif // wxUSE_HELP
  99. // implementation
  100. // --------------
  101. void GtkDisableEvents();
  102. void GtkEnableEvents();
  103. #if wxUSE_TOOLTIPS
  104. virtual void GTKApplyToolTip(const char* tip);
  105. #endif // wxUSE_TOOLTIPS
  106. wxRadioBoxButtonsInfoList m_buttonsInfo;
  107. protected:
  108. virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
  109. #if wxUSE_TOOLTIPS
  110. virtual void DoSetItemToolTip(unsigned int n, wxToolTip *tooltip);
  111. #endif
  112. virtual void DoApplyWidgetStyle(GtkRcStyle *style);
  113. virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
  114. virtual bool GTKNeedsToFilterSameWindowFocus() const { return true; }
  115. virtual bool GTKWidgetNeedsMnemonic() const;
  116. virtual void GTKWidgetDoSetMnemonic(GtkWidget* w);
  117. private:
  118. DECLARE_DYNAMIC_CLASS(wxRadioBox)
  119. };
  120. #endif // _WX_GTK_RADIOBOX_H_