#include "mBarRange.h"
-
//const wxEventType wxEVT_TSBAR = wxNewEventType();
DEFINE_EVENT_TYPE(wxEVT_TSBAR)
DEFINE_EVENT_TYPE(wxEVT_TSBAR_MOVED)
DEFINE_EVENT_TYPE(wxEVT_SELECTION_END)
-
-
//----------------------------------------------------------------------------
//EVENT TABLE
//----------------------------------------------------------------------------
IMPLEMENT_CLASS(mBarRange, wxScrolledWindow)
+
BEGIN_EVENT_TABLE(mBarRange, wxScrolledWindow)
EVT_PAINT (mBarRange::OnPaint)
EVT_SIZE (mBarRange::OnSize)
//CONSTRUCTOR
//----------------------------------------------------------------------------
+//wxDefaultSize
mBarRange::mBarRange(wxWindow *parent, int w, int h)
-:wxScrolledWindow(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL)
+:wxScrolledWindow(parent,-1,wxDefaultPosition, wxSize(60,60) ,wxTAB_TRAVERSAL)
{
- acceptedClick = true;
- _bitmap_bar = NULL;
+ acceptedClick = true;
+ _bitmap_bar = NULL;
SetWidth (w);
SetHeight(h);
- _initialPoint = 0;
- trianglesHalfWidth = 5;
-
-
+ _initialPoint = 0;
+ trianglesHalfWidth = 5;
// Setting the default parts colors
start_Colour = wxColour(1,0,255,254);
actual_Colour = wxColour(255,255,202);
bar_Colour = wxColour(255,0,255);
backgroundColor = parent ->GetBackgroundColour();
guideLineColor = wxColour(255,0,0);
-
//actual is in _start and end
//false means that it could be anywhere
_moveActualWithBar = false;
_selectionMoveId = -1;
realX_vertical_line = -1;
activeState = false;
- _actual=0;
- deviceEndMargin = 0;
-
+ _actual = 0;
+ deviceEndMargin = 0;
SetOrientation(true);
setIfWithActualDrawed(true);
-
b_popmenu.Append (cntID_CHANGE_COLOR, _("Change Color"), _("Changes the color of the selected part"));
b_popmenu.Append (cntID_ENABLE_ACTUAL, _("Enable actual in range"), _("Enables/Disables the actual triangle to be or not in range"));
b_popmenu.Append (cntID_MOVABLE_ACTUAL_BAR, _("Move actual-bar simultaneously"), _("Disables the actual triangle to move with the bar"));
-
SetSize(w,h);
}
mBarRange::~mBarRange()
{
}
+
//---------------------------------------------------------------------------
//Draw bar: vertical or Horizontal
//---------------------------------------------------------------------------
{
return ((_start - _min)*(_w-deviceEndMargin))/(_max - _min);
}
+
//----------------------------------------------------------------------------
// param i: value in pixels
//----------------------------------------------------------------------------
_start = _min+((i - deviceStart_x)*( _max - _min))/(_w-deviceEndMargin);
}
+
//----------------------------------------------------------------------------
// _actual of the pixel rectangle
//----------------------------------------------------------------------------
{
return ((_actual - _min)*(_w-deviceEndMargin))/(_max - _min);
}
+
//----------------------------------------------------------------------------
// param i: value in pixels
//----------------------------------------------------------------------------
{
_actual = _min + (i-deviceStart_x)*(_max-_min)/(_w-deviceEndMargin);
}
+
//----------------------------------------------------------------------------
// _end of the pixel rectangle
//----------------------------------------------------------------------------
{
return ((_end - _min)*(_w-deviceEndMargin))/(_max - _min);
}
+
//----------------------------------------------------------------------------
// param i: value in pixels to be converted to real logical value
//----------------------------------------------------------------------------
{
_end = _min + (i-deviceStart_x)*(_max-_min)/(_w-deviceEndMargin);
}
+
//----------------------------------------------------------------------------
// Logical max of the triangle
//----------------------------------------------------------------------------
-
double mBarRange::GetMax()
{
return _max;