// Name: src/palmos/tglbtn.cpp
// Purpose: Definition of the wxToggleButton class, which implements a
// toggle button.
-// Author: William Osborne
-// Modified by:
+// Author: William Osborne - minimal working wxPalmOS port
+// Modified by: Wlodzimierz ABX Skiba - native implementation
// Created: 10/13/04
-// RCS-ID: $Id:
-// Copyright: (c) William Osborne
+// RCS-ID: $Id$
+// Copyright: (c) William Osborne, Wlodzimierz Skiba
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#pragma hdrstop
#endif
-#include "wx/tglbtn.h"
-
#if wxUSE_TOGGLEBTN
+#include "wx/tglbtn.h"
+
#ifndef WX_PRECOMP
#include "wx/button.h"
#include "wx/brush.h"
#include "wx/log.h"
#endif // WX_PRECOMP
-#include "wx/palmos/private.h"
+#include <Control.h>
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED)
-
-#define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10)
+wxDEFINE_EVENT( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEvent )
// ============================================================================
// implementation
// wxToggleButton
// ----------------------------------------------------------------------------
-bool wxToggleButton::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id))
-{
- wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId);
- event.SetInt(GetValue());
- event.SetEventObject(this);
- ProcessCommand(event);
- return TRUE;
-}
-
// Single check box item
bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
const wxString& label,
const wxValidator& validator,
const wxString& name)
{
- return false;
+ if(!wxControl::Create(parent, id, pos, size, style, validator, name))
+ return false;
+
+ return wxControl::PalmCreateControl(pushButtonCtl, label, pos, size);
}
wxBorder wxToggleButton::GetDefaultBorder() const
return wxBORDER_NONE;
}
-WXDWORD wxToggleButton::MSWGetStyle(long style, WXDWORD *exstyle) const
-{
- return 0;
-}
-
-void wxToggleButton::SetLabel(const wxString& label)
-{
-}
-
wxSize wxToggleButton::DoGetBestSize() const
{
return wxSize(0,0);
void wxToggleButton::SetValue(bool val)
{
+ SetBoolValue(val);
}
-#ifndef BST_CHECKED
-#define BST_CHECKED 0x0001
-#endif
-
bool wxToggleButton::GetValue() const
{
- return false;
+ return GetBoolValue();
+}
+
+bool wxToggleButton::SendClickEvent()
+{
+ wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, GetId());
+ event.SetInt(GetValue());
+ event.SetEventObject(this);
+ return ProcessCommand(event);
}
void wxToggleButton::Command(wxCommandEvent & event)
}
#endif // wxUSE_TOGGLEBTN
-