added wxTextEntry common base class for both wxTextCtrl and wxComboBox; refactor...
[wxWidgets.git] / include / wx / combobox.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/combobox.h
3 // Purpose: wxComboBox declaration
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 24.12.00
7 // RCS-ID: $Id$
8 // Copyright: (c) 1996-2000 wxWidgets team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COMBOBOX_H_BASE_
13 #define _WX_COMBOBOX_H_BASE_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_COMBOBOX
18
19 extern WXDLLEXPORT_DATA(const wxChar) wxComboBoxNameStr[];
20
21 // ----------------------------------------------------------------------------
22 // wxComboBoxBase: this interface defines the methods wxComboBox must implement
23 // ----------------------------------------------------------------------------
24
25 #include "wx/ctrlsub.h"
26 #include "wx/textentry.h"
27
28 class WXDLLEXPORT wxComboBoxBase : public wxItemContainer,
29 public wxTextEntry
30 {
31 public:
32 // override this to disambiguate between two base classes versions
33 virtual void Clear()
34 {
35 wxTextEntry::Clear();
36 wxItemContainer::Clear();
37 }
38
39 // also bring in GetSelection() versions of both base classes in scope
40 //
41 // NB: GetSelection(from, to) could be already implemented in wxTextEntry
42 // but still make it pure virtual because for some platforms it's not
43 // implemented there and also because the derived class has to override
44 // it anyhow to avoid ambiguity with the other GetSelection()
45 virtual int GetSelection() const = 0;
46 virtual void GetSelection(long *from, long *to) const = 0;
47
48 // may return value different from GetSelection() when the combobox
49 // dropdown is shown and the user selected, but not yet accepted, a value
50 // different from the old one in it
51 virtual int GetCurrentSelection() const { return GetSelection(); }
52 };
53
54 // ----------------------------------------------------------------------------
55 // include the platform-dependent header defining the real class
56 // ----------------------------------------------------------------------------
57
58 #if defined(__WXUNIVERSAL__)
59 #include "wx/univ/combobox.h"
60 #elif defined(__WXMSW__)
61 #include "wx/msw/combobox.h"
62 #elif defined(__WXMOTIF__)
63 #include "wx/motif/combobox.h"
64 #elif defined(__WXGTK20__)
65 #include "wx/gtk/combobox.h"
66 #elif defined(__WXGTK__)
67 #include "wx/gtk1/combobox.h"
68 #elif defined(__WXMAC__)
69 #include "wx/mac/combobox.h"
70 #elif defined(__WXCOCOA__)
71 #include "wx/cocoa/combobox.h"
72 #elif defined(__WXPM__)
73 #include "wx/os2/combobox.h"
74 #endif
75
76 #endif // wxUSE_COMBOBOX
77
78 #endif // _WX_COMBOBOX_H_BASE_