]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/listbox.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / gtk1 / listbox.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/listbox.h
ff8bfdbb 3// Purpose: wxListBox class declaration
c801d85f 4// Author: Robert Roebling
58614078 5// Copyright: (c) 1998 Robert Roebling
65571936 6// Licence: wxWindows licence
c801d85f
KB
7/////////////////////////////////////////////////////////////////////////////
8
c801d85f
KB
9#ifndef __GTKLISTBOXH__
10#define __GTKLISTBOXH__
11
c801d85f 12#include "wx/list.h"
c801d85f 13
29e461a2
PC
14typedef struct _GtkList GtkList;
15
b5dbe15d 16class WXDLLIMPEXP_FWD_BASE wxSortedArrayString;
b5f6b52a 17
c801d85f
KB
18//-----------------------------------------------------------------------------
19// wxListBox
20//-----------------------------------------------------------------------------
21
20123d49 22class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
c801d85f 23{
fd0eed64 24public:
2ee3ee1b 25 // ctors and such
ff8bfdbb
VZ
26 wxListBox();
27 wxListBox( wxWindow *parent, wxWindowID id,
28 const wxPoint& pos = wxDefaultPosition,
29 const wxSize& size = wxDefaultSize,
30 int n = 0, const wxString choices[] = (const wxString *) NULL,
31 long style = 0,
32 const wxValidator& validator = wxDefaultValidator,
33 const wxString& name = wxListBoxNameStr )
34 {
88ac883a 35#if wxUSE_CHECKLISTBOX
caf6e6de 36 m_hasCheckBoxes = false;
88ac883a 37#endif // wxUSE_CHECKLISTBOX
ff8bfdbb
VZ
38 Create(parent, id, pos, size, n, choices, style, validator, name);
39 }
584ad2a3
MB
40 wxListBox( wxWindow *parent, wxWindowID id,
41 const wxPoint& pos,
42 const wxSize& size,
43 const wxArrayString& choices,
44 long style = 0,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxListBoxNameStr )
47 {
48#if wxUSE_CHECKLISTBOX
caf6e6de 49 m_hasCheckBoxes = false;
584ad2a3
MB
50#endif // wxUSE_CHECKLISTBOX
51 Create(parent, id, pos, size, choices, style, validator, name);
52 }
ff8bfdbb
VZ
53 virtual ~wxListBox();
54
55 bool Create(wxWindow *parent, wxWindowID id,
56 const wxPoint& pos = wxDefaultPosition,
57 const wxSize& size = wxDefaultSize,
58 int n = 0, const wxString choices[] = (const wxString *) NULL,
59 long style = 0,
60 const wxValidator& validator = wxDefaultValidator,
61 const wxString& name = wxListBoxNameStr);
584ad2a3
MB
62 bool Create(wxWindow *parent, wxWindowID id,
63 const wxPoint& pos,
64 const wxSize& size,
65 const wxArrayString& choices,
66 long style = 0,
67 const wxValidator& validator = wxDefaultValidator,
68 const wxString& name = wxListBoxNameStr);
ff8bfdbb 69
2ee3ee1b 70 // implement base class pure virtuals
a236aa20
VZ
71 virtual void DoClear();
72 virtual void DoDeleteOneItem(unsigned int n);
2ee3ee1b 73
aa61d352
VZ
74 virtual unsigned int GetCount() const;
75 virtual wxString GetString(unsigned int n) const;
76 virtual void SetString(unsigned int n, const wxString& s);
853dcc57 77 virtual int FindString(const wxString& s, bool bCase = false) const;
2ee3ee1b
VZ
78
79 virtual bool IsSelected(int n) const;
c6179a84 80 virtual void DoSetSelection(int n, bool select);
2ee3ee1b
VZ
81 virtual int GetSelection() const;
82 virtual int GetSelections(wxArrayInt& aSelections) const;
83
a236aa20
VZ
84 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
85 unsigned int pos,
86 void **clientData, wxClientDataType type);
2ee3ee1b
VZ
87
88 virtual void DoSetFirstItem(int n);
89
aa61d352
VZ
90 virtual void DoSetItemClientData(unsigned int n, void* clientData);
91 virtual void* DoGetItemClientData(unsigned int n) const;
2ee3ee1b 92
9d522606
RD
93 static wxVisualAttributes
94 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
853dcc57 95
2ee3ee1b 96 // implementation from now on
c801d85f 97
11e1c70d
RR
98 void GtkAddItem( const wxString &item, int pos=-1 );
99 int GtkGetIndex( GtkWidget *item ) const;
ff8bfdbb
VZ
100 GtkWidget *GetConnectWidget();
101 bool IsOwnGtkWindow( GdkWindow *window );
f40fdaa3 102 void DoApplyWidgetStyle(GtkRcStyle *style);
5e014a0c 103 void OnInternalIdle();
ff8bfdbb
VZ
104
105#if wxUSE_TOOLTIPS
4de6207a 106 void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
ff8bfdbb
VZ
107#endif // wxUSE_TOOLTIPS
108
109 GtkList *m_list;
11e1c70d 110 wxList m_clientList;
88ac883a
VZ
111
112#if wxUSE_CHECKLISTBOX
ff8bfdbb 113 bool m_hasCheckBoxes;
88ac883a 114#endif // wxUSE_CHECKLISTBOX
c801d85f 115
bac95742
RR
116 int m_prevSelection;
117 bool m_blockEvent;
8161b5b9 118
3ae4c570
VZ
119 virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y);
120
f68586e5
VZ
121protected:
122 virtual wxSize DoGetBestSize() const;
123
8161b5b9
VZ
124 // return the string label for the given item
125 wxString GetRealLabel(struct _GList *item) const;
126
9d522606
RD
127 // Widgets that use the style->base colour for the BG colour should
128 // override this and return true.
129 virtual bool UseGTKStyleBase() const { return true; }
130
2ee3ee1b
VZ
131private:
132 // this array is only used for controls with wxCB_SORT style, so only
133 // allocate it if it's needed (hence using pointer)
134 wxSortedArrayString *m_strings;
135
136 DECLARE_DYNAMIC_CLASS(wxListBox)
137};
dcf924a3 138
c801d85f 139#endif // __GTKLISTBOXH__