3 #ifndef __mBAR__RANGE__
4 #define __mBAR__RANGE__
7 //-----------------------------------------------------------------------------
9 //-----------------------------------------------------------------------------
10 #include "wx/colordlg.h"
13 // ----------------------------------------------------------------------------
14 // wx headers inclusion.
15 // For compilers that support precompilation, includes <wx/wx.h>.
16 // ----------------------------------------------------------------------------
17 #include <wx/wxprec.h>
26 //----------------------------------------------------------------------------
27 //DECLARING THE NEW EVENT
28 //wxEVT_TSBAR= event of the two side bar
29 //----------------------------------------------------------------------------
30 BEGIN_DECLARE_EVENT_TYPES()
31 DECLARE_EVENT_TYPE(wxEVT_TSBAR, -1)
32 DECLARE_EVENT_TYPE(wxEVT_TSBAR_ACTUAL, -1)
33 DECLARE_EVENT_TYPE(wxEVT_TSBAR_START, -1)
34 DECLARE_EVENT_TYPE(wxEVT_TSBAR_END, -1)
35 DECLARE_EVENT_TYPE(wxEVT_TSBAR_MOVED, -1)
36 DECLARE_EVENT_TYPE(wxEVT_SELECTION_END, -1)
37 END_DECLARE_EVENT_TYPES()
40 //-------------------------------------------------------------------------------------------------------------
42 //-------------------------------------------------------------------------------------------------------------
43 /** Command IDs used by pColorPoint */
46 cntID_CHANGE_COLOR = 7000,
48 cntID_MOVABLE_ACTUAL_BAR,
52 class MARACASVISULIB_EXPORTS mBarRange :public wxScrolledWindow{
54 //------------------------------------
55 //Constructors & Destructors
56 //------------------------------------
57 mBarRange(wxWindow *parent, int w, int h/*, bool theOrientation, bool useWithActualDrawed*/);
59 //------------------------------------
61 //------------------------------------
62 void Refresh(bool eraseBackground = true, const wxRect* rect = NULL);
63 void OnPaint( wxPaintEvent &WXUNUSED(event) );
64 void OnSize( wxSizeEvent &WXUNUSED(event) );
65 void RefreshHorizontalView();
66 void RefreshVerticalView();
68 void OnMouseMove(wxMouseEvent& event );
70 //------------------------------------
72 //------------------------------------
75 void SetPixelActual(int i);
79 void SetPixelStart(int i);
83 void SetPixelEnd(int i);
87 void SetMax(double i);
91 void SetMin(double i);
95 void SetHeight(int h);
103 void SetStart(int start);
107 void SetEnd(int end);
111 void SetActual(int actual);
114 //The triangles half width managment
115 int GetTrianglesHalfWidth();
116 void SetTrianglesHalfWidth(int nwTriHalfWidth);
119 //Orientation (false for vertical, true is default for horizontal)
120 bool GetOrientation();
121 void SetOrientation(bool orientation);
123 //Manage the property of the actual triangle to be between de start and the end
124 bool GetInRangeProperty();
125 void SetInRangeProperty(bool in);
127 //Inform if the actual triangle is between the start and the end triangles
128 bool IsActualInRange();
131 * Sets the property for viewing or not the bar labels information
133 void setVisibleLabels (bool setVisible);
136 * Sets the property for viewing or not the bar labels information
137 * return _visibleLables The state of visible labels or not
139 bool getIfVisibleLabels ();
142 * Sets the represented minimum and maximunm values
143 * param minRealValue The minimum represented value (real value)
144 * param maxRealValue The maximum represented value (real value)
146 void setRepresentedValues(double minRealValue,double maxRealValue);
149 * Sets the device start drawing left-superior (pixel) start point
150 * param deviceStart_x Pixel start for x-coord
151 * param deviceStart_y Pixel start for y-coord
153 void setDeviceBlitStart ( wxCoord deviceStart_x, wxCoord deviceStart_y );
158 * param activeNow The new state
160 void setActiveStateTo (bool activeNow);
163 * Gets the active state of the bar
164 * return isActive The actual state
169 * Gets the real-x value to draw a vertical line
170 * return realX_vertical_line The real x value for the vertical line
172 int getRealX_vertical_line();
175 * Sets the real-x value to draw a vertical line
176 * param realX_vertical_line The new real x value for the vertical line
178 void setRealX_vertical_line(int newReal_x);
180 //*******************************************************************************************************
182 //*******************************************************************************************************
185 * Shows the popup menu
187 void onShowPopupMenu (wxMouseEvent& event);
189 * Reacts to the cntID_CHANGE_COLOR wxCommandEvent and adds a color degrade point to the color bar.
190 * param & anEvent The wxCommandEvent actioned event
192 void onChangePartColor ( wxCommandEvent& anEvent );
196 * Reacts to the cntID_ENABLE_ACTUAL wxCommandEvent enables the actual to be between the the range.
197 * param & anEvent The wxCommandEvent actioned event
199 void onEnableRange_Actual ( wxCommandEvent& anEvent );
202 * Reacts to the cntID_MOVABLE_ACTUAL_BAR wxCommandEvent by enabling or disabling the property of moving the actual triangle with the bar, just when it is inside of it.
203 * param & anEvent The wxCommandEvent actioned event
205 void onMovable_ActualWithBar ( wxCommandEvent& anEvent );
208 * Gets the device value form the end of this panel to the end of the drawing area in the device in pixels
209 * return deviceEndMargin The value asigned to the right margin
215 * Sets the new device (deviceEndMargin) value form the end of this panel to the end of the drawing area in the device
216 * param newDeviceEnd_pixels The new pixel value to asign to the right(horizontal view), underneath(vertical view) margin in pixels
218 void setDeviceEndMargin(int newDeviceEnd_pixels);
221 * Gets the last clickedX pixel coord inside the bar with respect to the container panel.
222 * return clickedX The x-coord pixel value
227 * Sets the last clickedX pixel coord inside the bar with respect to the container panel.
228 * param nwClickX The x-coord pixel value
230 void setClickedX(int nwClickX);
233 * Gets the start porcentage with respect to the represented values of the bar
234 * return The porcentage represented by the start showing point
236 float getStartShowPorcentage();
239 * Gets the end porcentage with respect to the represented values of the bar
240 * return The porcentage represented by the end showing point
242 float getEndShowPorcentage();
245 * Gets the actual porcentage with respect to the represented values of the bar
246 * return The porcentage represented by the actual showing point
248 float getActualShowPorcentage();
251 * Gets the logic value of a pixel point that comes in the coords of the container panel.
252 * param thePixel Is the pixel to convert
253 * return Is the correspondig value to the given pixel-value in logic bar coords
255 int getLogicValueofPixel(int thePixel);
259 * Sets the condition for knowing if the actual triangle is being drawed or not
260 * param drawActual The condition to set for drawing or not the actual control (true for drawing)
262 void setIfWithActualDrawed(bool drawActual);
265 * Gets the condition for knowing if the actual triangle is being drawed or not
266 * return withActualDrawed The condition for drawing or not the actual control
268 bool getIfWithActualDrawed();
271 * Method that creates and send the given id-event to the event handler
272 * param theEventType Is the event id type identification for generating the event
274 void createAndSendEvent(WXTYPE theEventType);
277 * Sets the background color od the bar
278 * theColor The color to set to the backgroundColor
280 void setBackgroundColor(wxColour theColor);
283 * Sets the guide line color
284 * param theNwGuideLineColor The color to set to the guideLineColor
286 void setGuideLineColour(wxColour theNwGuideLineColor);
290 * Gets the guide line color
291 * return guideLineColor The color of the guideLine
293 wxColour getGuideLineColour();
295 void onLeftClicDown(wxMouseEvent& event );
297 void onLeftClickUp(wxMouseEvent& event );
307 //Start of the rectangule
309 //End of the rectangule
315 //Initial point when moving the rectangule bar according to bar reference
318 * Represents the id of the selected moving part of the bar where:
319 * 1 is for Start triangle, 2 for end triangle, 3 for actual triangle and 4 for the bar
321 int _selectionMoveId;
323 //orientation of the rectangle is true when is horizontal and is the default value
327 * The property for identifying if the actual triangle needs to be or not between the limit triangles
329 bool _in_rangeProperty;
332 * The property for setting the acutal triangle to move with the bar keeping proportions with the limits
334 bool _moveActualWithBar;
337 * The property for setting visible or not the bar labels information
341 * X-Coord for left-superior device visible drawing
343 wxCoord deviceStart_x;
346 * Y-Coord for left-superior device visible drawing
348 wxCoord deviceStart_y;
351 * X-Coord for right device margin
353 wxCoord deviceEndMargin;
356 * Represents the active state of the bar
361 * Represents the option of activating or not the drawing of the actual triangle, that in default value is true for drawing it
362 * The dafault value is true (use the actual triangle)
364 bool withActualDrawed;
367 * The colour of the start triangle
369 wxColour start_Colour;
372 * The colour of the actual triangle
374 wxColour actual_Colour;
377 * The colour of the end triangle
382 * The colour of the bar
386 * Represents the real-x value to draw a vertical line
388 int realX_vertical_line;
391 * Represents the last clickedX coord inside the bar.
396 * Represents the orientation for the numbers view label in the information bitmap.
397 * Where -4:left, -6:right, -8:up, -2: down respect to the bar
399 int numberOrientation;
401 * Represents the logic initial reference start point used for dragging
403 int logicInitial_start;
405 * Represents the logic intial reference end point used for dragging
407 int logicInitial_end;
409 * Represents the logic initial reference actual point used for dragging
411 int logicInitial_actual;
414 * Represents the pixel value assigned to as half of the width of the triangles
416 int trianglesHalfWidth;
419 * Represents the background color of the panel (this) where the bar is. The default color is the imediately parent background color
421 wxColour backgroundColor;
423 * Represents the color of the dot-line use as guides. The default color is RED.
425 wxColour guideLineColor;
432 * The color bar pop menu
435 //the bar bitmap device
436 wxBitmap *_bitmap_bar;
437 //the info bitmap device
438 wxBitmap *_bitmap_info;
439 DECLARE_CLASS(BarRange)
440 // any class wishing to process wxWindows events must use this macro
441 DECLARE_EVENT_TABLE()