radiobox.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk1/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. //-----------------------------------------------------------------------------
  12. // wxRadioBox
  13. //-----------------------------------------------------------------------------
  14. class WXDLLIMPEXP_CORE wxRadioBox : public wxControl,
  15. public wxRadioBoxBase
  16. {
  17. public:
  18. // ctors and dtor
  19. wxRadioBox() { Init(); }
  20. wxRadioBox(wxWindow *parent,
  21. wxWindowID id,
  22. const wxString& title,
  23. const wxPoint& pos = wxDefaultPosition,
  24. const wxSize& size = wxDefaultSize,
  25. int n = 0,
  26. const wxString choices[] = (const wxString *) NULL,
  27. int majorDim = 1,
  28. long style = wxRA_SPECIFY_COLS,
  29. const wxValidator& val = wxDefaultValidator,
  30. const wxString& name = wxRadioBoxNameStr)
  31. {
  32. Init();
  33. Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
  34. }
  35. wxRadioBox(wxWindow *parent,
  36. wxWindowID id,
  37. const wxString& title,
  38. const wxPoint& pos,
  39. const wxSize& size,
  40. const wxArrayString& choices,
  41. int majorDim = 1,
  42. long style = wxRA_SPECIFY_COLS,
  43. const wxValidator& val = wxDefaultValidator,
  44. const wxString& name = wxRadioBoxNameStr)
  45. {
  46. Init();
  47. Create( parent, id, title, pos, size, choices, majorDim, style, val, name );
  48. }
  49. bool Create(wxWindow *parent,
  50. wxWindowID id,
  51. const wxString& title,
  52. const wxPoint& pos = wxDefaultPosition,
  53. const wxSize& size = wxDefaultSize,
  54. int n = 0,
  55. const wxString choices[] = (const wxString *) NULL,
  56. int majorDim = 0,
  57. long style = wxRA_SPECIFY_COLS,
  58. const wxValidator& val = wxDefaultValidator,
  59. const wxString& name = wxRadioBoxNameStr);
  60. bool Create(wxWindow *parent,
  61. wxWindowID id,
  62. const wxString& title,
  63. const wxPoint& pos,
  64. const wxSize& size,
  65. const wxArrayString& choices,
  66. int majorDim = 0,
  67. long style = wxRA_SPECIFY_COLS,
  68. const wxValidator& val = wxDefaultValidator,
  69. const wxString& name = wxRadioBoxNameStr);
  70. virtual ~wxRadioBox();
  71. // implement wxItemContainerImmutable methods
  72. virtual unsigned int GetCount() const;
  73. virtual wxString GetString(unsigned int n) const;
  74. virtual void SetString(unsigned int n, const wxString& s);
  75. virtual void SetSelection(int n);
  76. virtual int GetSelection() const;
  77. // implement wxRadioBoxBase methods
  78. virtual bool Show(unsigned int n, bool show = true);
  79. virtual bool Enable(unsigned int n, bool enable = true);
  80. virtual bool IsItemEnabled(unsigned int n) const;
  81. virtual bool IsItemShown(unsigned int n) const;
  82. // override some base class methods to operate on radiobox itself too
  83. virtual bool Show( bool show = true );
  84. virtual bool Enable( bool enable = true );
  85. virtual void SetLabel( const wxString& label );
  86. static wxVisualAttributes
  87. GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
  88. // implementation
  89. // --------------
  90. void SetFocus();
  91. void GtkDisableEvents();
  92. void GtkEnableEvents();
  93. bool IsOwnGtkWindow( GdkWindow *window );
  94. void DoApplyWidgetStyle(GtkRcStyle *style);
  95. #if wxUSE_TOOLTIPS
  96. void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
  97. #endif // wxUSE_TOOLTIPS
  98. virtual void OnInternalIdle();
  99. bool m_hasFocus,
  100. m_lostFocus;
  101. wxList m_boxes;
  102. protected:
  103. // common part of all ctors
  104. void Init();
  105. private:
  106. DECLARE_DYNAMIC_CLASS(wxRadioBox)
  107. };
  108. #endif // _WX_GTK_RADIOBOX_H_