]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk/choice.h
Add lambda-friendly wxDialog::ShowWindowModalThenDo().
[wxWidgets.git] / include / wx / gtk / choice.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/gtk/choice.h
3// Purpose:
4// Author: Robert Roebling
5// Copyright: (c) 1998 Robert Roebling
6// Licence: wxWindows licence
7/////////////////////////////////////////////////////////////////////////////
8
9#ifndef _WX_GTK_CHOICE_H_
10#define _WX_GTK_CHOICE_H_
11
12class WXDLLIMPEXP_FWD_BASE wxSortedArrayString;
13class WXDLLIMPEXP_FWD_BASE wxArrayString;
14
15//-----------------------------------------------------------------------------
16// wxChoice
17//-----------------------------------------------------------------------------
18
19class wxGtkCollatedArrayString;
20
21class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
22{
23public:
24 wxChoice()
25 {
26 Init();
27 }
28 wxChoice( wxWindow *parent, wxWindowID id,
29 const wxPoint& pos = wxDefaultPosition,
30 const wxSize& size = wxDefaultSize,
31 int n = 0, const wxString choices[] = (const wxString *) NULL,
32 long style = 0,
33 const wxValidator& validator = wxDefaultValidator,
34 const wxString& name = wxChoiceNameStr )
35 {
36 Init();
37 Create(parent, id, pos, size, n, choices, style, validator, name);
38 }
39 wxChoice( wxWindow *parent, wxWindowID id,
40 const wxPoint& pos,
41 const wxSize& size,
42 const wxArrayString& choices,
43 long style = 0,
44 const wxValidator& validator = wxDefaultValidator,
45 const wxString& name = wxChoiceNameStr )
46 {
47 Init();
48 Create(parent, id, pos, size, choices, style, validator, name);
49 }
50 virtual ~wxChoice();
51 bool Create( wxWindow *parent, wxWindowID id,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 int n = 0, const wxString choices[] = NULL,
55 long style = 0,
56 const wxValidator& validator = wxDefaultValidator,
57 const wxString& name = wxChoiceNameStr );
58 bool Create( wxWindow *parent, wxWindowID id,
59 const wxPoint& pos,
60 const wxSize& size,
61 const wxArrayString& choices,
62 long style = 0,
63 const wxValidator& validator = wxDefaultValidator,
64 const wxString& name = wxChoiceNameStr );
65
66 int GetSelection() const;
67 void SetSelection(int n);
68
69 virtual unsigned int GetCount() const;
70 virtual int FindString(const wxString& s, bool bCase = false) const;
71 virtual wxString GetString(unsigned int n) const;
72 virtual void SetString(unsigned int n, const wxString& string);
73
74 virtual void SetColumns(int n=1);
75 virtual int GetColumns() const;
76
77 virtual void GTKDisableEvents();
78 virtual void GTKEnableEvents();
79
80 static wxVisualAttributes
81 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
82
83protected:
84 // this array is only used for controls with wxCB_SORT style, so only
85 // allocate it if it's needed (hence using pointer)
86 wxGtkCollatedArrayString *m_strings;
87
88 // contains the client data for the items
89 wxArrayPtrVoid m_clientData;
90
91 // index to GtkListStore cell which displays the item text
92 int m_stringCellIndex;
93
94 virtual wxSize DoGetBestSize() const;
95 virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
96 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
97 unsigned int pos,
98 void **clientData, wxClientDataType type);
99 virtual void DoSetItemClientData(unsigned int n, void* clientData);
100 virtual void* DoGetItemClientData(unsigned int n) const;
101 virtual void DoClear();
102 virtual void DoDeleteOneItem(unsigned int n);
103
104 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
105 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
106
107 // in derived classes, implement this to insert list store entry
108 // with all items default except text
109 virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text );
110
111private:
112 void Init();
113
114 DECLARE_DYNAMIC_CLASS(wxChoice)
115};
116
117
118#endif // _WX_GTK_CHOICE_H_