]>
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "choice.h"
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
23 class WXDLLEXPORT wxChoice
: public wxChoiceBase
27 wxChoice() { Init(); }
30 wxChoice(wxWindow
*parent
,
32 const wxPoint
& pos
= wxDefaultPosition
,
33 const wxSize
& size
= wxDefaultSize
,
34 int n
= 0, const wxString choices
[] = NULL
,
36 const wxValidator
& validator
= wxDefaultValidator
,
37 const wxString
& name
= wxChoiceNameStr
)
40 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
43 wxChoice(wxWindow
*parent
,
47 const wxArrayString
& choices
,
49 const wxValidator
& validator
= wxDefaultValidator
,
50 const wxString
& name
= wxChoiceNameStr
)
53 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
56 bool Create(wxWindow
*parent
,
58 const wxPoint
& pos
= wxDefaultPosition
,
59 const wxSize
& size
= wxDefaultSize
,
60 int n
= 0, const wxString choices
[] = NULL
,
62 const wxValidator
& validator
= wxDefaultValidator
,
63 const wxString
& name
= wxChoiceNameStr
);
64 bool Create(wxWindow
*parent
,
68 const wxArrayString
& choices
,
70 const wxValidator
& validator
= wxDefaultValidator
,
71 const wxString
& name
= wxChoiceNameStr
);
73 // implement base class pure virtuals
74 virtual int DoAppend(const wxString
& item
);
75 virtual int DoInsert(const wxString
& item
, int pos
);
76 virtual void Delete(int n
);
79 virtual int GetCount() const;
80 virtual int GetSelection() const;
81 #if wxABI_VERSION >= 20602
82 virtual int GetCurrentSelection() const;
84 virtual void SetSelection(int n
);
86 virtual int FindString(const wxString
& s
) const;
87 virtual wxString
GetString(int n
) const;
88 virtual void SetString(int n
, const wxString
& s
);
91 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
92 WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
93 virtual WXHBRUSH
MSWControlColor(WXHDC hDC
, WXHWND hWnd
);
96 // common part of all ctors
97 void Init() { m_lastAcceptedSelection
= wxID_NONE
; }
99 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
100 virtual void DoSetItemClientData( int n
, void* clientData
);
101 virtual void* DoGetItemClientData( int n
) const;
102 virtual void DoSetItemClientObject( int n
, wxClientData
* clientData
);
103 virtual wxClientData
* DoGetItemClientObject( int n
) const;
105 // MSW implementation
106 virtual wxSize
DoGetBestSize() const;
107 virtual void DoGetSize(int *w
, int *h
) const;
108 virtual void DoSetSize(int x
, int y
,
109 int width
, int height
,
110 int sizeFlags
= wxSIZE_AUTO
);
112 virtual bool MSWShouldPreProcessMessage(WXMSG
*pMsg
);
114 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
116 // update the height of the drop down list to fit the number of items we
117 // have (without changing the visible height)
118 void UpdateVisibleHeight();
120 // create and initialize the control
121 bool CreateAndInit(wxWindow
*parent
, wxWindowID id
,
124 int n
, const wxString choices
[],
126 const wxValidator
& validator
,
127 const wxString
& name
);
129 // free all memory we have (used by Clear() and dtor)
133 // last "completed" selection, i.e. not the transient one while the user is
134 // browsing the popup list: this is only used when != wxID_NONE which is
135 // the case while the drop down is opened
136 int m_lastAcceptedSelection
;
139 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice
)
142 #endif // _WX_CHOICE_H_