1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/os2/combobox.h
3 // Purpose:     wxComboBox 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_COMBOBOX_H_
12 #define _WX_COMBOBOX_H_
13 
14 #include "wx/choice.h"
15 #include "wx/textentry.h"
16 
17 #if wxUSE_COMBOBOX
18 
19 // Combobox item
20 class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
21                                public wxTextEntry
22 {
23 
24  public:
wxComboBox()25   inline wxComboBox() {}
26 
27   inline wxComboBox( wxWindow*          pParent
28                     ,wxWindowID         vId
29                     ,const wxString&    rsValue = wxEmptyString
30                     ,const wxPoint&     rPos = wxDefaultPosition
31                     ,const wxSize&      rSize = wxDefaultSize
32                     ,int                n = 0
33                     ,const wxString     asChoices[] = NULL
34                     ,long               lStyle = 0
35                     ,const wxValidator& rValidator = wxDefaultValidator
36                     ,const wxString&    rsName = wxComboBoxNameStr
37                    )
38     {
39         Create( pParent
40                ,vId
41                ,rsValue
42                ,rPos
43                ,rSize
44                ,n
45                ,asChoices
46                ,lStyle
47                ,rValidator
48                ,rsName
49               );
50     }
51 
52   inline wxComboBox( wxWindow*            pParent
53                     ,wxWindowID           vId
54                     ,const wxString&      rsValue
55                     ,const wxPoint&       rPos
56                     ,const wxSize&        rSize
57                     ,const wxArrayString& asChoices
58                     ,long                 lStyle = 0
59                     ,const wxValidator&   rValidator = wxDefaultValidator
60                     ,const wxString&      rsName = wxComboBoxNameStr
61                    )
62     {
63         Create( pParent
64                ,vId
65                ,rsValue
66                ,rPos
67                ,rSize
68                ,asChoices
69                ,lStyle
70                ,rValidator
71                ,rsName
72               );
73     }
74 
75     bool Create( wxWindow*          pParent
76                 ,wxWindowID         vId
77                 ,const wxString&    rsValue = wxEmptyString
78                 ,const wxPoint&     rPos = wxDefaultPosition
79                 ,const wxSize&      rSize = wxDefaultSize
80                 ,int                n = 0
81                 ,const wxString     asChoices[] = NULL
82                 ,long               lStyle = 0
83                 ,const wxValidator& rValidator = wxDefaultValidator
84                 ,const wxString&    rsName = wxComboBoxNameStr
85                );
86 
87     bool Create( wxWindow*            pParent
88                 ,wxWindowID           vId
89                 ,const wxString&      rsValue
90                 ,const wxPoint&       rPos
91                 ,const wxSize&        rSize
92                 ,const wxArrayString& asChoices
93                 ,long                 lStyle = 0
94                 ,const wxValidator&   rValidator = wxDefaultValidator
95                 ,const wxString&      rsName = wxComboBoxNameStr
96                );
97 
98     // See wxComboBoxBase discussion of IsEmpty().
IsListEmpty()99     bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
IsTextEmpty()100     bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
101 
102     // resolve ambiguities among virtual functions inherited from both base
103     // classes
104     virtual void Clear();
105     virtual wxString GetValue() const;
106     virtual void SetValue(const wxString& value);
GetStringSelection()107     virtual wxString GetStringSelection() const
108         { return wxChoice::GetStringSelection(); }
109 
SetSelection(int n)110     inline virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
SetSelection(long from,long to)111     virtual void SetSelection(long from, long to)
112         { wxTextEntry::SetSelection(from, to); }
GetSelection()113     virtual int GetSelection() const { return wxChoice::GetSelection(); }
GetSelection(long * from,long * to)114     virtual void GetSelection(long *from, long *to) const
115         { wxTextEntry::GetSelection(from, to); }
116 
117     virtual bool IsEditable() const;
118 
119     virtual bool        OS2Command( WXUINT uParam
120                                    ,WXWORD wId
121                                   );
122     bool                ProcessEditMsg( WXUINT   uMsg
123                                        ,WXWPARAM wParam
124                                        ,WXLPARAM lParam
125                                       );
126 
127 private:
128     // implement wxTextEntry pure virtual methods
GetEditableWindow()129     virtual wxWindow *GetEditableWindow() { return this; }
GetEditHWND()130     virtual WXHWND GetEditHWND() const { return m_hWnd; }
131 
132     DECLARE_DYNAMIC_CLASS(wxComboBox)
133 }; // end of CLASS wxComboBox
134 
135 #endif // wxUSE_COMBOBOX
136 #endif
137     // _WX_COMBOBOX_H_
138