///////////////////////////////////////////////////////////////////////////////
-// Name: univ/spinbutt.cpp
+// Name: src/univ/spinbutt.cpp
// Purpose: implementation of the universal version of wxSpinButton
// Author: Vadim Zeitlin
// Modified by:
// Created: 21.01.01
// RCS-ID: $Id$
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "spinbutt.h"
- #pragma implementation "univspinbutt.h"
-#endif
-
#include "wx/wxprec.h"
#ifdef __BORLANDC__
// implementation of wxSpinButton
// ============================================================================
-IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
-IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
-
// ----------------------------------------------------------------------------
// creation
// ----------------------------------------------------------------------------
if ( !wxSpinButtonBase::Create(parent, id, pos, size, style,
wxDefaultValidator, name) )
- return FALSE;
+ return false;
- SetBestSize(size);
+ SetInitialSize(size);
CreateInputHandler(wxINP_HANDLER_SPINBTN);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
// nothing changed - most likely because we are already at min/max
// value
- return FALSE;
+ return false;
}
wxSpinEvent event(inc > 0 ? wxEVT_SCROLL_LINEUP : wxEVT_SCROLL_LINEDOWN,
if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() )
{
// programm has vetoed the event
- return FALSE;
+ return false;
}
m_value = valueNew;
event.SetEventType(wxEVT_SCROLL_THUMBTRACK);
(void)GetEventHandler()->ProcessEvent(event);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
}
}
-wxScrollArrows::Arrow wxSpinButton::HitTest(const wxPoint& pt) const
+wxScrollArrows::Arrow wxSpinButton::HitTestArrow(const wxPoint& pt) const
{
wxRect rectArrow1, rectArrow2;
CalcArrowRects(&rectArrow1, &rectArrow2);
- if ( rectArrow1.Inside(pt) )
+ if ( rectArrow1.Contains(pt) )
return wxScrollArrows::Arrow_First;
- else if ( rectArrow2.Inside(pt) )
+ else if ( rectArrow2.Contains(pt) )
return wxScrollArrows::Arrow_Second;
else
return wxScrollArrows::Arrow_None;
else
return wxControl::PerformAction(action, numArg, strArg);
- return TRUE;
+ return true;
+}
+
+/* static */
+wxInputHandler *wxSpinButton::GetStdInputHandler(wxInputHandler *handlerDef)
+{
+ static wxStdSpinButtonInputHandler s_handler(handlerDef);
+
+ return &s_handler;
}
// ----------------------------------------------------------------------------
break;
}
- if ( !!action )
+ if ( !action.IsEmpty() )
{
consumer->PerformAction(action);
- return TRUE;
+ return true;
}
}
if ( spinbtn->GetArrows().HandleMouse(event) )
{
// don't refresh, everything is already done
- return FALSE;
+ return false;
}
return wxStdInputHandler::HandleMouse(consumer, event);
if ( spinbtn->GetArrows().HandleMouseMove(event) )
{
// processed by the arrows
- return FALSE;
+ return false;
}
return wxStdInputHandler::HandleMouseMove(consumer, event);