// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "control.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_CONTROLS
+#include "wx/control.h"
+
#ifndef WX_PRECOMP
#include "wx/event.h"
#include "wx/app.h"
#include "wx/dcclient.h"
#include "wx/log.h"
#include "wx/settings.h"
+ #include "wx/button.h"
+ #include "wx/checkbox.h"
+ #include "wx/radiobut.h"
+ #include "wx/slider.h"
+ #include "wx/toplevel.h"
#endif
-#include "wx/control.h"
-#include "wx/toplevel.h"
-#include "wx/button.h"
-#include "wx/checkbox.h"
#include "wx/tglbtn.h"
-#include "wx/radiobut.h"
-#include "wx/slider.h"
+
+#include <Control.h>
+#include <Form.h>
+#ifdef __WXPALMOS6__
+ #include <StatusBar.h>
+#else
+ #include <PenInputMgr.h>
+#endif // __WXPALMOS6__
// ----------------------------------------------------------------------------
// wxWin macros
wxControl::~wxControl()
{
+ SendDestroyEvent();
+
SetLabel(wxEmptyString);
- m_isBeingDeleted = true;
DestroyChildren();
uint16_t index;
- FormType* form = GetObjectFormIndex(index);
+ FormType* form = (FormType*)GetObjectFormIndex(index);
if(form!=NULL && index!=frmInvalidObjectId)
{
FrmRemoveObject((FormType **)&form,index);
return true;
}
-bool wxControl::PalmCreateControl(ControlStyleType style,
+bool wxControl::PalmCreateControl(int style,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
uint8_t groupID)
{
- FormType* form = GetParentForm();
+ FormType* form = (FormType*)GetParentForm();
if(form==NULL)
return false;
ControlType *control = CtlNewControl(
(void **)&form,
GetId(),
- style,
- wxEmptyString,
+ (ControlStyleType)style,
+ NULL,
x,
y,
w,
m_palmControl = true;
- SetInitialBestSize(size);
+ SetInitialSize(size);
SetLabel(label);
Show();
return true;
const wxSize& size,
bool editable,
bool underlined,
- JustificationType justification)
+ int justification)
{
- FormType* form = GetParentForm();
+ FormType* form = (FormType*)GetParentForm();
if(form==NULL)
return false;
underlined,
false,
false,
- justification,
+ (JustificationType)justification,
false,
false,
false
m_palmField = true;
- SetInitialBestSize(size);
+ SetInitialSize(size);
SetLabel(label);
Show();
return true;
// various accessors
// ----------------------------------------------------------------------------
-FormType* wxControl::GetParentForm() const
+WXFORMPTR wxControl::GetParentForm() const
{
wxWindow* parentTLW = GetParent();
while ( parentTLW && !parentTLW->IsTopLevel() )
return tlw->GetForm();
}
-FormType* wxControl::GetObjectFormIndex(uint16_t& index) const
+WXFORMPTR wxControl::GetObjectFormIndex(uint16_t& index) const
{
- FormType* form = GetParentForm();
+ FormType* form = (FormType* )GetParentForm();
if(form!=NULL)
index = FrmGetObjectIndex(form, GetId());
else
void* wxControl::GetObjectPtr() const
{
uint16_t index;
- FormType* form = GetObjectFormIndex(index);
+ FormType* form = (FormType*)GetObjectFormIndex(index);
if(form==NULL || index==frmInvalidObjectId)return NULL;
return FrmGetObjectPtr(form,index);
}
void wxControl::SetIntValue(int val)
{
- FormType* form = GetParentForm();
+ FormType* form = (FormType*)GetParentForm();
if(form==NULL)
return;
uint16_t index = FrmGetObjectIndex(form, GetId());
bool wxControl::GetBoolValue() const
{
- FormType* form = GetParentForm();
+ FormType* form = (FormType*)GetParentForm();
if(form==NULL)
return false;
uint16_t index = FrmGetObjectIndex(form, GetId());
return wxSize(16, 16);
}
-void wxControl::DoGetBounds( RectangleType &rect ) const
+void wxControl::DoGetBounds( WXRECTANGLEPTR rect ) const
{
- FormType* form = GetParentForm();
+ if(rect==NULL)
+ return;
+ FormType* form = (FormType*)GetParentForm();
if(form==NULL)
return;
uint16_t index = FrmGetObjectIndex(form,GetId());
if(index==frmInvalidObjectId)
return;
- FrmGetObjectBounds(form,index,&rect);
+ FrmGetObjectBounds(form,index,(RectangleType*)rect);
}
-void wxControl::DoSetBounds( RectangleType &rect )
+void wxControl::DoSetBounds( WXRECTANGLEPTR rect )
{
- FormType* form = GetParentForm();
+ if(rect==NULL)
+ return;
+ FormType* form = (FormType*)GetParentForm();
if(form==NULL)
return;
uint16_t index = FrmGetObjectIndex(form,GetId());
if(index==frmInvalidObjectId)
return;
- FrmSetObjectBounds(form,index,&rect);
+ FrmSetObjectBounds(form,index,(RectangleType*)rect);
}
void wxControl::DoGetPosition( int *x, int *y ) const
AdjustForParentClientOrigin(ox, oy);
RectangleType rect;
- DoGetBounds(rect);
+ DoGetBounds(&rect);
if(x)
*x = rect.topLeft.x - ox;
void wxControl::DoGetSize( int *width, int *height ) const
{
RectangleType rect;
- DoGetBounds(rect);
+ DoGetBounds(&rect);
if(width)
*width = rect.extent.x;
rect.topLeft.y = y;
rect.extent.x = width;
rect.extent.y = height;
- DoSetBounds(rect);
+ DoSetBounds(&rect);
GetParent()->Refresh(true, &area);
}
bool wxControl::Show( bool show )
{
- FormType* form = GetParentForm();
+ FormType* form = (FormType*)GetParentForm();
if(form==NULL)
return false;
uint16_t index = FrmGetObjectIndex(form,GetId());
if(field==NULL)
return;
- uint16_t newSize = label.Length() + 1;
+ uint16_t newSize = label.length() + 1;
MemHandle strHandle = FldGetTextHandle(field);
FldSetTextHandle(field, NULL );
if (strHandle)
ControlType* control = (ControlType*)GetObjectPtr();
if(control==NULL)
return;
- CtlSetLabel(control,wxEmptyString);
+ CtlSetLabel(control, "");
m_label = label;
if(!m_label.empty())
CtlSetLabel(control,m_label.c_str());
return wxEmptyString;
return CtlGetLabel(control);
}
-
+#if 0
wxString wxControl::GetLabel()
{
if(IsPalmField())
return wxEmptyString;
}
-
+#endif
/* static */ wxVisualAttributes
wxControl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
{
bool wxControl::ProcessCommand(wxCommandEvent& event)
{
- return GetEventHandler()->ProcessEvent(event);
+ return HandleWindowEvent(event);
}
void wxControl::OnEraseBackground(wxEraseEvent& event)