1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/os2/choice.h
3 // Purpose:     wxChoice class
4 // Author:      David Webster
5 // Modified by:
6 // Created:     10/13/99
7 // Copyright:   (c) David Webster
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _WX_CHOICE_H_
12 #define _WX_CHOICE_H_
13 
14 // ----------------------------------------------------------------------------
15 // Choice item
16 // ----------------------------------------------------------------------------
17 
18 class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase
19 {
DECLARE_DYNAMIC_CLASS(wxChoice)20   DECLARE_DYNAMIC_CLASS(wxChoice)
21 
22 public:
23     // ctors
24     inline wxChoice() { }
25     virtual ~wxChoice();
26 
27     inline wxChoice( wxWindow*          pParent
28                     ,wxWindowID         vId
29                     ,const wxPoint&     rPos = wxDefaultPosition
30                     ,const wxSize&      rSize = wxDefaultSize
31                     ,int                n = 0
32                     ,const wxString     asChoices[] = NULL
33                     ,long               lStyle = 0
34                     ,const wxValidator& rValidator = wxDefaultValidator
35                     ,const wxString&    rsName = wxChoiceNameStr
36                    )
37     {
38         Create( pParent
39                ,vId
40                ,rPos
41                ,rSize
42                ,n
43                ,asChoices
44                ,lStyle
45                ,rValidator
46                ,rsName
47               );
48     }
49 
50     inline wxChoice( wxWindow*            pParent
51                     ,wxWindowID           vId
52                     ,const wxPoint&       rPos
53                     ,const wxSize&        rSize
54                     ,const wxArrayString& asChoices
55                     ,long                 lStyle = 0
56                     ,const wxValidator&   rValidator = wxDefaultValidator
57                     ,const wxString&      rsName = wxChoiceNameStr
58                    )
59     {
60         Create( pParent
61                ,vId
62                ,rPos
63                ,rSize
64                ,asChoices
65                ,lStyle
66                ,rValidator
67                ,rsName
68               );
69     }
70 
71     bool Create( wxWindow*          pParent
72                 ,wxWindowID         vId
73                 ,const wxPoint&     rPos = wxDefaultPosition
74                 ,const wxSize&      rSize = wxDefaultSize
75                 ,int                n = 0
76                 ,const wxString     asChoices[] = NULL
77                 ,long               lStyle = 0
78                 ,const wxValidator& rValidator = wxDefaultValidator
79                 ,const wxString&    rsName = wxChoiceNameStr
80                );
81 
82     bool Create( wxWindow*            pParent
83                 ,wxWindowID           vId
84                 ,const wxPoint&       rPos
85                 ,const wxSize&        rSize
86                 ,const wxArrayString& asChoices
87                 ,long                 lStyle = 0
88                 ,const wxValidator&   rValidator = wxDefaultValidator
89                 ,const wxString&      rsName = wxChoiceNameStr
90                );
91 
92     //
93     // Implement base class virtuals
94     //
95     virtual void     DoDeleteOneItem(unsigned int n);
96     virtual void     DoClear(void);
97 
98     virtual unsigned int GetCount() const;
99     virtual int      GetSelection(void) const;
100     virtual void     SetSelection(int n);
101 
102     virtual wxString GetString(unsigned int n) const;
103     virtual void     SetString(unsigned int n, const wxString& rsStr);
104 
105     //
106     // OS2 only
107     //
108     virtual bool     OS2Command( WXUINT uParam
109                                 ,WXWORD wId
110                                );
111     MRESULT          OS2WindowProc( WXUINT   uMsg
112                                    ,WXWPARAM wParam
113                                    ,WXLPARAM lParam
114                                   );
115 
116 protected:
117     virtual int           DoInsertItems(const wxArrayStringsAdapter& items,
118                                         unsigned int pos,
119                                         void **clientData,
120                                         wxClientDataType type);
121 
122     virtual void          DoSetItemClientData(unsigned int n, void* pClientData);
123     virtual void*         DoGetItemClientData(unsigned int n) const;
124     virtual wxSize        DoGetBestSize(void) const;
125     virtual void          DoSetSize( int nX
126                                     ,int nY
127                                     ,int nWidth
128                                     ,int nHeight
129                                     ,int nsizeFlags = wxSIZE_AUTO
130                                    );
131     void                  Free(void);
132 }; // end of CLASS wxChoice
133 
134 #endif // _WX_CHOICE_H_
135