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 //----------------------------------------------------------------------------
31 BEGIN_DECLARE_EVENT_TYPES()
32 DECLARE_EVENT_TYPE(wxEVT_TSBAR,-1)
33 DECLARE_EVENT_TYPE(wxEVT_TSBAR_ACTUAL,-1)
34 //DECLARE_EXPORTED_EVENT_TYPE(MARACASVISULIB_EXPORTS,wxEVT_TSBAR_ACTUAL,-1)
35 //extern creaMaracasVisu_EXPORT const wxEventType wxEVT_TSBAR_ACTUAL;
36 DECLARE_EVENT_TYPE(wxEVT_TSBAR_START,-1)
37 DECLARE_EVENT_TYPE(wxEVT_TSBAR_END,-1)
38 DECLARE_EVENT_TYPE(wxEVT_TSBAR_MOVED,-1)
39 DECLARE_EVENT_TYPE(wxEVT_SELECTION_END,-1)
40 END_DECLARE_EVENT_TYPES()
45 //-------------------------------------------------------------------------------------------------------------
47 //-------------------------------------------------------------------------------------------------------------
48 /** Command IDs used by pColorPoint */
51 cntID_CHANGE_COLOR = 7000,
53 cntID_MOVABLE_ACTUAL_BAR,
57 class creaMaracasVisu_EXPORT mBarRange :public wxScrolledWindow{
59 //------------------------------------
60 //Constructors & Destructors
61 //------------------------------------
62 mBarRange(wxWindow *parent, int w, int h/*, bool theOrientation, bool useWithActualDrawed*/);
64 //------------------------------------
66 //------------------------------------
67 void Refresh(bool eraseBackground = true, const wxRect* rect = NULL);
68 void OnPaint( wxPaintEvent &WXUNUSED(event) );
69 void OnSize( wxSizeEvent &WXUNUSED(event) );
70 void RefreshHorizontalView();
71 void RefreshVerticalView();
73 void OnMouseMove(wxMouseEvent& event );
75 //------------------------------------
77 //------------------------------------
80 void SetPixelActual(int i);
84 void SetPixelStart(int i);
88 void SetPixelEnd(int i);
92 void SetMax(double i);
96 void SetMin(double i);
100 void SetHeight(int h);
104 void SetWidth(int w);
108 void SetStart(int start);
112 void SetEnd(int end);
116 void SetActual(int actual);
119 //The triangles half width managment
120 int GetTrianglesHalfWidth();
121 void SetTrianglesHalfWidth(int nwTriHalfWidth);
124 //Orientation (false for vertical, true is default for horizontal)
125 bool GetOrientation();
126 void SetOrientation(bool orientation);
128 //Manage the property of the actual triangle to be between de start and the end
129 bool GetInRangeProperty();
130 void SetInRangeProperty(bool in);
132 //Inform if the actual triangle is between the start and the end triangles
133 bool IsActualInRange();
136 * Sets the property for viewing or not the bar labels information
138 void setVisibleLabels (bool setVisible);
141 * Sets the property for viewing or not the bar labels information
142 * return _visibleLables The state of visible labels or not
144 bool getIfVisibleLabels ();
147 * Sets the represented minimum and maximunm values
148 * param minRealValue The minimum represented value (real value)
149 * param maxRealValue The maximum represented value (real value)
151 void setRepresentedValues(double minRealValue,double maxRealValue);
154 * Sets the device start drawing left-superior (pixel) start point
155 * param deviceStart_x Pixel start for x-coord
156 * param deviceStart_y Pixel start for y-coord
158 void setDeviceBlitStart ( wxCoord deviceStart_x, wxCoord deviceStart_y );
163 * param activeNow The new state
165 void setActiveStateTo (bool activeNow);
168 * Gets the active state of the bar
169 * return isActive The actual state
174 * Gets the real-x value to draw a vertical line
175 * return realX_vertical_line The real x value for the vertical line
177 int getRealX_vertical_line();
180 * Sets the real-x value to draw a vertical line
181 * param realX_vertical_line The new real x value for the vertical line
183 void setRealX_vertical_line(int newReal_x);
185 //*******************************************************************************************************
187 //*******************************************************************************************************
190 * Shows the popup menu
192 void onShowPopupMenu (wxMouseEvent& event);
194 * Reacts to the cntID_CHANGE_COLOR wxCommandEvent and adds a color degrade point to the color bar.
195 * param & anEvent The wxCommandEvent actioned event
197 void onChangePartColor ( wxCommandEvent& anEvent );
201 * Reacts to the cntID_ENABLE_ACTUAL wxCommandEvent enables the actual to be between the the range.
202 * param & anEvent The wxCommandEvent actioned event
204 void onEnableRange_Actual ( wxCommandEvent& anEvent );
207 * 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.
208 * param & anEvent The wxCommandEvent actioned event
210 void onMovable_ActualWithBar ( wxCommandEvent& anEvent );
213 * Gets the device value form the end of this panel to the end of the drawing area in the device in pixels
214 * return deviceEndMargin The value asigned to the right margin
220 * Sets the new device (deviceEndMargin) value form the end of this panel to the end of the drawing area in the device
221 * param newDeviceEnd_pixels The new pixel value to asign to the right(horizontal view), underneath(vertical view) margin in pixels
223 void setDeviceEndMargin(int newDeviceEnd_pixels);
226 * Gets the last clickedX pixel coord inside the bar with respect to the container panel.
227 * return clickedX The x-coord pixel value
232 * Sets the last clickedX pixel coord inside the bar with respect to the container panel.
233 * param nwClickX The x-coord pixel value
235 void setClickedX(int nwClickX);
238 * Gets the start porcentage with respect to the represented values of the bar
239 * return The porcentage represented by the start showing point
241 float getStartShowPorcentage();
244 * Gets the end porcentage with respect to the represented values of the bar
245 * return The porcentage represented by the end showing point
247 float getEndShowPorcentage();
250 * Gets the actual porcentage with respect to the represented values of the bar
251 * return The porcentage represented by the actual showing point
253 float getActualShowPorcentage();
256 * Gets the logic value of a pixel point that comes in the coords of the container panel.
257 * param thePixel Is the pixel to convert
258 * return Is the correspondig value to the given pixel-value in logic bar coords
260 int getLogicValueofPixel(int thePixel);
264 * Sets the condition for knowing if the actual triangle is being drawed or not
265 * param drawActual The condition to set for drawing or not the actual control (true for drawing)
267 void setIfWithActualDrawed(bool drawActual);
270 * Gets the condition for knowing if the actual triangle is being drawed or not
271 * return withActualDrawed The condition for drawing or not the actual control
273 bool getIfWithActualDrawed();
276 * Method that creates and send the given id-event to the event handler
277 * param theEventType Is the event id type identification for generating the event
279 void createAndSendEvent(WXTYPE theEventType);
282 * Sets the background color od the bar
283 * theColor The color to set to the backgroundColor
285 void setBackgroundColor(wxColour theColor);
288 * Sets the guide line color
289 * param theNwGuideLineColor The color to set to the guideLineColor
291 void setGuideLineColour(wxColour theNwGuideLineColor);
295 * Gets the guide line color
296 * return guideLineColor The color of the guideLine
298 wxColour getGuideLineColour();
300 void onLeftClicDown(wxMouseEvent& event );
302 void onLeftClickUp(wxMouseEvent& event );
312 //Start of the rectangule
314 //End of the rectangule
320 //Initial point when moving the rectangule bar according to bar reference
323 * Represents the id of the selected moving part of the bar where:
324 * 1 is for Start triangle, 2 for end triangle, 3 for actual triangle and 4 for the bar
326 int _selectionMoveId;
328 //orientation of the rectangle is true when is horizontal and is the default value
332 * The property for identifying if the actual triangle needs to be or not between the limit triangles
334 bool _in_rangeProperty;
337 * The property for setting the acutal triangle to move with the bar keeping proportions with the limits
339 bool _moveActualWithBar;
342 * The property for setting visible or not the bar labels information
346 * X-Coord for left-superior device visible drawing
348 wxCoord deviceStart_x;
351 * Y-Coord for left-superior device visible drawing
353 wxCoord deviceStart_y;
356 * X-Coord for right device margin
358 wxCoord deviceEndMargin;
361 * Represents the active state of the bar
366 * Represents the option of activating or not the drawing of the actual triangle, that in default value is true for drawing it
367 * The dafault value is true (use the actual triangle)
369 bool withActualDrawed;
372 * The colour of the start triangle
374 wxColour start_Colour;
377 * The colour of the actual triangle
379 wxColour actual_Colour;
382 * The colour of the end triangle
387 * The colour of the bar
391 * Represents the real-x value to draw a vertical line
393 int realX_vertical_line;
396 * Represents the last clickedX coord inside the bar.
401 * Represents the orientation for the numbers view label in the information bitmap.
402 * Where -4:left, -6:right, -8:up, -2: down respect to the bar
404 int numberOrientation;
406 * Represents the logic initial reference start point used for dragging
408 int logicInitial_start;
410 * Represents the logic intial reference end point used for dragging
412 int logicInitial_end;
414 * Represents the logic initial reference actual point used for dragging
416 int logicInitial_actual;
419 * Represents the pixel value assigned to as half of the width of the triangles
421 int trianglesHalfWidth;
424 * Represents the background color of the panel (this) where the bar is. The default color is the imediately parent background color
426 wxColour backgroundColor;
428 * Represents the color of the dot-line use as guides. The default color is RED.
430 wxColour guideLineColor;
437 * The color bar pop menu
440 //the bar bitmap device
441 wxBitmap *_bitmap_bar;
442 //the info bitmap device
443 wxBitmap *_bitmap_info;
444 DECLARE_CLASS(BarRange)
445 // any class wishing to process wxWindows events must use this macro
446 DECLARE_EVENT_TABLE()