radiobox.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/radiobox.h
  3. // Purpose: wxRadioBox class
  4. // Author: David Webster
  5. // Modified by:
  6. // Created: 10/12/99
  7. // Copyright: (c) David Webster
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_RADIOBOX_H_
  11. #define _WX_RADIOBOX_H_
  12. // List box item
  13. class WXDLLIMPEXP_FWD_CORE wxBitmap ;
  14. class WXDLLIMPEXP_CORE wxRadioBox: public wxControl, public wxRadioBoxBase
  15. {
  16. public:
  17. wxRadioBox();
  18. inline wxRadioBox( wxWindow* pParent
  19. ,wxWindowID vId
  20. ,const wxString& rsTitle
  21. ,const wxPoint& rPos = wxDefaultPosition
  22. ,const wxSize& rSize = wxDefaultSize
  23. ,int nNum = 0
  24. ,const wxString asChoices[] = NULL
  25. ,int nMajorDim = 0
  26. ,long lStyle = wxRA_SPECIFY_COLS
  27. ,const wxValidator& rVal = wxDefaultValidator
  28. ,const wxString& rsName = wxRadioBoxNameStr
  29. )
  30. {
  31. Create( pParent
  32. ,vId
  33. ,rsTitle
  34. ,rPos
  35. ,rSize
  36. ,nNum
  37. ,asChoices
  38. ,nMajorDim
  39. ,lStyle
  40. ,rVal
  41. ,rsName
  42. );
  43. }
  44. inline wxRadioBox( wxWindow* pParent
  45. ,wxWindowID vId
  46. ,const wxString& rsTitle
  47. ,const wxPoint& rPos
  48. ,const wxSize& rSize
  49. ,const wxArrayString& asChoices
  50. ,int nMajorDim = 0
  51. ,long lStyle = wxRA_SPECIFY_COLS
  52. ,const wxValidator& rVal = wxDefaultValidator
  53. ,const wxString& rsName = wxRadioBoxNameStr
  54. )
  55. {
  56. Create( pParent
  57. ,vId
  58. ,rsTitle
  59. ,rPos
  60. ,rSize
  61. ,asChoices
  62. ,nMajorDim
  63. ,lStyle
  64. ,rVal
  65. ,rsName
  66. );
  67. }
  68. virtual ~wxRadioBox();
  69. bool Create( wxWindow* pParent
  70. ,wxWindowID vId
  71. ,const wxString& rsTitle
  72. ,const wxPoint& rPos = wxDefaultPosition
  73. ,const wxSize& rSize = wxDefaultSize
  74. ,int nNum = 0
  75. ,const wxString asChoices[] = NULL
  76. ,int nMajorDim = 0
  77. ,long lStyle = wxRA_SPECIFY_COLS
  78. ,const wxValidator& rVal = wxDefaultValidator
  79. ,const wxString& rsName = wxRadioBoxNameStr
  80. );
  81. bool Create( wxWindow* pParent
  82. ,wxWindowID vId
  83. ,const wxString& rsTitle
  84. ,const wxPoint& rPos
  85. ,const wxSize& rSize
  86. ,const wxArrayString& asChoices
  87. ,int nMajorDim = 0
  88. ,long lStyle = wxRA_SPECIFY_COLS
  89. ,const wxValidator& rVal = wxDefaultValidator
  90. ,const wxString& rsName = wxRadioBoxNameStr
  91. );
  92. // Enabling
  93. virtual bool Enable(bool bEnable = true);
  94. virtual bool Enable(unsigned int nItem, bool bEnable = true);
  95. virtual bool IsItemEnabled(unsigned int WXUNUSED(n)) const
  96. {
  97. /* TODO */
  98. return true;
  99. }
  100. // Showing
  101. virtual bool Show(bool bShow = true);
  102. virtual bool Show(unsigned int nItem, bool bShow = true);
  103. virtual bool IsItemShown(unsigned int WXUNUSED(n)) const
  104. {
  105. /* TODO */
  106. return true;
  107. }
  108. void Command(wxCommandEvent& rEvent);
  109. bool ContainsHWND(WXHWND hWnd) const;
  110. virtual WXHBRUSH OnCtlColor( WXHDC hDC
  111. ,WXHWND hWnd
  112. ,WXUINT uCtlColor
  113. ,WXUINT uMessage
  114. ,WXWPARAM wParam
  115. ,WXLPARAM lParam
  116. );
  117. virtual bool OS2Command( WXUINT uParam
  118. ,WXWORD wId
  119. );
  120. void SendNotificationEvent(void);
  121. MRESULT WindowProc( WXUINT uMsg
  122. ,WXWPARAM wParam
  123. ,WXLPARAM lParam
  124. );
  125. virtual unsigned int GetCount() const;
  126. inline WXHWND* GetRadioButtons(void) const { return m_ahRadioButtons; }
  127. int GetSelection(void) const;
  128. void GetSize(int* pnX, int* pnY) const;
  129. inline int GetSizeFlags(void) const { return m_nSizeFlags; }
  130. virtual wxString GetString(unsigned int nIndex) const;
  131. virtual wxString GetStringSelection(void) const;
  132. inline void SetButtonFont(const wxFont& rFont) { SetFont(rFont); }
  133. void SetFocus(void);
  134. virtual bool SetFont(const wxFont& rFont);
  135. inline void SetLabelFont(const wxFont& WXUNUSED(font)) {}
  136. virtual void SetSelection(int nIndex);
  137. virtual void SetString(unsigned int nNum, const wxString& rsLabel);
  138. virtual bool SetStringSelection(const wxString& rsStr);
  139. virtual void SetLabel(const wxString& rsLabel)
  140. { wxControl::SetLabel(rsLabel); }
  141. virtual wxString GetLabel() const
  142. { return wxControl::GetLabel(); }
  143. void SetLabel( int nItem, const wxString& rsLabel );
  144. void SetLabel( int item, wxBitmap* pBitmap );
  145. wxString GetLabel(int nItem) const;
  146. protected:
  147. virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
  148. virtual wxSize DoGetBestSize(void) const;
  149. virtual void DoSetSize( int nX
  150. ,int nY
  151. ,int nWidth
  152. ,int nHeight
  153. ,int nSizeFlags = wxSIZE_AUTO
  154. );
  155. wxSize GetMaxButtonSize(void) const;
  156. wxSize GetTotalButtonSize(const wxSize& rSizeBtn) const;
  157. void SubclassRadioButton(WXHWND hWndBtn);
  158. WXHWND* m_ahRadioButtons;
  159. int* m_pnRadioWidth; // for bitmaps
  160. int* m_pnRadioHeight;
  161. int m_nSelectedButton;
  162. int m_nSizeFlags;
  163. private:
  164. unsigned int m_nNoItems;
  165. DECLARE_DYNAMIC_CLASS(wxRadioBox)
  166. }; // end of wxRadioBox
  167. #endif // _WX_RADIOBOX_H_