mBarRange.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef __mBAR__RANGE__
00004 #define __mBAR__RANGE__
00005 
00006 
00007 //-----------------------------------------------------------------------------
00008 // Includes
00009 //-----------------------------------------------------------------------------
00010 #include "wx/colordlg.h"
00011 
00012 
00013 // ----------------------------------------------------------------------------
00014 // wx headers inclusion.
00015 // For compilers that support precompilation, includes <wx/wx.h>.
00016 // ----------------------------------------------------------------------------
00017 #include <wx/wxprec.h>
00018 #ifdef __BORLANDC__
00019 #pragma hdrstop
00020 #endif
00021 #ifndef WX_PRECOMP
00022 #include <wx/wx.h>
00023 #endif
00024 #include "marTypes.h"
00025 
00026 //----------------------------------------------------------------------------
00027 //DECLARING THE NEW EVENT
00028 //wxEVT_TSBAR= event of the two side bar
00029 //----------------------------------------------------------------------------
00030 
00031 BEGIN_DECLARE_EVENT_TYPES()
00032  DECLARE_EVENT_TYPE(wxEVT_TSBAR,-1) 
00033 DECLARE_EVENT_TYPE(wxEVT_TSBAR_ACTUAL,-1)
00034 //DECLARE_EXPORTED_EVENT_TYPE(MARACASVISULIB_EXPORTS,wxEVT_TSBAR_ACTUAL,-1)
00035 //extern creaMaracasVisu_EXPORT const wxEventType wxEVT_TSBAR_ACTUAL;
00036  DECLARE_EVENT_TYPE(wxEVT_TSBAR_START,-1)
00037  DECLARE_EVENT_TYPE(wxEVT_TSBAR_END,-1)
00038  DECLARE_EVENT_TYPE(wxEVT_TSBAR_MOVED,-1)
00039  DECLARE_EVENT_TYPE(wxEVT_SELECTION_END,-1)
00040 END_DECLARE_EVENT_TYPES()
00041 
00042 
00043 
00044 
00045 //-------------------------------------------------------------------------------------------------------------
00046 // Enum declarations
00047 //-------------------------------------------------------------------------------------------------------------
00049 enum
00050 {
00051         cntID_CHANGE_COLOR = 7000,
00052         cntID_ENABLE_ACTUAL,    
00053         cntID_MOVABLE_ACTUAL_BAR,
00054 };
00055 
00056 
00057 class creaMaracasVisu_EXPORT mBarRange :public  wxScrolledWindow{
00058 public:
00059         //------------------------------------
00060         //Constructors & Destructors
00061         //------------------------------------
00062         mBarRange(wxWindow *parent, int w, int h/*, bool theOrientation, bool useWithActualDrawed*/);
00063         ~mBarRange();
00064         //------------------------------------
00065         // Bar Methods
00066         //------------------------------------
00067         void Refresh(bool eraseBackground = true, const wxRect* rect = NULL);
00068         void OnPaint( wxPaintEvent &WXUNUSED(event) );
00069         void OnSize( wxSizeEvent &WXUNUSED(event) );
00070         void RefreshHorizontalView();
00071         void RefreshVerticalView();
00072         void RefreshForce();
00073         void OnMouseMove(wxMouseEvent& event );
00074         void DrawBar();
00075         //------------------------------------
00076         // Getters & Setters
00077         //------------------------------------
00078         //Actual triangle
00079         int GetPixelActual();
00080         void SetPixelActual(int i);
00081 
00082         //Start of the bar
00083         int GetPixelStart();
00084         void SetPixelStart(int i);
00085 
00086         //End of the bar
00087         int GetPixelEnd();
00088         void SetPixelEnd(int i);
00089 
00090         //Logical Max
00091         double GetMax();
00092         void SetMax(double i);
00093 
00094         //Logical Min
00095         double GetMin();
00096         void SetMin(double i);
00097 
00098         //Rectangule Height
00099         int GetHeight();
00100         void SetHeight(int h);
00101 
00102         //Width
00103         int GetWidth();
00104         void SetWidth(int w);
00105 
00106         //Logical Start
00107         int GetStart();
00108         void SetStart(int start);
00109 
00110         //Logical End
00111         int GetEnd();
00112         void SetEnd(int end);
00113 
00114         //logical actual
00115         int GetActual();
00116         void SetActual(int actual);
00117 
00118 
00119         //The triangles half width managment
00120         int GetTrianglesHalfWidth();
00121         void SetTrianglesHalfWidth(int nwTriHalfWidth);
00122         
00123 
00124         //Orientation (false for vertical, true is default for horizontal)
00125         bool GetOrientation();
00126         void SetOrientation(bool orientation);
00127 
00128         //Manage the property of the actual triangle to be between de start and the end
00129         bool GetInRangeProperty();
00130         void SetInRangeProperty(bool in);
00131 
00132         //Inform if the actual triangle is between the start and the end triangles
00133         bool IsActualInRange();
00134 
00135         /*
00136         * Sets the property for viewing or not the bar labels information
00137         */
00138         void setVisibleLabels (bool setVisible);
00139 
00140         /*
00141         * Sets the property for viewing or not the bar labels information
00142         * return _visibleLables The state of visible labels or not 
00143         */
00144         bool getIfVisibleLabels ();
00145 
00146         /*
00147         * Sets the represented minimum and maximunm values
00148         * param minRealValue The minimum represented value (real value)
00149         * param maxRealValue The maximum represented value (real value)
00150         */
00151         void setRepresentedValues(double minRealValue,double maxRealValue);
00152 
00158         void setDeviceBlitStart ( wxCoord deviceStart_x, wxCoord deviceStart_y );
00159 
00160 
00161         /*
00162         * Set active state 
00163         * param activeNow The new state
00164         */
00165         void setActiveStateTo (bool activeNow);
00166         
00167         /*
00168         * Gets the active state of the bar
00169         *  return isActive The actual state
00170         */
00171         bool isActive();
00172 
00173         /*
00174         * Gets the real-x value to draw a vertical line
00175         * return realX_vertical_line The real x value for the vertical line
00176         */
00177         int     getRealX_vertical_line();
00178 
00179         /*
00180         * Sets the real-x value to draw a vertical line
00181         * param realX_vertical_line The new real x value for the vertical line
00182         */
00183         void setRealX_vertical_line(int newReal_x);
00184 
00185         //*******************************************************************************************************
00186         // Event methods
00187         //*******************************************************************************************************
00188 
00192         void onShowPopupMenu (wxMouseEvent& event);
00197         void onChangePartColor ( wxCommandEvent& anEvent );
00198 
00199 
00204         void onEnableRange_Actual ( wxCommandEvent& anEvent );
00205 
00210         void onMovable_ActualWithBar ( wxCommandEvent& anEvent );
00211 
00212         /*
00213         * Gets the device value form the end of this panel to the end of the drawing area in the device in pixels
00214         * return deviceEndMargin The value asigned to the right margin
00215         */
00216         int     getDeviceEndX();
00217         
00218 
00219         /*
00220         * Sets the new device (deviceEndMargin) value form the end of this panel to the end of the drawing area in the device
00221         * param newDeviceEnd_pixels The new pixel value to asign to the right(horizontal view), underneath(vertical view) margin in pixels
00222         */
00223         void setDeviceEndMargin(int newDeviceEnd_pixels);
00224 
00225         /*
00226         * Gets the last clickedX pixel coord inside the bar with respect to the container panel.
00227         * return clickedX The x-coord pixel value
00228         */
00229         int getClickedX();
00230 
00231         /*
00232         * Sets the last clickedX pixel coord inside the bar with respect to the container panel.
00233         * param nwClickX The x-coord pixel value
00234         */
00235         void setClickedX(int nwClickX);
00236 
00237         /*
00238         * Gets the start porcentage with respect to the represented values of the bar
00239         * return The porcentage represented by the start  showing point
00240         */
00241         float getStartShowPorcentage();
00242 
00243         /*
00244         * Gets the end porcentage with respect to the represented values of the bar
00245         * return The porcentage represented by the end showing point
00246         */
00247         float getEndShowPorcentage();
00248 
00249         /*
00250         * Gets the actual porcentage with respect to the represented values of the bar
00251         * return The porcentage represented by the actual  showing point
00252         */
00253         float getActualShowPorcentage();
00254 
00255         /*
00256         * Gets the logic value of a pixel point that comes in the coords of the container panel.
00257     * param thePixel Is the pixel to convert
00258         * return Is the correspondig value to the given pixel-value in logic bar coords
00259         */
00260         int getLogicValueofPixel(int thePixel);
00261 
00262 
00263         /*
00264         * Sets the condition for knowing if the actual triangle is being drawed or not
00265         * param drawActual The condition to set for drawing or not the actual control (true for drawing)
00266         */
00267         void setIfWithActualDrawed(bool drawActual);
00268 
00269         /*
00270         * Gets the condition for knowing if the actual triangle is being drawed or not
00271         * return withActualDrawed The condition for drawing or not the actual control
00272         */
00273         bool getIfWithActualDrawed();
00274 
00275         /*
00276         * Method that creates and send the given id-event to the event handler
00277         * param theEventType Is the event id type identification for generating the event
00278         */
00279         void createAndSendEvent(WXTYPE theEventType);
00280 
00281         /*
00282         * Sets the background color od the bar
00283         * theColor The color to set to the backgroundColor
00284         */
00285         void setBackgroundColor(wxColour theColor);
00286 
00287         /*
00288         * Sets the guide line color
00289         * param theNwGuideLineColor The color to set to the guideLineColor
00290         */
00291         void setGuideLineColour(wxColour theNwGuideLineColor);
00292 
00293 
00294         /*
00295         * Gets the guide line color
00296         * return guideLineColor The color of the guideLine
00297         */
00298         wxColour getGuideLineColour();
00299 
00300         void onLeftClicDown(wxMouseEvent& event );
00301 
00302         void onLeftClickUp(wxMouseEvent& event );
00303 
00304 
00305 private:
00306         //Rectangle width
00307         int                        _w;
00308         //Rectangle Height
00309         int                        _h;
00310         //Actual value
00311         int                        _actual;
00312         //Start of the rectangule
00313         int                        _start;
00314         //End of the rectangule
00315         int                        _end;
00316         //Logical Max
00317         double                        _max;
00318         //Logical Min
00319         double                                             _min;
00320         //Initial point when moving the rectangule bar according to bar reference 
00321         int                                                _initialPoint;
00322         /*
00323         * Represents the id of the selected moving part of the bar where:
00324         * 1 is for Start triangle, 2 for end triangle, 3 for actual triangle and 4 for the bar
00325         */
00326         int                                                _selectionMoveId;
00327 
00328         //orientation of the rectangle is true when is horizontal and is the default value
00329         bool                                            _orientation;
00330 
00331         /*
00332         * The property for identifying if the actual triangle needs to be or not between the limit triangles
00333         */
00334         bool                                            _in_rangeProperty;
00335 
00336         /*
00337         * The property for setting the acutal triangle to move with the bar keeping proportions with the limits
00338         */
00339         bool                                            _moveActualWithBar;
00340 
00341         /*
00342         * The property for setting visible or not the bar labels information
00343         */
00344         bool                                       _visibleLables;
00345         /*
00346         * X-Coord for left-superior device visible drawing
00347         */
00348         wxCoord                                         deviceStart_x;  
00349 
00350         /*
00351         * Y-Coord for left-superior device visible drawing
00352         */
00353         wxCoord                                         deviceStart_y;
00354 
00355         /*
00356         * X-Coord for right device margin
00357         */
00358         wxCoord                                         deviceEndMargin;        
00359 
00360         /*
00361         * Represents the active state of the bar
00362         */
00363         bool activeState;
00364 
00365         /*
00366         * Represents the option of activating or not the drawing of the actual triangle, that in default value is true for drawing it
00367         * The dafault value is true (use the actual triangle)
00368         */
00369         bool withActualDrawed;
00370 
00371         /*
00372         * The colour of the start triangle
00373         */          
00374         wxColour start_Colour;
00375 
00376         /*
00377         * The colour of the actual triangle
00378         */          
00379         wxColour actual_Colour;
00380 
00381         /*
00382         * The colour of the end triangle
00383         */          
00384         wxColour end_Colour;
00385 
00386         /*
00387         * The colour of the bar
00388         */          
00389         wxColour bar_Colour;
00390         /*
00391         * Represents the real-x value to draw a vertical line
00392         */
00393         int                     realX_vertical_line;
00394 
00395         /*
00396         * Represents the last clickedX coord inside the bar.
00397         */
00398         int                     clickedX;
00399 
00400         /*
00401         * Represents the orientation for the numbers view label in the information bitmap.
00402         * Where  -4:left, -6:right, -8:up, -2: down respect to the bar
00403         */
00404         int                     numberOrientation;      
00405         /*
00406         * Represents the logic initial reference start point used for dragging
00407         */
00408         int                     logicInitial_start;
00409         /*
00410         * Represents the logic intial reference end point used for dragging
00411         */
00412         int                     logicInitial_end;
00413         /*
00414         * Represents the logic initial reference actual point used for dragging
00415         */
00416         int                     logicInitial_actual;
00417 
00418         /*
00419         * Represents the pixel value assigned to as half of the width of the triangles 
00420         */
00421         int                     trianglesHalfWidth;
00422 
00423         /*
00424         * Represents the background color of the panel (this) where the bar is. The default color is the imediately parent background color
00425         */
00426         wxColour        backgroundColor;
00427         /*
00428         * Represents the color of the dot-line use as guides. The default color is RED. 
00429         */
00430         wxColour        guideLineColor;
00431 
00432 
00433         bool acceptedClick;
00434         
00435 
00436         /*
00437         * The color bar pop menu
00438         */
00439         wxMenu b_popmenu; 
00440         //the bar bitmap device
00441         wxBitmap        *_bitmap_bar;
00442         //the info bitmap device 
00443         wxBitmap        *_bitmap_info;
00444         DECLARE_CLASS(BarRange)
00445         // any class wishing to process wxWindows events must use this macro
00446         DECLARE_EVENT_TABLE()
00447 };
00448 
00449 
00450 
00451 #endif
00452 
00453 
00454 

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1