Nana C++ Library. Reference for users.
What we need to use nana
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
nana::slider Class Reference

A slider widget which the user can drag for tracking. More...

Inheritance diagram for nana::slider:
nana::widget_object< category::widget_tag, drawerbase::slider::trigger, drawerbase::slider::slider_events, drawerbase::slider::scheme_impl > nana::detail::widget_base nana::widget

Public Types

using renderer_interface = drawerbase::slider::renderer_interface
 The interface for customized renderer. More...
 
using seekdir = drawerbase::slider::seekdir
 Defines the slider seek direction. More...
 
- Public Types inherited from nana::widget_object< category::widget_tag, drawerbase::slider::trigger, drawerbase::slider::slider_events, drawerbase::slider::scheme_impl >
using scheme_type = drawerbase::slider::scheme_impl
 
using event_type = drawerbase::slider::slider_events
 
- Public Types inherited from nana::widget
using native_string_type = detail::native_string_type
 

Public Member Functions

 slider ()
 
 slider (window, bool visible)
 
 slider (window, const rectangle &=rectangle(), bool visible=true)
 
void seek (seekdir)
 Define the direction that user can seek by using mouse. More...
 
void vertical (bool)
 
bool vertical () const
 
void maximum (unsigned)
 
unsigned maximum () const
 
void value (int)
 
unsigned value () const
 
unsigned move_step (bool forward)
 Increase or decrease the value of slider. More...
 
unsigned adorn () const
 
const pat::cloneable
< renderer_interface > & 
renderer ()
 Refers to the current renderer that slider is using. More...
 
void renderer (const pat::cloneable< renderer_interface > &)
 Set the current renderer. More...
 
void vernier (std::function< std::string(unsigned maximum, unsigned cursor_value)> provider)
 
void transparent (bool)
 
bool transparent () const
 
- Public Member Functions inherited from nana::widget_object< category::widget_tag, drawerbase::slider::trigger, drawerbase::slider::slider_events, drawerbase::slider::scheme_impl >
 widget_object ()
 
 ~widget_object ()
 
event_typeevents () const
 
bool create (window parent_wd, bool visible)
 
bool create (window parent_wd, const rectangle &r={}, bool visible=true)
 
widget_objectborderless (bool enable)
 
bool borderless () const
 
scheme_typescheme () const
 
void filter_event (const event_code evt_code, const bool bDisabled)
 
void filter_event (const std::vector< event_code > evt_codes, const bool bDisabled)
 
void filter_event (const event_filter_status &evt_all_states)
 
bool filter_event (const event_code evt_code)
 
event_filter_status filter_event ()
 
void clear_filter ()
 
- Public Member Functions inherited from nana::detail::widget_base
window handle () const override
 Returns the handle of window, returns 0 if window is not created. More...
 
- Public Member Functions inherited from nana::widget
 widget ()=default
 
virtual ~widget ()=default
 
bool empty () const
 Determines whether the manipulator is handling a window. More...
 
void close ()
 
window parent () const
 
::std::string caption () const noexcept
 
::std::wstring caption_wstring () const noexcept
 
native_string_type caption_native () const noexcept
 
widgetcaption (std::string utf8)
 
widgetcaption (std::wstring)
 
template<typename... Args>
void i18n (std::string msgid, Args &&...args)
 
void i18n (i18n_eval)
 
void cursor (nana::cursor)
 
nana::cursor cursor () const
 Retrieves the shape of cursor. More...
 
void typeface (const paint::font &font)
 
paint::font typeface () const
 
bool enabled () const
 Determines whether the window is enabled for mouse and keyboard input. More...
 
void enabled (bool)
 
void enable_dropfiles (bool)
 Enables/Disables a window to accept dropped files. More...
 
void focus ()
 
bool focused () const
 
std::shared_ptr
< scroll_operation_interface
scroll_operation ()
 
void show ()
 Sets the window visible. More...
 
void hide ()
 Sets the window invisible. More...
 
bool visible () const
 
nana::size size () const
 
void size (const nana::size &)
 
void set_capture (bool ignore_children)
 Enables the widget to grab the mouse input. More...
 
void release_capture ()
 Disables the widget to grab the mouse input. More...
 
point pos () const
 
void move (int x, int y)
 
void move (const point &)
 
void move (const rectangle &)
 
void fgcolor (const nana::color &)
 
nana::color fgcolor () const
 
void bgcolor (const nana::color &)
 
nana::color bgcolor () const
 
general_eventsevents () const
 
void umake_event (event_handle eh) const
 Deletes an event callback by a handle. More...
 
widgetregister_shortkey (wchar_t)
 Registers a shortkey. To remove a registered key, pass 0. More...
 
widgettake_active (bool activated, window take_if_not_activated)
 
widgettooltip (const ::std::string &)
 
 operator dummy_bool_type () const
 
 operator window () const
 

Additional Inherited Members

- Protected Types inherited from nana::widget_object< category::widget_tag, drawerbase::slider::trigger, drawerbase::slider::slider_events, drawerbase::slider::scheme_impl >
typedef drawerbase::slider::trigger drawer_trigger_t
 
- Protected Member Functions inherited from nana::widget_object< category::widget_tag, drawerbase::slider::trigger, drawerbase::slider::slider_events, drawerbase::slider::scheme_impl >
drawerbase::slider::triggerget_drawer_trigger ()
 
const drawerbase::slider::triggerget_drawer_trigger () const
 
- Protected Member Functions inherited from nana::widget
std::unique_ptr
<::nana::detail::widget_notifier_interface
_m_wdg_notifier ()
 
virtual void _m_complete_creation ()
 
virtual native_string_type _m_caption () const noexcept
 
virtual void _m_caption (native_string_type &&)
 
virtual nana::cursor _m_cursor () const
 
virtual void _m_cursor (nana::cursor)
 
virtual void _m_close ()
 
virtual bool _m_enabled () const
 
virtual void _m_enabled (bool)
 
virtual std::shared_ptr
< scroll_operation_interface
_m_scroll_operation ()
 
virtual bool _m_show (bool)
 
virtual bool _m_visible () const
 
virtual void _m_size (const nana::size &)
 
virtual void _m_move (int x, int y)
 
virtual void _m_move (const rectangle &)
 
virtual void _m_typeface (const nana::paint::font &font)
 
virtual nana::paint::font _m_typeface () const
 
virtual void _m_fgcolor (const nana::color &)
 
virtual nana::color _m_fgcolor () const
 
virtual void _m_bgcolor (const nana::color &)
 
virtual nana::color _m_bgcolor () const
 
- Protected Attributes inherited from nana::detail::widget_base
window handle_ { nullptr }
 

Detailed Description

A slider widget which the user can drag for tracking.

  1. Definition of renderer.
     class renderer
     {
      public:
         typedef nana::paint::graphics & graph_reference;
         struct bar_t
         {
             bool horizontal;
             nana::rectangle r;    //the rectangle of bar
             unsigned border_size; //border size of bar
         };
         struct slider_t
         {
             bool horizontal;
             int pos;
             unsigned border;
             unsigned scale;
         };
         struct adorn_t
         {
             bool horizontal;
             nana::point bound;
             int fixedpos;
             unsigned block;
             unsigned vcur_scale; //pixels of vcur scale.
         };
         virtual ~renderer() = 0;
         virtual void background(nana::window, graph_reference, bool isglass) = 0;
         virtual void adorn(nana::window, graph_reference, const adorn_t&) = 0;
         virtual void adorn_textbox(nana::window, graph_reference, 
                                    const nana::string&, const nana::rectangle&) = 0;
         virtual void bar(nana::window, graph_reference, const bar_t&) = 0;
         virtual void slider(nana::window, graph_reference, const slider_t&) = 0;
     };
    
  2. Definition of provider, it provides a string that used to display a tip label when user move the mouse in a slider.
     class provider
     {
         public:
         virtual ~provider() = 0;
         virtual nana::string adorn_trace(unsigned vmax, unsigned vadorn) const = 0;
     };
    
  3. Refer to this article for understanding how to write a user-defined renderer.

Member Typedef Documentation

The interface for customized renderer.

Defines the slider seek direction.

Constructor & Destructor Documentation

nana::slider::slider ( )
nana::slider::slider ( window  wd,
bool  visible 
)
nana::slider::slider ( window  wd,
const rectangle r = rectangle(),
bool  visible = true 
)

Member Function Documentation

unsigned nana::slider::adorn ( ) const
void nana::slider::maximum ( unsigned  m)
unsigned nana::slider::maximum ( ) const
unsigned nana::slider::move_step ( bool  forward)

Increase or decrease the value of slider.

const pat::cloneable< slider::renderer_interface > & nana::slider::renderer ( )

Refers to the current renderer that slider is using.

void nana::slider::renderer ( const pat::cloneable< renderer_interface > &  rd)

Set the current renderer.

void nana::slider::seek ( seekdir  sd)

Define the direction that user can seek by using mouse.

void nana::slider::transparent ( bool  enabled)
bool nana::slider::transparent ( ) const
void nana::slider::value ( int  v)
    Set slider value
Parameters
[in]vnew value for slider. v will be clipped to the range 0 to maximum
unsigned nana::slider::value ( ) const
void nana::slider::vernier ( std::function< std::string(unsigned maximum, unsigned cursor_value)>  provider)
void nana::slider::vertical ( bool  v)
bool nana::slider::vertical ( ) const