]>
git.saurik.com Git - wxWidgets.git/blob - src/common/gaugecmn.cpp
   1 /////////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/common/gaugecmn.cpp 
   3 // Purpose:     wxGaugeBase: common to all ports methods of wxGauge 
   4 // Author:      Vadim Zeitlin 
   8 // Copyright:   (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> 
   9 // Licence:     wxWindows licence 
  10 /////////////////////////////////////////////////////////////////////////////// 
  12 // ============================================================================ 
  14 // ============================================================================ 
  16 // ---------------------------------------------------------------------------- 
  18 // ---------------------------------------------------------------------------- 
  20 // For compilers that support precompilation, includes "wx.h". 
  21 #include "wx/wxprec.h" 
  34 const char wxGaugeNameStr
[] = "gauge"; 
  36 // ============================================================================ 
  38 // ============================================================================ 
  40 wxGaugeBase::~wxGaugeBase() 
  42     // this destructor is required for Darwin 
  45 // ---------------------------------------------------------------------------- 
  47 // ---------------------------------------------------------------------------- 
  49 wxDEFINE_FLAGS( wxGaugeStyle 
) 
  50 wxBEGIN_FLAGS( wxGaugeStyle 
) 
  51 // new style border flags, we put them first to 
  52 // use them for streaming out 
  53 wxFLAGS_MEMBER(wxBORDER_SIMPLE
) 
  54 wxFLAGS_MEMBER(wxBORDER_SUNKEN
) 
  55 wxFLAGS_MEMBER(wxBORDER_DOUBLE
) 
  56 wxFLAGS_MEMBER(wxBORDER_RAISED
) 
  57 wxFLAGS_MEMBER(wxBORDER_STATIC
) 
  58 wxFLAGS_MEMBER(wxBORDER_NONE
) 
  60 // old style border flags 
  61 wxFLAGS_MEMBER(wxSIMPLE_BORDER
) 
  62 wxFLAGS_MEMBER(wxSUNKEN_BORDER
) 
  63 wxFLAGS_MEMBER(wxDOUBLE_BORDER
) 
  64 wxFLAGS_MEMBER(wxRAISED_BORDER
) 
  65 wxFLAGS_MEMBER(wxSTATIC_BORDER
) 
  66 wxFLAGS_MEMBER(wxBORDER
) 
  68 // standard window styles 
  69 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
) 
  70 wxFLAGS_MEMBER(wxCLIP_CHILDREN
) 
  71 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
) 
  72 wxFLAGS_MEMBER(wxWANTS_CHARS
) 
  73 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
) 
  74 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB 
) 
  75 wxFLAGS_MEMBER(wxVSCROLL
) 
  76 wxFLAGS_MEMBER(wxHSCROLL
) 
  78 wxFLAGS_MEMBER(wxGA_HORIZONTAL
) 
  79 wxFLAGS_MEMBER(wxGA_VERTICAL
) 
  80 #if WXWIN_COMPATIBILITY_2_6 
  81 wxFLAGS_MEMBER(wxGA_PROGRESSBAR
) 
  82 #endif // WXWIN_COMPATIBILITY_2_6 
  83 wxFLAGS_MEMBER(wxGA_SMOOTH
) 
  84 wxEND_FLAGS( wxGaugeStyle 
) 
  86 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGauge
, wxControl
, "wx/gauge.h") 
  88 wxBEGIN_PROPERTIES_TABLE(wxGauge
) 
  89 wxPROPERTY( Value
, int, SetValue
, GetValue
, 0, 0 /*flags*/, \
 
  90            wxT("Helpstring"), wxT("group")) 
  91 wxPROPERTY( Range
, int, SetRange
, GetRange
, 0, 0 /*flags*/, \
 
  92            wxT("Helpstring"), wxT("group")) 
  93 wxPROPERTY( ShadowWidth
, int, SetShadowWidth
, GetShadowWidth
, \
 
  94            0, 0 /*flags*/, wxT("Helpstring"), wxT("group")) 
  95 wxPROPERTY( BezelFace
, int, SetBezelFace
, GetBezelFace
, \
 
  96            0, 0 /*flags*/, wxT("Helpstring"), wxT("group")) 
  98 wxPROPERTY_FLAGS( WindowStyle
, wxGaugeStyle
, long, SetWindowStyleFlag
, \
 
  99                  GetWindowStyleFlag
, wxEMPTY_PARAMETER_VALUE
, 0 /*flags*/, \
 
 100                  wxT("Helpstring"), wxT("group")) // style 
 101 wxEND_PROPERTIES_TABLE() 
 103 wxEMPTY_HANDLERS_TABLE(wxGauge
) 
 105 wxCONSTRUCTOR_6( wxGauge
, wxWindow
*, Parent
, wxWindowID
, Id
, int, Range
, \
 
 106                 wxPoint
, Position
, wxSize
, Size
, long, WindowStyle 
) 
 108 // ---------------------------------------------------------------------------- 
 110 // ---------------------------------------------------------------------------- 
 112 bool wxGaugeBase::Create(wxWindow 
*parent
, 
 118                          const wxValidator
& validator
, 
 119                          const wxString
& name
) 
 121     if ( !wxControl::Create(parent
, id
, pos
, size
, style
, validator
, name
) ) 
 127     SetValidator(validator
); 
 128 #endif // wxUSE_VALIDATORS 
 132 #if wxGAUGE_EMULATE_INDETERMINATE_MODE 
 133     m_nDirection 
= wxRIGHT
; 
 139 // ---------------------------------------------------------------------------- 
 140 // wxGauge determinate mode range/position 
 141 // ---------------------------------------------------------------------------- 
 143 void wxGaugeBase::SetRange(int range
) 
 148 int wxGaugeBase::GetRange() const 
 153 void wxGaugeBase::SetValue(int pos
) 
 158 int wxGaugeBase::GetValue() const 
 163 // ---------------------------------------------------------------------------- 
 164 // wxGauge indeterminate mode 
 165 // ---------------------------------------------------------------------------- 
 167 void wxGaugeBase::Pulse() 
 169 #if wxGAUGE_EMULATE_INDETERMINATE_MODE 
 170     // simulate indeterminate mode 
 171     int curr 
= GetValue(), max 
= GetRange(); 
 173     if (m_nDirection 
== wxRIGHT
) 
 180             m_nDirection 
= wxLEFT
; 
 190             m_nDirection 
= wxRIGHT
; 
 196 // ---------------------------------------------------------------------------- 
 197 // wxGauge appearance params 
 198 // ---------------------------------------------------------------------------- 
 200 void wxGaugeBase::SetShadowWidth(int WXUNUSED(w
)) 
 204 int wxGaugeBase::GetShadowWidth() const 
 210 void wxGaugeBase::SetBezelFace(int WXUNUSED(w
)) 
 214 int wxGaugeBase::GetBezelFace() const 
 219 #endif // wxUSE_GAUGE