// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "choice.h"
#endif
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#ifdef __VMS
#define XtDisplay XTDISPLAY
#define XtParent XTPARENT
#include "wx/defs.h"
+#if wxUSE_CHOICE
+
#include "wx/choice.h"
#include "wx/utils.h"
+#include "wx/arrstr.h"
#ifdef __VMS__
#pragma message disable nosimpint
void wxChoice::Init()
{
- InitBase();
-
m_noStrings = 0;
m_buttonWidget = (WXWidget) 0;
m_menuWidget = (WXWidget) 0;
const wxString& name)
{
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
- return FALSE;
+ return false;
Widget parentWidget = (Widget) parent->GetClientWidget();
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
- ChangeFont(FALSE);
+ ChangeFont(false);
ChangeBackgroundColour();
AttachWidget (parent, m_buttonWidget, m_formWidget,
pos.x, pos.y, bestSize.x, bestSize.y);
- return TRUE;
+ return true;
+}
+
+bool wxChoice::Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ wxCArrayString chs(choices);
+ return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
+ style, validator, name);
}
wxChoice::~wxChoice()
int wxChoice::DoInsert(const wxString& item, int pos)
{
- wxCHECK_MSG(FALSE, -1, wxT("insert not implemented"));
+ wxCHECK_MSG(false, -1, wxT("insert not implemented"));
// wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
// if (pos == GetCount()) return DoAppend(item);
void wxChoice::SetSelection(int n)
{
- m_inSetValue = TRUE;
+ m_inSetValue = true;
wxStringList::compatibility_iterator node = m_stringList.Item(n);
if (node)
XmNmenuHistory, (Widget) m_widgetArray[n], NULL);
#endif
}
- m_inSetValue = FALSE;
+ m_inSetValue = false;
}
int wxChoice::FindString(const wxString& s) const
i++;
}
- return -1;
+ return wxNOT_FOUND;
}
wxString wxChoice::GetString(int n) const
{
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, item->GetId());
event.SetEventObject(item);
- event.m_commandInt = n;
- event.m_commandString = item->GetStrings().Item(n)->GetData();
+ event.SetInt(n);
+ event.SetString( item->GetStrings().Item(n)->GetData() );
if ( item->HasClientObjectData() )
event.SetClientObject( item->GetClientObject(n) );
else if ( item->HasClientUntypedData() )
XtVaSetValues( (Widget)m_widgetArray[i],
fontTag, fontType,
NULL );
-
+
GetSize(& width1, & height1);
if (keepOriginalSize && (width != width1 || height != height1))
{
- SetSize(-1, -1, width, height);
+ SetSize(wxDefaultCoord, wxDefaultCoord, width, height);
}
}
}
void wxChoice::DoSetItemClientData(int n, void* clientData)
{
- m_clientDataDict.Set(n, (wxClientData*)clientData, FALSE);
+ m_clientDataDict.Set(n, (wxClientData*)clientData, false);
}
void* wxChoice::DoGetItemClientData(int n) const
void wxChoice::DoSetItemClientObject(int n, wxClientData* clientData)
{
// don't delete, wxItemContainer does that for us
- m_clientDataDict.Set(n, clientData, FALSE);
+ m_clientDataDict.Set(n, clientData, false);
}
wxClientData* wxChoice::DoGetItemClientObject(int n) const
return wxSize( ( items.x ? items.x + WIDTH_OVERHEAD : 120 ),
items.y + HEIGHT_OVERHEAD );
}
+
+#endif // wxUSE_CHOICE