home *** CD-ROM | disk | FTP | other *** search
- #ifndef _WGAUGE_HPP_INCLUDED
- #define _WGAUGE_HPP_INCLUDED
-
- #ifndef _WCONTROL_HPP_INCLUDED
- # include "wcontrol.hpp"
- #endif
-
- /*************************************************************************
- *
- * WGauge -- Wrapper for the Gauge control.
- *
- * Events:
- *
- * Change --
- *
- ************************************************************************/
-
- #include <math.h>
-
- #define X_OFFSET_DEFAULT 5
- #define Y_OFFSET_DEFAULT 5
- #define PI 3.141592653589793
-
- enum WGaugeType {
- WGT_HorizontalBar,
- WGT_VerticalBar,
- WGT_SemiCircle,
- WGT_SemiPie,
- WGT_Pie,
- WGT_Text
- };
-
- enum WGBorderType {
- WGBT_None,
- WGBT_Single
- };
-
- struct WGaugeChangeEventData : public WEventData {
- WUShort oldPosition;
- WUShort newPosition;
- };
-
- class WCMCLASS WGauge :public WControl
- {
- /**************************************************************
- * Constructors and destructors
- **************************************************************/
- public:
- WGauge();
- ~WGauge();
-
- /**************************************************************
- * Properties
- **************************************************************/
-
- // BorderType
-
- WGBorderType GetBorderType() const;
- WBool SetBorderType( WGBorderType borderType, WBool repaint=TRUE );
-
- // FillColor
-
- WColor GetFillColor() const;
- WBool SetFillColor( const WColor & fillColor, WBool repaint=TRUE );
-
- // HorizontalMargin
-
- WUShort GetHorizontalMargin() const;
- WBool SetHorizontalMargin( WUShort val );
-
- // Maximum
-
- WUShort GetMaximum() const;
- WBool SetMaximum( WUShort max );
-
- // Minimum
-
- WUShort GetMinimum() const;
- WBool SetMinimum( WUShort min );
-
- // Position
-
- WUShort GetPosition() const;
- WBool SetPosition( WUShort position );
-
- // ShowPercent
-
- WBool GetShowPercent() const;
- WBool SetShowPercent( WBool showPercent, WBool repaint=TRUE );
-
- // Type
-
- WGaugeType GetType() const;
- WBool SetType( WGaugeType type );
-
- // VerticalMargin
-
- WUShort GetVerticalMargin() const;
- WBool SetVerticalMargin( WUShort val );
-
- /**************************************************************
- * Methods
- **************************************************************/
-
- /**************************************************************
- * Overrides
- **************************************************************/
-
- virtual WStyle GetDefaultStyle() const;
-
- /**************************************************************
- * Event Handlers
- **************************************************************/
-
- WBool ResizeEventHandler( WWindow *window, WResizeEventData *event );
-
- protected:
- WBool PaintEventHandler( WWindow *window, WPaintEventData *event );
-
- /**************************************************************
- * Others
- **************************************************************/
-
- private:
- void DrawSemiCircle( WDouble pct, WCanvas *canvas, WRect rect,
- WFont font );
-
- void DrawFullCircle( WDouble pct, WCanvas *canvas, WRect rect,
- WFont font );
-
- /**************************************************************
- * Data Members
- **************************************************************/
-
- private:
- WUShort _min;
- WUShort _max;
- WUShort _pos;
- WUShort _horizMargin;
- WUShort _vertMargin;
- WGaugeType _type;
- WGBorderType _border;
- WBool _showText;
- WColor _fillColor;
- };
-
- #endif
-