]> git.saurik.com Git - wxWidgets.git/blob - include/wx/combobox.h
Don't return a dangling pointer from wxDateTime::ParseXXX(wxCStrData).
[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 // For compatibility with 2.8 include this header to allow using wxTE_XXX
20 // styles with wxComboBox without explicitly including it in the user code.
21 #include "wx/textctrl.h"
22
23 extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
24
25 // ----------------------------------------------------------------------------
26 // wxComboBoxBase: this interface defines the methods wxComboBox must implement
27 // ----------------------------------------------------------------------------
28
29 #include "wx/ctrlsub.h"
30 #include "wx/textentry.h"
31
32 class WXDLLIMPEXP_CORE wxComboBoxBase : public wxItemContainer,
33 public wxTextEntry
34 {
35 public:
36 // override these methods to disambiguate between two base classes versions
37 virtual void Clear()
38 {
39 wxTextEntry::Clear();
40 wxItemContainer::Clear();
41 }
42
43 // IsEmpty() is ambiguous because we inherit it from both wxItemContainer
44 // and wxTextEntry, and even if defined it here to help the compiler with
45 // choosing one of them, it would still be confusing for the human users of
46 // this class. So instead define the clearly named methods below and leave
47 // IsEmpty() ambiguous to trigger a compilation error if it's used.
48 bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
49 bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
50
51 // also bring in GetSelection() versions of both base classes in scope
52 //
53 // NB: GetSelection(from, to) could be already implemented in wxTextEntry
54 // but still make it pure virtual because for some platforms it's not
55 // implemented there and also because the derived class has to override
56 // it anyhow to avoid ambiguity with the other GetSelection()
57 virtual int GetSelection() const = 0;
58 virtual void GetSelection(long *from, long *to) const = 0;
59
60 virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); }
61 virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); }
62
63 // may return value different from GetSelection() when the combobox
64 // dropdown is shown and the user selected, but not yet accepted, a value
65 // different from the old one in it
66 virtual int GetCurrentSelection() const { return GetSelection(); }
67 };
68
69 // ----------------------------------------------------------------------------
70 // include the platform-dependent header defining the real class
71 // ----------------------------------------------------------------------------
72
73 #if defined(__WXUNIVERSAL__)
74 #include "wx/univ/combobox.h"
75 #elif defined(__WXMSW__)
76 #include "wx/msw/combobox.h"
77 #elif defined(__WXMOTIF__)
78 #include "wx/motif/combobox.h"
79 #elif defined(__WXGTK20__)
80 #include "wx/gtk/combobox.h"
81 #elif defined(__WXGTK__)
82 #include "wx/gtk1/combobox.h"
83 #elif defined(__WXMAC__)
84 #include "wx/osx/combobox.h"
85 #elif defined(__WXCOCOA__)
86 #include "wx/cocoa/combobox.h"
87 #elif defined(__WXPM__)
88 #include "wx/os2/combobox.h"
89 #endif
90
91 #endif // wxUSE_COMBOBOX
92
93 #endif // _WX_COMBOBOX_H_BASE_