]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/listbox.h
added wxVListBox::OnDrawBackground(); fixed warnings
[wxWidgets.git] / include / wx / gtk1 / listbox.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: listbox.h
ff8bfdbb 3// Purpose: wxListBox class declaration
c801d85f 4// Author: Robert Roebling
58614078
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
ff8bfdbb 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
10
11#ifndef __GTKLISTBOXH__
12#define __GTKLISTBOXH__
13
ab7ce33c 14#if defined(__GNUG__) && !defined(__APPLE__)
34eac3a8 15#pragma interface "listbox.h"
c801d85f
KB
16#endif
17
c801d85f 18#include "wx/list.h"
c801d85f 19
b5f6b52a
MB
20class WXDLLIMPEXP_BASE wxSortedArrayString;
21
c801d85f
KB
22//-----------------------------------------------------------------------------
23// wxListBox
24//-----------------------------------------------------------------------------
25
2ee3ee1b 26class wxListBox : public wxListBoxBase
c801d85f 27{
fd0eed64 28public:
2ee3ee1b 29 // ctors and such
ff8bfdbb
VZ
30 wxListBox();
31 wxListBox( wxWindow *parent, wxWindowID id,
32 const wxPoint& pos = wxDefaultPosition,
33 const wxSize& size = wxDefaultSize,
34 int n = 0, const wxString choices[] = (const wxString *) NULL,
35 long style = 0,
36 const wxValidator& validator = wxDefaultValidator,
37 const wxString& name = wxListBoxNameStr )
38 {
88ac883a 39#if wxUSE_CHECKLISTBOX
ff8bfdbb 40 m_hasCheckBoxes = FALSE;
88ac883a 41#endif // wxUSE_CHECKLISTBOX
ff8bfdbb
VZ
42 Create(parent, id, pos, size, n, choices, style, validator, name);
43 }
44 virtual ~wxListBox();
45
46 bool Create(wxWindow *parent, wxWindowID id,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 int n = 0, const wxString choices[] = (const wxString *) NULL,
50 long style = 0,
51 const wxValidator& validator = wxDefaultValidator,
52 const wxString& name = wxListBoxNameStr);
53
2ee3ee1b
VZ
54 // implement base class pure virtuals
55 virtual void Clear();
56 virtual void Delete(int n);
57
58 virtual int GetCount() const;
59 virtual wxString GetString(int n) const;
60 virtual void SetString(int n, const wxString& s);
61 virtual int FindString(const wxString& s) const;
62
63 virtual bool IsSelected(int n) const;
64 virtual void SetSelection(int n, bool select = TRUE);
65 virtual int GetSelection() const;
66 virtual int GetSelections(wxArrayInt& aSelections) const;
67
68 virtual int DoAppend(const wxString& item);
69 virtual void DoInsertItems(const wxArrayString& items, int pos);
70 virtual void DoSetItems(const wxArrayString& items, void **clientData);
71
72 virtual void DoSetFirstItem(int n);
73
6c8a980f
VZ
74 virtual void DoSetItemClientData(int n, void* clientData);
75 virtual void* DoGetItemClientData(int n) const;
76 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
77 virtual wxClientData* DoGetItemClientObject(int n) const;
2ee3ee1b
VZ
78
79 // implementation from now on
c801d85f 80
11e1c70d
RR
81 void GtkAddItem( const wxString &item, int pos=-1 );
82 int GtkGetIndex( GtkWidget *item ) const;
ff8bfdbb
VZ
83 GtkWidget *GetConnectWidget();
84 bool IsOwnGtkWindow( GdkWindow *window );
85 void ApplyWidgetStyle();
5e014a0c 86 void OnInternalIdle();
ff8bfdbb
VZ
87
88#if wxUSE_TOOLTIPS
4de6207a 89 void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
ff8bfdbb
VZ
90#endif // wxUSE_TOOLTIPS
91
92 GtkList *m_list;
11e1c70d 93 wxList m_clientList;
88ac883a
VZ
94
95#if wxUSE_CHECKLISTBOX
ff8bfdbb 96 bool m_hasCheckBoxes;
88ac883a 97#endif // wxUSE_CHECKLISTBOX
c801d85f 98
bac95742
RR
99 int m_prevSelection;
100 bool m_blockEvent;
8161b5b9 101
3ae4c570
VZ
102 virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y);
103
f68586e5
VZ
104protected:
105 virtual wxSize DoGetBestSize() const;
106
8161b5b9
VZ
107 // return the string label for the given item
108 wxString GetRealLabel(struct _GList *item) const;
109
2ee3ee1b
VZ
110private:
111 // this array is only used for controls with wxCB_SORT style, so only
112 // allocate it if it's needed (hence using pointer)
113 wxSortedArrayString *m_strings;
114
115 DECLARE_DYNAMIC_CLASS(wxListBox)
116};
dcf924a3 117
c801d85f 118#endif // __GTKLISTBOXH__