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

Namespaces

 detail
 
 dev
 

Classes

class  caret_proxy
 

Typedefs

using basic_window = ::nana::detail::basic_window
 
using interface_type = ::nana::detail::native_interface
 

Functions

bool is_window (window)
 Determines whether a window is existing, equal to !empty_window. More...
 
void effects_edge_nimbus (window, effects::edge_nimbus)
 
effects::edge_nimbus effects_edge_nimbus (window)
 
void effects_bground (window, const effects::bground_factory_interface &, double fade_rate)
 
void effects_bground (std::initializer_list< window > wdgs, const effects::bground_factory_interface &, double fade_rate)
 
bground_mode effects_bground_mode (window)
 
void effects_bground_remove (window)
 
widgetget_widget (window window_handle)
 Returns the widget pointer of the specified window. More...
 
void font_languages (const std::string &langs)
 Sets languages. More...
 
void exit ()
 close all windows in current thread More...
 
void exit_all ()
 close all windows More...
 
std::string transform_shortkey_text (std::string text, wchar_t &shortkey, std::string::size_type *skpos)
 Searches whether the text contains a '&' and removes the character for transforming. If the text contains more than one '&' characters, the others are ignored. e.g text = "&&a&bcd&ef", the result should be "&abcdef", shortkey = 'b', and pos = 2. More...
 
bool register_shortkey (window, unsigned long)
 
void unregister_shortkey (window)
 
nana::point cursor_position ()
 
rectangle make_center (unsigned width, unsigned height)
 Retrieves a rectangle which is in the center of the screen. More...
 
rectangle make_center (window, unsigned width, unsigned height)
 Retrieves a rectangle which is in the center of the window. More...
 
template<typename Widget = ::nana::widget, typename EnumFunction >
void enum_widgets (window wd, bool recursive, EnumFunction &&fn)
 
void window_icon_default (const paint::image &small_icon, const paint::image &big_icon={})
 
void window_icon (window, const paint::image &small_icon, const paint::image &big_icon={})
 
bool empty_window (window)
 Determines whether a window is existing. More...
 
bool is_destroying (window)
 Determines whether a window is destroying. More...
 
void enable_dropfiles (window, bool)
 
bool is_transparent_background (window)
 
native_window_type root (window)
 Retrieves the native window of a Nana.GUI window. More...
 
window root (native_window_type)
 Retrieves the native window of a Nana.GUI window. More...
 
void fullscreen (window, bool)
 
void close_window (window)
 
void show_window (window, bool show)
 Sets a window visible state. More...
 
void restore_window (window)
 
void zoom_window (window, bool ask_for_max)
 
bool visible (window)
 
window get_parent_window (window)
 
window get_owner_window (window)
 
bool set_parent_window (window, window new_parent)
 
template<typename Widget = ::nana::widget>
typename::nana::dev::widget_traits
< Widget >::event_type & 
events (window wd)
 
template<typename EventArg , typename std::enable_if< std::is_base_of< ::nana::event_arg, EventArg >::value >::type * = nullptr>
bool emit_event (event_code evt_code, window wd, const EventArg &arg)
 
template<typename EventArg , typename std::enable_if< std::is_base_of< ::nana::event_arg, EventArg >::value >::type * = nullptr>
bool emit_internal_event (event_code evt_code, window wd, const EventArg &arg)
 
void umake_event (event_handle)
 
template<typename Widget = ::nana::widget>
typename::nana::dev::widget_traits
< Widget >::scheme_type & 
scheme (window wd)
 
point window_position (window)
 
void move_window (window, const point &)
 
void move_window (window wd, const rectangle &)
 
void bring_top (window, bool activated)
 
bool set_window_z_order (window wd, window wd_after, z_order_action action_if_no_wd_after)
 
void draw_through (window, std::function< void()>)
 
void map_through_widgets (window, native_drawable_type)
 
size window_size (window)
 
void window_size (window, const size &)
 
size window_outline_size (window)
 
void window_outline_size (window, const size &)
 
::std::optional< rectanglewindow_rectangle (window)
 
bool get_window_rectangle (window, rectangle &)
 
bool track_window_size (window, const size &, bool true_for_max)
 Sets the minimum or maximum tracking size of a window. More...
 
void window_enabled (window, bool)
 
bool window_enabled (window)
 
void refresh_window (window window_handle)
 Refresh the window and display it immediately calling the refresh function of its drawer_trigger. More...
 
void refresh_window_tree (window)
 Refreshes the specified window and all its children windows, then displays it immediately. More...
 
void update_window (window)
 Copies the off-screen buffer to the screen for immediate display. More...
 
void window_caption (window, const std::string &title_utf8)
 
void window_caption (window, const std::wstring &title)
 
::std::string window_caption (window)
 
void window_cursor (window, cursor)
 
cursor window_cursor (window)
 
void activate_window (window)
 
bool is_focus_ready (window)
 Determines whether the specified window will get the keyboard focus when its root window gets native system focus. More...
 
window focus_window ()
 Returns the current keyboard focus window. More...
 
void focus_window (window)
 Sets the keyboard focus for a specified window. More...
 
window capture_window ()
 Returns a window which has grabbed the mouse input. More...
 
void set_capture (window window_handle, bool ignore_children)
 Enables a window to grab the mouse input. More...
 
void release_capture (window window_handle)
 Disable a window to grab the mouse input. More...
 
void modal_window (window)
 Blocks the execution and other windows' messages until the specified window is closed. More...
 
void wait_for (window)
 Blocks the execution until the specified window is closed. More...
 
color fgcolor (window)
 
color fgcolor (window, const color &)
 
color bgcolor (window)
 
color bgcolor (window, const color &)
 
color activated_color (window)
 
color activated_color (window, const color &)
 
void create_caret (window, const size &)
 
void destroy_caret (window)
 
::std::unique_ptr
< caret_interface
open_caret (window window_handle, bool disable_throw=false)
 Opens an existing caret of a window. More...
 
void tabstop (window)
 Enables that the user can give input focus to the specified window using TAB key. More...
 
void eat_tabstop (window window_handle, bool enable)
 Enables or disables a window to receive a key_char event for pressing TAB key. More...
 
window move_tabstop (window window_handle, bool forward)
 Sets the input focus to the window which the tabstop is near to the specified window. More...
 
void take_active (window, bool has_active, window take_if_has_active_false)
 Sets the window active state. If a window active state is false, the window will not obtain the focus when a mouse clicks on it which will be obtained by take_if_has_active_false. More...
 
bool window_graphics (window, nana::paint::graphics &)
 Copies the graphics of a specified to a new graphics object. More...
 
bool root_graphics (window, nana::paint::graphics &)
 
bool get_visual_rectangle (window, nana::rectangle &)
 
void typeface (window, const nana::paint::font &)
 
paint::font typeface (window)
 
bool calc_screen_point (window, point &)
 Converts window coordinates to screen coordinates. More...
 
bool calc_window_point (window, point &)
 Converts screen coordinates to window coordinates. More...
 
window find_window (const nana::point &mspos)
 
bool is_window_zoomed (window, bool ask_for_max)
 Tests a window whether it is maximized or minimized. More...
 
void widget_borderless (window, bool)
 Enables or disables a borderless widget. More...
 
bool widget_borderless (window)
 Tests a widget whether it is borderless. More...
 
nana::mouse_action mouse_action (window)
 
nana::element_state element_state (window)
 
bool ignore_mouse_focus (window, bool ignore)
 Enables/disables the mouse focus, it returns the previous state. More...
 
bool ignore_mouse_focus (window)
 Determines whether the mouse focus is enabled. More...
 
void at_safe_place (window,::std::function< void()>)
 
::std::optional< std::pair
<::nana::size,::nana::size > > 
content_extent (window wd, unsigned limited_px, bool limit_width)
 Returns a widget content extent size. More...
 
unsigned screen_dpi (bool x_requested)
 
dragdrop_status window_dragdrop_status (::nana::window)
 
void enable_double_click (window wd, bool dbl)
 
void at_safe_place (window wd, std::function< void()> fn)
 

Typedef Documentation

Function Documentation

void nana::API::activate_window ( window  wd)
color nana::API::activated_color ( window  wd)
color nana::API::activated_color ( window  wd,
const color &  clr 
)
void nana::API::at_safe_place ( window  ,
::std::function< void()>   
)
void nana::API::at_safe_place ( window  wd,
std::function< void()>  fn 
)
color nana::API::bgcolor ( window  wd)
color nana::API::bgcolor ( window  wd,
const color &  clr 
)
void nana::API::bring_top ( window  wd,
bool  activated 
)
bool nana::API::calc_screen_point ( window  wd,
nana::point pos 
)

Converts window coordinates to screen coordinates.

bool nana::API::calc_window_point ( window  wd,
nana::point pos 
)

Converts screen coordinates to window coordinates.

window nana::API::capture_window ( )

Returns a window which has grabbed the mouse input.

void nana::API::close_window ( window  wd)
std::optional< std::pair< size, size > > nana::API::content_extent ( window  wd,
unsigned  limited_px,
bool  limit_width 
)

Returns a widget content extent size.

Parameters
wdA handle to a window that returns its content extent size.
limited_pxSpecifies the max pixels of width or height. If this parameter is zero, this parameter will be ignored.
limit_widthIndicates whether the it limits the width or height. If this parameter is true, the width is limited. If the parameter is false, the height is limited. This parameter is ignored if limited_px = 0.
Returns
if optional has a value, the first size indicates the content extent, the second size indicates the size of widget by the content extent.
void nana::API::create_caret ( window  wd,
const size &  caret_size 
)
nana::point nana::API::cursor_position ( )
void nana::API::destroy_caret ( window  wd)
void nana::API::draw_through ( window  wd,
std::function< void()>  draw_fn 
)
void nana::API::eat_tabstop ( window  window_handle,
bool  enable 
)

Enables or disables a window to receive a key_char event for pressing TAB key.

void nana::API::effects_bground ( window  wd,
const effects::bground_factory_interface &  factory,
double  fade_rate 
)
void nana::API::effects_bground ( std::initializer_list< window >  wdgs,
const effects::bground_factory_interface &  factory,
double  fade_rate 
)
bground_mode nana::API::effects_bground_mode ( window  wd)
void nana::API::effects_bground_remove ( window  wd)
void nana::API::effects_edge_nimbus ( window  wd,
effects::edge_nimbus  en 
)
Examples:
notepad.cpp.
effects::edge_nimbus nana::API::effects_edge_nimbus ( window  wd)
nana::element_state nana::API::element_state ( window  wd)
template<typename EventArg , typename std::enable_if< std::is_base_of< ::nana::event_arg, EventArg >::value >::type * = nullptr>
bool nana::API::emit_event ( event_code  evt_code,
window  wd,
const EventArg &  arg 
)
template<typename EventArg , typename std::enable_if< std::is_base_of< ::nana::event_arg, EventArg >::value >::type * = nullptr>
bool nana::API::emit_internal_event ( event_code  evt_code,
window  wd,
const EventArg &  arg 
)
bool nana::API::empty_window ( window  wd)

Determines whether a window is existing.

void nana::API::enable_double_click ( window  wd,
bool  dbl 
)
void nana::API::enable_dropfiles ( window  wd,
bool  enb 
)
template<typename Widget = ::nana::widget, typename EnumFunction >
void nana::API::enum_widgets ( window  wd,
bool  recursive,
EnumFunction &&  fn 
)
template<typename Widget = ::nana::widget>
typename ::nana::dev::widget_traits<Widget>::event_type& nana::API::events ( window  wd)
void nana::API::exit ( )

close all windows in current thread

Examples:
helloworld_demo.cpp.
void nana::API::exit_all ( )

close all windows

color nana::API::fgcolor ( window  wd)
color nana::API::fgcolor ( window  wd,
const color &  clr 
)
window nana::API::find_window ( const nana::point mspos)
window nana::API::focus_window ( )

Returns the current keyboard focus window.

void nana::API::focus_window ( window  wd)

Sets the keyboard focus for a specified window.

void nana::API::font_languages ( const std::string langs)

Sets languages.

Specifies the languages in order to make the program display multi-languages correctly Under Windows, the pragram can display multi-languages correctly, so this function is useless for Windows.

void nana::API::fullscreen ( window  wd,
bool  v 
)
window nana::API::get_owner_window ( window  wd)
window nana::API::get_parent_window ( window  wd)
bool nana::API::get_visual_rectangle ( window  wd,
nana::rectangle r 
)
widget * nana::API::get_widget ( window  window_handle)

Returns the widget pointer of the specified window.

bool nana::API::get_window_rectangle ( window  wd,
rectangle &  r 
)
bool nana::API::ignore_mouse_focus ( window  wd,
bool  ignore 
)

Enables/disables the mouse focus, it returns the previous state.

bool nana::API::ignore_mouse_focus ( window  wd)

Determines whether the mouse focus is enabled.

bool nana::API::is_destroying ( window  wd)

Determines whether a window is destroying.

bool nana::API::is_focus_ready ( window  wd)

Determines whether the specified window will get the keyboard focus when its root window gets native system focus.

bool nana::API::is_transparent_background ( window  wd)
bool nana::API::is_window ( window  wd)

Determines whether a window is existing, equal to !empty_window.

bool nana::API::is_window_zoomed ( window  wd,
bool  ask_for_max 
)

Tests a window whether it is maximized or minimized.

nana::rectangle nana::API::make_center ( unsigned  width,
unsigned  height 
)

Retrieves a rectangle which is in the center of the screen.

Examples:
decore.cpp, draw.cpp, example_combox.cpp, folder_tree_nana.cpp, folder_tree_std.cpp, group.cpp, and modal_form.cpp.
nana::rectangle nana::API::make_center ( window  wd,
unsigned  width,
unsigned  height 
)

Retrieves a rectangle which is in the center of the window.

void nana::API::map_through_widgets ( window  wd,
native_drawable_type  drawable 
)
void nana::API::modal_window ( window  wd)

Blocks the execution and other windows' messages until the specified window is closed.

Examples:
modal_form.cpp.
nana::mouse_action nana::API::mouse_action ( window  wd)
window nana::API::move_tabstop ( window  window_handle,
bool  forward 
)

Sets the input focus to the window which the tabstop is near to the specified window.

void nana::API::move_window ( window  wd,
const point &  pos 
)
void nana::API::move_window ( window  wd,
const rectangle &  r 
)
std::unique_ptr< caret_interface > nana::API::open_caret ( window  window_handle,
bool  disable_throw = false 
)

Opens an existing caret of a window.

This function returns an object to operate caret. The object doesn't create or destroy the caret. When you are finished with the caret, be sure to reset the pointer.

Parameters
window_handleA handle to a window whose caret is to be retrieved
Returns
a pointer to the caret proxy. throws std::runtime if the window doesn't have a caret when disable_throw is false
void nana::API::refresh_window ( window  window_handle)

Refresh the window and display it immediately calling the refresh function of its drawer_trigger.

void nana::API::refresh_window_tree ( window  wd)

Refreshes the specified window and all its children windows, then displays it immediately.

bool nana::API::register_shortkey ( window  wd,
unsigned long  key 
)
void nana::API::release_capture ( window  window_handle)

Disable a window to grab the mouse input.

Parameters
windowhandle A handle to a window to release grab of mouse input.
void nana::API::restore_window ( window  wd)
native_window_type nana::API::root ( window  wd)

Retrieves the native window of a Nana.GUI window.

The native window type is platform-dependent. Under Microsoft Windows, a conversion can be employed between nana::native_window_type and HWND through reinterpret_cast operator. Under X System, a conversion can be employed between nana::native_window_type and Window through reinterpret_cast operator.

Returns
If the function succeeds, the return value is the native window handle to the Nana.GUI window. If fails return zero.
Examples:
windows-subclassing.cpp.
window nana::API::root ( native_window_type  wd)

Retrieves the native window of a Nana.GUI window.

bool nana::API::root_graphics ( window  wd,
nana::paint::graphics graph 
)
template<typename Widget = ::nana::widget>
typename ::nana::dev::widget_traits<Widget>::scheme_type& nana::API::scheme ( window  wd)
unsigned nana::API::screen_dpi ( bool  x_requested)
void nana::API::set_capture ( window  window_handle,
bool  ignore_children 
)

Enables a window to grab the mouse input.

Parameters
window_handleA handle to a window to grab the mouse input.
ignore_childrenIndicates whether to redirect the mouse input to its children if the mouse pointer is over its children.
bool nana::API::set_parent_window ( window  wd,
window  new_parent 
)
bool nana::API::set_window_z_order ( window  wd,
window  wd_after,
z_order_action  action_if_no_wd_after 
)
void nana::API::show_window ( window  wd,
bool  show 
)

Sets a window visible state.

void nana::API::tabstop ( window  wd)

Enables that the user can give input focus to the specified window using TAB key.

void nana::API::take_active ( window  wd,
bool  has_active,
window  take_if_has_active_false 
)

Sets the window active state. If a window active state is false, the window will not obtain the focus when a mouse clicks on it which will be obtained by take_if_has_active_false.

bool nana::API::track_window_size ( window  wd,
const size &  sz,
bool  true_for_max 
)

Sets the minimum or maximum tracking size of a window.

Examples:
widget_show2.cpp.
std::string nana::API::transform_shortkey_text ( std::string  text,
wchar_t &  shortkey,
std::string::size_type *  skpos 
)

Searches whether the text contains a '&' and removes the character for transforming. If the text contains more than one '&' characters, the others are ignored. e.g text = "&&a&bcd&ef", the result should be "&abcdef", shortkey = 'b', and pos = 2.

Parameters
textthe text is transformed
shortkeythe character which indicates a short key.
skposretrieves the shortkey position if it is not a null_ptr;
void nana::API::typeface ( window  wd,
const nana::paint::font font 
)
nana::paint::font nana::API::typeface ( window  wd)
void nana::API::umake_event ( event_handle  eh)
void nana::API::unregister_shortkey ( window  wd)
void nana::API::update_window ( window  wd)

Copies the off-screen buffer to the screen for immediate display.

bool nana::API::visible ( window  wd)
void nana::API::wait_for ( window  wd)

Blocks the execution until the specified window is closed.

void nana::API::widget_borderless ( window  wd,
bool  enabled 
)

Enables or disables a borderless widget.

bool nana::API::widget_borderless ( window  wd)

Tests a widget whether it is borderless.

void nana::API::window_caption ( window  wd,
const std::string title_utf8 
)
Examples:
calculator.cpp.
void nana::API::window_caption ( window  wd,
const std::wstring title 
)
std::string nana::API::window_caption ( window  wd)
void nana::API::window_cursor ( window  wd,
cursor  cur 
)
cursor nana::API::window_cursor ( window  wd)
dragdrop_status nana::API::window_dragdrop_status ( ::nana::window  wd)
void nana::API::window_enabled ( window  wd,
bool  enabled 
)
bool nana::API::window_enabled ( window  wd)
bool nana::API::window_graphics ( window  wd,
nana::paint::graphics graph 
)

Copies the graphics of a specified to a new graphics object.

void nana::API::window_icon ( window  wd,
const paint::image &  small_icon,
const paint::image &  big_icon = {} 
)
void nana::API::window_icon_default ( const paint::image &  small_icon,
const paint::image &  big_icon = {} 
)
nana::size nana::API::window_outline_size ( window  wd)
void nana::API::window_outline_size ( window  wd,
const size &  sz 
)
nana::point nana::API::window_position ( window  wd)
std::optional< rectangle > nana::API::window_rectangle ( window  wd)
nana::size nana::API::window_size ( window  wd)
void nana::API::window_size ( window  wd,
const size &  sz 
)
void nana::API::zoom_window ( window  wd,
bool  ask_for_max 
)