slidercombo.h

Go to the documentation of this file.
00001 
00002 // Name:        slidercombo.h
00003 // Purpose:     A pop-up slider combo control
00004 // Author:      Mart Raudsepp
00005 // Modified by:
00006 // Created:     2006-07-05
00007 // RCS-ID:      $Id: $
00008 // Copyright:   (c) 2006 Mart Raudsepp
00009 // Licence:     wxWindows licence
00011 
00012 #ifndef _WXXTRA_SLIDERCOMBO_H_
00013 #define _WXXTRA_SLIDERCOMBO_H_
00014 
00015 #include <wx/defs.h>
00016 
00017 #if wxUSE_COMBOCTRL
00018 #include <wx/combo.h>
00019 #else
00020 #include "combo.h"
00021 #endif
00022 
00023 #include <wx/string.h>
00024 
00025 class wxSlider;
00026 
00027 class WXDLLIMPEXP_ADV wxSliderCombo : public wxComboCtrl
00028 {
00029 public:
00030 
00031     wxSliderCombo() { Init(); }
00032 
00033     wxSliderCombo(wxWindow *parent,
00034                   wxWindowID id = wxID_ANY,
00035                   int value = 0,
00036                   const wxPoint& pos = wxDefaultPosition,
00037                   const wxSize& size = wxDefaultSize,
00038                   long style = 0,
00039                   const wxString& name = wxT("wxSliderComboBox"));
00040 
00041     bool Create(wxWindow *parent,
00042                 wxWindowID id = wxID_ANY,
00043                 int value = 0,
00044                 const wxPoint& pos = wxDefaultPosition,
00045                 const wxSize& size = wxDefaultSize,
00046                 long style = 0,
00047                 const wxString& name = wxT("wxSliderComboBox"));
00048 
00049     virtual ~wxSliderCombo();
00050 
00051     // Suffix to automatically use after the integer value, e.g _("pix")
00052     // Used if SetAutomaticUpdates(false) hasn't been called.
00053     wxString GetValueSuffix() const;
00054     void SetValueSuffix(wxString& suffix);
00055 
00056     // Changes if the updates are done automatically (based on value and the
00057     // given prefix) or left for the user to do on EVT_SCROLL. Default is TRUE.
00058     bool GetAutomaticUpdates() const;
00059     void SetAutomaticUpdates(bool);
00060 
00061     // Duplicate the wxSlider API
00062 
00063     // From wxSlider whatever is necessary... Events are the most important here
00064     int GetSliderValue() const;
00065     void SetSliderValue(int value);
00066 
00067     // Default without having called this is 0..100
00068     void SetRange(int minValue, int maxValue);
00069 
00070     int GetSliderMin() const;
00071     int GetSliderMax() const;
00072     void SetSliderMin( int minValue );
00073     void SetSliderMax( int maxValue );
00074 
00075     // the line/page size is the increment by which the slider moves when
00076     // cursor arrow key/page up or down are pressed (clicking the mouse is like
00077     // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
00078     void SetLineSize(int lineSize);
00079     void SetPageSize(int pageSize);
00080     int GetLineSize() const;
00081     int GetPageSize() const;
00082 
00083     // these methods get/set the length of the slider pointer in pixels
00084     void SetThumbLength(int lenPixels);
00085     int GetThumbLength() const;
00086 
00087     // warning: most of subsequent methods are currently only implemented in
00088     //          wxMSW under Win95 and are silently ignored on other platforms
00089 
00090     void SetTickFreq(int n, int pos);
00091     int GetTickFreq() const;
00092     void ClearTicks();
00093     void SetTick(int tickPos);
00094 
00095     void ClearSel();
00096     int GetSelEnd() const;
00097     int GetSelStart() const;
00098     void SetSelection(int min, int max);
00099 
00100     // Do we need floating point support? In this case this could be used to
00101     // select it (and add some other floating point methods)
00102     /* void SetRange(double minValue, double maxValue); */
00103     // or the alternative (discussed in the end) with a better name:
00104     /* void SetMappingConstant(double display_map_value); */
00105 
00106 protected:
00107     wxSlider* m_slider;
00108     wxString m_suffix;
00109     bool m_automatic_updates;
00110 
00111 private:
00112     void Init();
00113 
00114     DECLARE_DYNAMIC_CLASS(wxSliderCombo)
00115 };
00116 
00117 #endif //_WX_SLIDERCOMBO_H_

Generated on Sat Nov 10 03:49:02 2007 for Camelot by  doxygen 1.4.4