Motif files added.
[wxWidgets.git] / src / motif / choice.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: choice.cpp
3 // Purpose: wxChoice
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 #ifdef __GNUG__
13 #pragma implementation "choice.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/choice.h"
18
19 #if !USE_SHARED_LIBRARY
20 IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
21 #endif
22
23 bool wxChoice::Create(wxWindow *parent, wxWindowID id,
24 const wxPoint& pos,
25 const wxSize& size,
26 int n, const wxString choices[],
27 long style,
28 const wxValidator& validator,
29 const wxString& name)
30 {
31 SetName(name);
32 SetValidator(validator);
33 m_noStrings = n;
34 m_windowStyle = style;
35
36 if (parent) parent->AddChild(this);
37
38 if ( id == -1 )
39 m_windowId = (int)NewControlId();
40 else
41 m_windowId = id;
42
43 // TODO: create choice control
44 return FALSE;
45 }
46
47 void wxChoice::Append(const wxString& item)
48 {
49 // TODO
50 m_noStrings ++;
51 }
52
53 void wxChoice::Delete(int n)
54 {
55 // TODO
56 m_noStrings --;
57 }
58
59 void wxChoice::Clear()
60 {
61 // TODO
62 m_noStrings = 0;
63 }
64
65 int wxChoice::GetSelection() const
66 {
67 // TODO
68 return 0;
69 }
70
71 void wxChoice::SetSelection(int n)
72 {
73 // TODO
74 }
75
76 int wxChoice::FindString(const wxString& s) const
77 {
78 // TODO
79 return 0;
80 }
81
82 wxString wxChoice::GetString(int n) const
83 {
84 // TODO
85 return wxString("");
86 }
87
88 void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
89 {
90 // TODO
91 }
92
93 wxString wxChoice::GetStringSelection () const
94 {
95 int sel = GetSelection ();
96 if (sel > -1)
97 return wxString(this->GetString (sel));
98 else
99 return wxString("");
100 }
101
102 bool wxChoice::SetStringSelection (const wxString& s)
103 {
104 int sel = FindString (s);
105 if (sel > -1)
106 {
107 SetSelection (sel);
108 return TRUE;
109 }
110 else
111 return FALSE;
112 }
113
114 void wxChoice::Command(wxCommandEvent & event)
115 {
116 SetSelection (event.GetInt());
117 ProcessCommand (event);
118 }
119