# API Wrappers

These wrappers provide a portable object oriented interface for networking, multithreading, GUI development, and file browsing. Programs written using them can be compiled under POSIX or MS Windows platforms without changing the code.

API
gui_widgets
widgets draggable dlib/gui_widgets/base_widgets_abstract.h.html#draggable tooltip dlib/gui_widgets/base_widgets_abstract.h.html#tooltip popup_menu_region dlib/gui_widgets/base_widgets_abstract.h.html#popup_menu_region button_action dlib/gui_widgets/base_widgets_abstract.h.html#button_action scrollable_region dlib/gui_widgets/base_widgets_abstract.h.html#scrollable_region zoomable_region dlib/gui_widgets/base_widgets_abstract.h.html#zoomable_region mouse_over_event dlib/gui_widgets/base_widgets_abstract.h.html#mouse_over_event scroll_bar dlib/gui_widgets/base_widgets_abstract.h.html#scroll_bar widget_group dlib/gui_widgets/base_widgets_abstract.h.html#widget_group image_widget dlib/gui_widgets/base_widgets_abstract.h.html#image_widget popup_menu dlib/gui_widgets/base_widgets_abstract.h.html#popup_menu menu_item dlib/gui_widgets/base_widgets_abstract.h.html#menu_item menu_item_text dlib/gui_widgets/base_widgets_abstract.h.html#menu_item_text menu_item_separator dlib/gui_widgets/base_widgets_abstract.h.html#menu_item_separator menu_item_submenu dlib/gui_widgets/base_widgets_abstract.h.html#menu_item_submenu named_rectangle dlib/gui_widgets/widgets_abstract.h.html#named_rectangle menu_bar dlib/gui_widgets/widgets_abstract.h.html#menu_bar image_window dlib/gui_widgets/widgets_abstract.h.html#image_window image_display dlib/gui_widgets/widgets_abstract.h.html#image_display message_box dlib/gui_widgets/widgets_abstract.h.html#message_box message_box_blocking dlib/gui_widgets/widgets_abstract.h.html#message_box_blocking open_file_box dlib/gui_widgets/widgets_abstract.h.html#open_file_box open_existing_file_box dlib/gui_widgets/widgets_abstract.h.html#open_existing_file_box save_file_box dlib/gui_widgets/widgets_abstract.h.html#save_file_box label dlib/gui_widgets/widgets_abstract.h.html#label button dlib/gui_widgets/base_widgets_abstract.h.html#button toggle_button dlib/gui_widgets/widgets_abstract.h.html#toggle_button text_grid dlib/gui_widgets/widgets_abstract.h.html#text_grid directed_graph_drawer dlib/gui_widgets/widgets_abstract.h.html#directed_graph_drawer list_box dlib/gui_widgets/widgets_abstract.h.html#list_box check_box dlib/gui_widgets/widgets_abstract.h.html#check_box radio_button dlib/gui_widgets/widgets_abstract.h.html#radio_button text_field dlib/gui_widgets/widgets_abstract.h.html#text_field text_box dlib/gui_widgets/widgets_abstract.h.html#text_box tabbed_display dlib/gui_widgets/widgets_abstract.h.html#tabbed_display mouse_tracker dlib/gui_widgets/widgets_abstract.h.html#mouse_tracker styles button_style dlib/gui_widgets/style_abstract.h.html#button_style button_style_default dlib/gui_widgets/style_abstract.h.html#button_style_default button_style_arrow dlib/gui_widgets/style_abstract.h.html#button_style_arrow button_style_toolbar1 dlib/gui_widgets/style_abstract.h.html#button_style_toolbar1 button_style_toolbar_icon1 dlib/gui_widgets/style_abstract.h.html#button_style_toolbar_icon1 toggle_button_style dlib/gui_widgets/style_abstract.h.html#toggle_button_style toggle_button_style_default dlib/gui_widgets/style_abstract.h.html#toggle_button_style_default toggle_button_style_check_box dlib/gui_widgets/style_abstract.h.html#toggle_button_style_check_box toggle_button_style_radio_button dlib/gui_widgets/style_abstract.h.html#toggle_button_style_radio_button scroll_bar_style dlib/gui_widgets/style_abstract.h.html#scroll_bar_style scroll_bar_style_default dlib/gui_widgets/style_abstract.h.html#scroll_bar_style_default scrollable_region_style dlib/gui_widgets/style_abstract.h.html#scrollable_region_style scrollable_region_style_default dlib/gui_widgets/style_abstract.h.html#scrollable_region_style_default list_box_style dlib/gui_widgets/style_abstract.h.html#list_box_style list_box_style_default dlib/gui_widgets/style_abstract.h.html#list_box_style_default text_field_style dlib/gui_widgets/style_abstract.h.html#text_field_style text_field_style_default dlib/gui_widgets/style_abstract.h.html#text_field_style_default text_box_style dlib/gui_widgets/style_abstract.h.html#text_box_style text_box_style_default dlib/gui_widgets/style_abstract.h.html#text_box_style_default canvas drawing functions draw_line dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_line draw_rectangle dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_rectangle draw_circle dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_circle draw_pixel dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_pixel draw_solid_circle dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_solid_circle draw_button_down dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_button_down draw_sunken_rectangle dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_sunken_rectangle draw_button_up dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_button_up draw_checkered dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_checkered draw_image dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_image fill_rect dlib/gui_widgets/canvas_drawing_abstract.h.html#fill_rect fill_rect_with_vertical_gradient dlib/gui_widgets/canvas_drawing_abstract.h.html#fill_rect_with_vertical_gradient fill_gradient_rounded dlib/gui_widgets/canvas_drawing_abstract.h.html#fill_gradient_rounded draw_rounded_rectangle dlib/gui_widgets/canvas_drawing_abstract.h.html#draw_rounded_rectangle drawable dlib/gui_widgets/drawable_abstract.h.html#drawable set_main_font dlib/gui_widgets/drawable_abstract.h.html#set_main_font main_font dlib/gui_widgets/drawable_abstract.h.html#main_font z_order dlib/gui_widgets/drawable_abstract.h.html#z_order next_free_user_event_number dlib/gui_widgets/drawable_abstract.h.html#next_free_user_event_number set_z_order dlib/gui_widgets/drawable_abstract.h.html#set_z_order shape get_rect dlib/gui_widgets/drawable_abstract.h.html#get_rect bottom dlib/gui_widgets/drawable_abstract.h.html#bottom top dlib/gui_widgets/drawable_abstract.h.html#top left dlib/gui_widgets/drawable_abstract.h.html#left right dlib/gui_widgets/drawable_abstract.h.html#right width dlib/gui_widgets/drawable_abstract.h.html#width height dlib/gui_widgets/drawable_abstract.h.html#height set_pos dlib/gui_widgets/drawable_abstract.h.html#set_pos is_enabled dlib/gui_widgets/drawable_abstract.h.html#is_enabled enable dlib/gui_widgets/drawable_abstract.h.html#enable disable dlib/gui_widgets/drawable_abstract.h.html#disable is_hidden dlib/gui_widgets/drawable_abstract.h.html#is_hidden show dlib/gui_widgets/drawable_abstract.h.html#show hide dlib/gui_widgets/drawable_abstract.h.html#hide parent_window dlib/gui_widgets/drawable_abstract.h.html#parent_window enable_events dlib/gui_widgets/drawable_abstract.h.html#enable_events events_are_enabled dlib/gui_widgets/drawable_abstract.h.html#events_are_enabled disable_events dlib/gui_widgets/drawable_abstract.h.html#disable_events events on_window_resized dlib/gui_widgets/drawable_abstract.h.html#on_window_resized on_window_moved dlib/gui_widgets/drawable_abstract.h.html#on_window_moved on_focus_gained dlib/gui_widgets/drawable_abstract.h.html#on_focus_gained on_focus_lost dlib/gui_widgets/drawable_abstract.h.html#on_focus_lost on_mouse_up dlib/gui_widgets/drawable_abstract.h.html#on_mouse_up on_mouse_move dlib/gui_widgets/drawable_abstract.h.html#on_mouse_move on_mouse_enter dlib/gui_widgets/drawable_abstract.h.html#on_mouse_enter on_mouse_leave dlib/gui_widgets/drawable_abstract.h.html#on_mouse_leave on_mouse_down dlib/gui_widgets/drawable_abstract.h.html#on_mouse_down on_wheel_up dlib/gui_widgets/drawable_abstract.h.html#on_wheel_up on_wheel_down dlib/gui_widgets/drawable_abstract.h.html#on_wheel_down on_keydown dlib/gui_widgets/drawable_abstract.h.html#on_keydown on_string_put dlib/gui_widgets/drawable_abstract.h.html#on_string_put on_user_event dlib/gui_widgets/drawable_abstract.h.html#on_user_event draw dlib/gui_widgets/drawable_abstract.h.html#draw drawable_window dlib/gui_widgets/drawable_abstract.h.html#drawable_window fonts letter dlib/gui_widgets/fonts_abstract.h.html#letter font dlib/gui_widgets/fonts_abstract.h.html#font default_font dlib/gui_widgets/fonts_abstract.h.html#default_font get_native_font dlib/gui_widgets/fonts_abstract.h.html#get_native_font bdf_font dlib/gui_widgets/fonts_abstract.h.html#bdf_font
gui_core
base_window dlib/gui_core/gui_core_kernel_abstract.h.html#base_window canvas dlib/gui_core/gui_core_kernel_abstract.h.html#canvas get_from_clipboard dlib/gui_core/gui_core_kernel_abstract.h.html#get_from_clipboard put_on_clipboard dlib/gui_core/gui_core_kernel_abstract.h.html#put_on_clipboard
dir_nav
get_filesystem_roots dlib/dir_nav/dir_nav_kernel_abstract.h.html#get_filesystem_roots file dlib/dir_nav/dir_nav_kernel_abstract.h.html#file directory dlib/dir_nav/dir_nav_kernel_abstract.h.html#directory get_files_in_directory_tree dlib/dir_nav/dir_nav_extensions_abstract.h.html#get_files_in_directory_tree
misc_api
sleep dlib/misc_api/misc_api_kernel_abstract.h.html#sleep get_current_dir dlib/misc_api/misc_api_kernel_abstract.h.html#get_current_dir create_directory dlib/misc_api/misc_api_kernel_abstract.h.html#create_directory timestamper dlib/misc_api/misc_api_kernel_abstract.h.html#timestamper
threads
extensions thread_specific_data dlib/threads/thread_specific_data_extension_abstract.h.html create_new_thread extension dlib/threads/create_new_thread_extension_abstract.h.html#create_new_thread rsignaler dlib/threads/rsignaler_extension_abstract.h.html#rsignaler rmutex dlib/threads/rmutex_extension_abstract.h.html#rmutex auto_mutex dlib/threads/auto_mutex_extension_abstract.h.html#auto_mutex auto_unlock dlib/threads/auto_unlock_extension_abstract.h.html#auto_unlock threaded_object dlib/threads/threaded_object_extension_abstract.h.html#threaded_object thread_pool dlib/threads/thread_pool_extension_abstract.h.html#thread_pool future dlib/threads/thread_pool_extension_abstract.h.html#future thread_function dlib/threads/thread_function_extension_abstract.h.html#thread_function multithreaded_object dlib/threads/multithreaded_object_extension_abstract.h.html#multithreaded_object is_dlib_thread dlib/threads/threads_kernel_abstract.h.html#is_dlib_thread create_new_thread dlib/threads/threads_kernel_abstract.h.html#create_new_thread mutex dlib/threads/threads_kernel_abstract.h.html#mutex unregister_thread_end_handler dlib/threads/threads_kernel_abstract.h.html#unregister_thread_end_handler register_thread_end_handler dlib/threads/threads_kernel_abstract.h.html#register_thread_end_handler signaler dlib/threads/threads_kernel_abstract.h.html#signaler get_thread_id dlib/threads/threads_kernel_abstract.h.html#get_thread_id
sockets
extensions connect dlib/sockets/sockets_extensions_abstract.h.html#connect is_ip_address dlib/sockets/sockets_extensions_abstract.h.html#is_ip_address close_gracefully dlib/sockets/sockets_extensions_abstract.h.html#close_gracefully objects connection dlib/sockets/sockets_kernel_abstract.h.html#connection listener dlib/sockets/sockets_kernel_abstract.h.html#listener functions create_connection dlib/sockets/sockets_kernel_abstract.h.html#create_connection create_listener dlib/sockets/sockets_kernel_abstract.h.html#create_listener get_local_hostname dlib/sockets/sockets_kernel_abstract.h.html#get_local_hostname hostname_to_ip dlib/sockets/sockets_kernel_abstract.h.html#hostname_to_ip ip_to_hostname dlib/sockets/sockets_kernel_abstract.h.html#ip_to_hostname
dir_nav
dlib/dir_nav.h
dlib/dir_nav/dir_nav_kernel_abstract.h
This is a set of objects that provide an easy and portable way to traverse a directory tree.
dir_nav_ex.cpp.html
dir_nav_kernel_1
dlib/dir_nav/dir_nav_kernel_1.h
MS Windows implementation
dir_nav_kernel_2
dlib/dir_nav/dir_nav_kernel_2.h
POSIX implementation
dir_nav_extensions
dlib/dir_nav/dir_nav_extensions_abstract.h

This is just some miscellaneous extensions to the dir_nav component.

The implementation of this extension can be found here.
gui_core
dlib/gui_core.h
dlib/gui_core/gui_core_kernel_abstract.h
This is a set of objects and functions which provide a very basic framework for manipulating windows. It is intended to provide a portable interface which can be used to build a more complex windowing toolkit.
gui_core_kernel_1
dlib/gui_core/gui_core_kernel_1.h
MS Windows implementation
gui_core_kernel_2
dlib/gui_core/gui_core_kernel_2.h
X Windows implementation
misc_api
dlib/misc_api.h
dlib/misc_api/misc_api_kernel_abstract.h
This is just a collection of miscellaneous APIs that were small/simple enough not to warrant their own module.
misc_api_kernel_1
dlib/misc_api/misc_api_kernel_1.h
MS Windows implementation
misc_api_kernel_2
dlib/misc_api/misc_api_kernel_2.h
POSIX implementation
sockets
dlib/sockets.h
dlib/sockets/sockets_kernel_abstract.h
This is a set of objects that provides an easy to use and object oriented interface for dealing with TCP networking. There are currently two implementations, one for UNIX and another for all versions of Windows after Windows95. Both provide the exact same interface so programs written with them can be recompiled on either platform without a problem.

You also may want to take note of the timeout object. It provides a mechanism which you can use to add a timeout to a network operation.

sockets_ex.cpp.html
sockstreambuf_ex.cpp.html
sockets_ex_2.cpp.html
sockets_kernel_1
dlib/sockets/sockets_kernel_1.h
MS Windows implementation
sockets_kernel_2
dlib/sockets/sockets_kernel_2.h
POSIX implementation
sockets_extensions
dlib/sockets/sockets_extensions_abstract.h

This is just some miscellaneous extensions to the socket api.

The implementation of this extension can be found here.
threads
dlib/threads.h
dlib/threads/threads_kernel_abstract.h
This is a set of objects that provides an easy to use and object oriented interface for creating multi-threaded programs. There are currently two implementations, one for UNIX and another for any variant of MS Windows after Windows 95. Both provide the exact same interface so programs written with them can be recompiled on either platform without a problem.

You also probably want to take note of the pipe object. It provides an easy to use typesafe mechanism to send messages between threads.

threads_ex.cpp.html
logger_ex_2.cpp.html
pipe_ex.cpp.html
threads_kernel_1
dlib/threads/threads_kernel_1.h
MS Windows implementation
threads_kernel_2
dlib/threads/threads_kernel_2.h
POSIX implementation
rsignaler
dlib/threads/rsignaler_extension_abstract.h

This extension adds a signaler object that can be used with the rmutex object. Also note that this extension is included by dlib/threads.h so you don't have to include anything extra to get it.

The implementation of this extension can be found here.
thread_specific_data
dlib/threads/thread_specific_data_extension_abstract.h

This extension adds the ability to easily create thread specific data.

The implementation of this extension can be found here.
rmutex
dlib/threads/rmutex_extension_abstract.h

This extension adds a mutex object that can handle recursive calls to lock(). Also note that this extension is included by dlib/threads.h so you don't have to include anything extra to get it.

The implementation of this extension can be found here.
create_new_thread extension
dlib/threads/create_new_thread_extension_abstract.h

This extension adds some templated overloads to the create_new_thread() function. They allow you to create new threads using member functions from a class. Also note that this extension is included by dlib/threads.h so you don't have to include anything extra to get it.

The implementation of this extension can be found here.
auto_mutex
dlib/threads/auto_mutex_extension_abstract.h

This extension adds a mechanism to automatically lock and unlock a mutex. Also note that this extension is included by dlib/threads.h so you don't have to include anything extra to get it.

The implementation of this extension can be found here.
threads_ex.cpp.html
thread_function
dlib/threads/thread_function_extension_abstract.h

This object represents a thread on a global C++ function. That is, it allows you to run a global function in its own thread.

The implementation of this extension can be found here.
thread_function_ex.cpp.html
threaded_object
dlib/threads/threaded_object_extension_abstract.h

This extension represents a simple threaded object. It provides a convenient mechanism to create an object that contains a thread.

The implementation of this extension can be found here.
threaded_object_ex.cpp.html
thread_pool
dlib/threads/thread_pool_extension_abstract.h

This object represents a fixed size group of threads which you can submit tasks to and then wait for those tasks to be completed. It also provides a future object that provides a container which allows you to safely pass objects into the tasks.

The implementation of this extension can be found here. It is implemented such that no memory allocations occur after the thread pool has been constructed (the future object also doesn't perform any memory allocations or contain any system resources such as mutex objects).

thread_pool_ex.cpp.html
multithreaded_object
dlib/threads/multithreaded_object_extension_abstract.h

This object represents a multithreaded object. It is similar to the threaded_object except it allows you to have many threads in a single object rather than just one.

The implementation of this extension can be found here.
multithreaded_object_ex.cpp.html
pipe_ex.cpp.html
auto_unlock
dlib/threads/auto_unlock_extension_abstract.h

This extension adds a mechanism to automatically unlock a mutex. Also note that this extension is included by dlib/threads.h so you don't have to include anything extra to get it.

The implementation of this extension can be found here.
gui_widgets
dlib/gui_widgets.h

This component is a collection of various windowing widgets such as buttons, labels, text boxes, and so on. It also includes the drawable interface, drawable_window, and font handling objects. dlib/gui_widgets/widgets_abstract.h defines all of the high level graphical widgets provided by this component that can appear in a drawable_window. To view the specifications for the other members of this component look at dlib/gui_widgets/fonts_abstract.h, dlib/gui_widgets/drawable_abstract.h, and dlib/gui_widgets/base_widgets_abstract.h.

This component isn't actually a wrapper on top of OS APIs. Rather, it is implemented on top of the gui_core component. I put it on this page just because I expect that people would look here when searching for the sort of functionality provided by this component.

gui_api_ex.cpp.html
image_ex.cpp.html
surf_ex.cpp.html
bayes_net_gui_ex.cpp.html