]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/choice.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxChoice class
4 // Author: Julian Smart
5 // Modified by: Vadim Zeitlin to derive from wxChoiceBase
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 class WXDLLEXPORT wxChoice
: public wxChoiceBase
23 wxChoice() { Init(); }
26 wxChoice(wxWindow
*parent
,
28 const wxPoint
& pos
= wxDefaultPosition
,
29 const wxSize
& size
= wxDefaultSize
,
30 int n
= 0, const wxString choices
[] = NULL
,
32 const wxValidator
& validator
= wxDefaultValidator
,
33 const wxString
& name
= wxChoiceNameStr
)
36 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
39 wxChoice(wxWindow
*parent
,
43 const wxArrayString
& choices
,
45 const wxValidator
& validator
= wxDefaultValidator
,
46 const wxString
& name
= wxChoiceNameStr
)
49 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
52 bool Create(wxWindow
*parent
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
56 int n
= 0, const wxString choices
[] = NULL
,
58 const wxValidator
& validator
= wxDefaultValidator
,
59 const wxString
& name
= wxChoiceNameStr
);
60 bool Create(wxWindow
*parent
,
64 const wxArrayString
& choices
,
66 const wxValidator
& validator
= wxDefaultValidator
,
67 const wxString
& name
= wxChoiceNameStr
);
69 // implement base class pure virtuals
70 virtual int DoAppend(const wxString
& item
);
71 virtual int DoInsert(const wxString
& item
, int pos
);
72 virtual void Delete(int n
);
75 virtual int GetCount() const;
76 virtual int GetSelection() const;
77 #if wxABI_VERSION >= 20602
78 virtual int GetCurrentSelection() const;
80 virtual void SetSelection(int n
);
82 virtual int FindString(const wxString
& s
) const;
83 virtual wxString
GetString(int n
) const;
84 virtual void SetString(int n
, const wxString
& s
);
87 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
88 WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
89 virtual WXHBRUSH
MSWControlColor(WXHDC hDC
, WXHWND hWnd
);
92 // common part of all ctors
93 void Init() { m_lastAcceptedSelection
= wxID_NONE
; }
95 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
96 virtual void DoSetItemClientData( int n
, void* clientData
);
97 virtual void* DoGetItemClientData( int n
) const;
98 virtual void DoSetItemClientObject( int n
, wxClientData
* clientData
);
99 virtual wxClientData
* DoGetItemClientObject( int n
) const;
101 // MSW implementation
102 virtual wxSize
DoGetBestSize() const;
103 virtual void DoGetSize(int *w
, int *h
) const;
104 virtual void DoSetSize(int x
, int y
,
105 int width
, int height
,
106 int sizeFlags
= wxSIZE_AUTO
);
108 virtual bool MSWShouldPreProcessMessage(WXMSG
*pMsg
);
110 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
112 // update the height of the drop down list to fit the number of items we
113 // have (without changing the visible height)
114 void UpdateVisibleHeight();
116 // create and initialize the control
117 bool CreateAndInit(wxWindow
*parent
, wxWindowID id
,
120 int n
, const wxString choices
[],
122 const wxValidator
& validator
,
123 const wxString
& name
);
125 // free all memory we have (used by Clear() and dtor)
129 // last "completed" selection, i.e. not the transient one while the user is
130 // browsing the popup list: this is only used when != wxID_NONE which is
131 // the case while the drop down is opened
132 int m_lastAcceptedSelection
;
135 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice
)
138 #endif // _WX_CHOICE_H_