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

This widget is a combo box which consists of a list box combined with a textbox. The list box should drop down when the user selects the drop-down arrow next to the control. More...

Inheritance diagram for nana::combox:
nana::widget_object< category::widget_tag, drawerbase::combox::trigger, drawerbase::combox::combox_events,::nana::widgets::skeletons::text_editor_scheme > nana::concepts::any_objective< std::size_t, 1 > nana::detail::widget_base nana::widget

Public Types

typedef
float_listbox::item_renderer 
item_renderer
 
typedef
drawerbase::combox::item_proxy 
item_proxy
 
- Public Types inherited from nana::widget_object< category::widget_tag, drawerbase::combox::trigger, drawerbase::combox::combox_events,::nana::widgets::skeletons::text_editor_scheme >
using scheme_type = ::nana::widgets::skeletons::text_editor_scheme
 
using event_type = drawerbase::combox::combox_events
 
- Public Types inherited from nana::widget
using native_string_type = detail::native_string_type
 

Public Member Functions

 combox ()
 
 combox (window, bool visible)
 
 combox (window,::std::string, bool visible=true)
 
 combox (window, const char *, bool visible=true)
 
 combox (window, const rectangle &r=rectangle(), bool visible=true)
 
void clear ()
 
void editable (bool)
 
bool editable () const
 
void set_accept (std::function< bool(wchar_t)>)
 
comboxpush_back (std::string)
 
std::size_t the_number_of_options () const
 
std::size_t option () const
 Index of the last selected, from drop-down list, item. More...
 
void option (std::size_t)
 Select the text specified by index. More...
 
::std::string text (std::size_t) const
 
void erase (std::size_t pos)
 
template<typename Key >
item_proxy operator[] (const Key &kv)
 
template<typename Key >
void erase_key (Key &&kv)
 
void renderer (item_renderer *)
 Set user-defined item renderer object. It is an address therefore the user should not destroy the renderer object after it is set to the combox. Passing null_ptr cancels the user-defined renderer object. More...
 
void image (std::size_t, const nana::paint::image &)
 
nana::paint::image image (std::size_t) const
 
void image_pixels (unsigned)
 Sets the width of image area. Default is 16 pixels. More...
 
- Public Member Functions inherited from nana::widget_object< category::widget_tag, drawerbase::combox::trigger, drawerbase::combox::combox_events,::nana::widgets::skeletons::text_editor_scheme >
 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
 
- Public Member Functions inherited from nana::concepts::any_objective< std::size_t, 1 >
virtual ~any_objective ()=default
 
void anyobj (const Target &t)
 
void anyobj (Target &&t)
 
Target * anyobj () const
 < Retrieves the attached object. Returns a nullptr if empty or if the type not match. More...
 

Additional Inherited Members

- Protected Types inherited from nana::widget_object< category::widget_tag, drawerbase::combox::trigger, drawerbase::combox::combox_events,::nana::widgets::skeletons::text_editor_scheme >
typedef drawerbase::combox::trigger drawer_trigger_t
 
- Protected Member Functions inherited from nana::widget_object< category::widget_tag, drawerbase::combox::trigger, drawerbase::combox::combox_events,::nana::widgets::skeletons::text_editor_scheme >
drawerbase::combox::triggerget_drawer_trigger ()
 
const drawerbase::combox::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 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

This widget is a combo box which consists of a list box combined with a textbox. The list box should drop down when the user selects the drop-down arrow next to the control.

combox.png

Notes

  1. The class ext_event coming with the combox, is:
             struct ext_event_type
             {
               nana::functor_group<void(nana::combox&)> selected; //Selects a new item.
             };
    
     This class provides a method to implement that a program may respond to the combox 
     special event or state. It seems like the events registered by make_event member function.
     But the answer registered by make_event is used for general-purpose, such as mouse_down, 
     mouse_move, click and so on, while the combox´ ext_event_type is used for the own 
     providing event.
    
  2. Refer to nana::listbox for details of item_renderer.
Examples:
example_combox.cpp, and widget_show2.cpp.

Member Typedef Documentation

Constructor & Destructor Documentation

nana::combox::combox ( )
nana::combox::combox ( window  wd,
bool  visible 
)
nana::combox::combox ( window  ,
::std::string  ,
bool  visible = true 
)
nana::combox::combox ( window  wd,
const char *  text,
bool  visible = true 
)
nana::combox::combox ( window  wd,
const rectangle r = rectangle(),
bool  visible = true 
)

Member Function Documentation

void nana::combox::clear ( )
void nana::combox::editable ( bool  eb)
bool nana::combox::editable ( ) const
void nana::combox::erase ( std::size_t  pos)
template<typename Key >
void nana::combox::erase_key ( Key &&  kv)
inline
void nana::combox::image ( std::size_t  i,
const nana::paint::image img 
)
nana::paint::image nana::combox::image ( std::size_t  pos) const
void nana::combox::image_pixels ( unsigned  px)

Sets the width of image area. Default is 16 pixels.

template<typename Key >
item_proxy nana::combox::operator[] ( const Key &  kv)
inline
std::size_t nana::combox::option ( ) const

Index of the last selected, from drop-down list, item.

Examples:
example_combox.cpp, widget_show.cpp, and widget_show2.cpp.
void nana::combox::option ( std::size_t  pos)

Select the text specified by index.

combox & nana::combox::push_back ( std::string  text)
Examples:
example_combox.cpp.
void nana::combox::renderer ( item_renderer ir)

Set user-defined item renderer object. It is an address therefore the user should not destroy the renderer object after it is set to the combox. Passing null_ptr cancels the user-defined renderer object.

void nana::combox::set_accept ( std::function< bool(wchar_t)>  pred)
std::string nana::combox::text ( std::size_t  pos) const
std::size_t nana::combox::the_number_of_options ( ) const