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