Insert() patch from John Labenski
[wxWidgets.git] / include / wx / motif / combobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: combobox.h
3 // Purpose: wxComboBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COMBOBOX_H_
13 #define _WX_COMBOBOX_H_
14
15 #ifdef __GNUG__
16 #pragma interface "combobox.h"
17 #endif
18
19 #include "wx/choice.h"
20
21 WXDLLEXPORT_DATA(extern const char*) wxComboBoxNameStr;
22 WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
23
24 // Combobox item
25 class WXDLLEXPORT wxComboBox: public wxChoice
26 {
27 DECLARE_DYNAMIC_CLASS(wxComboBox)
28
29 public:
30 wxComboBox() { m_inSetSelection = false; }
31 ~wxComboBox();
32
33 inline wxComboBox(wxWindow *parent, wxWindowID id,
34 const wxString& value = wxEmptyString,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 int n = 0, const wxString choices[] = NULL,
38 long style = 0,
39 const wxValidator& validator = wxDefaultValidator,
40 const wxString& name = wxComboBoxNameStr)
41 {
42 m_inSetSelection = false;
43 Create(parent, id, value, pos, size, n, choices,
44 style, validator, name);
45 }
46
47 bool Create(wxWindow *parent, wxWindowID id,
48 const wxString& value = wxEmptyString,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 int n = 0, const wxString choices[] = NULL,
52 long style = 0,
53 const wxValidator& validator = wxDefaultValidator,
54 const wxString& name = wxComboBoxNameStr);
55
56 // implementation of wxControlWithItems
57 virtual int DoAppend(const wxString& item);
58 virtual int DoInsert(const wxString& item, int pos);
59 virtual void Delete(int n);
60 virtual void Clear();
61 virtual int GetSelection() const ;
62 virtual void SetSelection(int n);
63 virtual int FindString(const wxString& s) const;
64 virtual wxString GetString(int n) const ;
65 virtual void SetString(int n, const wxString& s);
66
67 // Text field functions
68 virtual wxString GetValue() const ;
69 virtual void SetValue(const wxString& value);
70
71 // Clipboard operations
72 virtual void Copy();
73 virtual void Cut();
74 virtual void Paste();
75 virtual void SetInsertionPoint(long pos);
76 virtual void SetInsertionPointEnd();
77 virtual long GetInsertionPoint() const ;
78 virtual long GetLastPosition() const ;
79 virtual void Replace(long from, long to, const wxString& value);
80 virtual void Remove(long from, long to);
81 virtual void SetSelection(long from, long to);
82 virtual void SetEditable(bool editable);
83
84 // Implementation
85 virtual void ChangeFont(bool keepOriginalSize = TRUE);
86 virtual void ChangeBackgroundColour();
87 virtual void ChangeForegroundColour();
88 WXWidget GetTopWidget() const { return m_mainWidget; }
89 WXWidget GetMainWidget() const { return m_mainWidget; }
90
91 virtual wxSize DoGetBestSize() const;
92 protected:
93 virtual void DoSetSize(int x, int y,
94 int width, int height,
95 int sizeFlags = wxSIZE_AUTO);
96 private:
97 // only implemented for native combo box
98 void AdjustDropDownListSize();
99
100 // implementation detail, should really be private
101 public:
102 bool m_inSetSelection;
103 };
104
105 #endif
106 // _WX_COMBOBOX_H_