|
<html><head><title>dlib C++ Library - widgets_abstract.h</title></head><body bgcolor='white'><pre> |
|
<font color='#009900'>// Copyright (C) 2005 Davis E. King ([email protected]), Keita Mochizuki |
|
</font><font color='#009900'>// License: Boost Software License See LICENSE.txt for the full license. |
|
</font> |
|
<font color='#0000FF'>#undef</font> DLIB_WIDGETs_ABSTRACT_ |
|
<font color='#0000FF'>#ifdef</font> DLIB_WIDGETs_ABSTRACT_ |
|
|
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='fonts_abstract.h.html'>fonts_abstract.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='drawable_abstract.h.html'>drawable_abstract.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='base_widgets_abstract.h.html'>base_widgets_abstract.h</a>" |
|
|
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../gui_core.h.html'>../gui_core.h</a>" |
|
<font color='#0000FF'>#include</font> <font color='#5555FF'><</font>string<font color='#5555FF'>></font> |
|
<font color='#0000FF'>#include</font> <font color='#5555FF'><</font>map<font color='#5555FF'>></font> |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../interfaces/enumerable.h.html'>../interfaces/enumerable.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='style_abstract.h.html'>style_abstract.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../image_processing/full_object_detection_abstract.h.html'>../image_processing/full_object_detection_abstract.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../geometry/line_abstract.h.html'>../geometry/line_abstract.h</a>" |
|
|
|
<font color='#0000FF'>namespace</font> dlib |
|
<b>{</b> |
|
|
|
<font color='#009900'>/*! |
|
GENERAL REMARKS |
|
This component is a collection of various windowing widgets such as buttons, |
|
labels, text boxes, and so on. This component also includes the drawable |
|
interface, drawable_window, and font handling objects. The file you are |
|
currently viewing defines all the high level graphical widgets which are |
|
provided by this component that can appear in a drawable_window. To view |
|
the specifications for the other members of this component look at |
|
fonts_abstract.h, base_widgets_abstract.h, and drawable_abstract.h |
|
|
|
THREAD SAFETY |
|
All objects and functions defined in this file are thread safe. You may |
|
call them from any thread without serializing access to them. |
|
|
|
EVENT HANDLERS |
|
Note that all event handlers, including the user registered callback |
|
functions, are executed in the event handling thread. Additionally, |
|
the drawable::m mutex will always be locked while these event handlers |
|
are running. Also, don't rely on get_thread_id() always returning the |
|
same ID from inside event handlers. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// function open_file_box(), open_existing_file_box(), and save_file_box() |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='open_file_box'></a>open_file_box</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler == a valid pointer to a member function of object T. |
|
ensures |
|
- Displays a window titled "Open File" that will allow the user to select a |
|
file. |
|
- The displayed window will start out showing the directory get_current_dir() |
|
(i.e. it starts in the current working directory) |
|
- The event_handler function is called on object if the user selects |
|
a file. If the user closes the window without selecting a file |
|
then nothing occurs. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='open_file_box'></a>open_file_box</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Displays a window titled "Open File" that will allow the user to select a |
|
file. |
|
- The displayed window will start out showing the directory get_current_dir() |
|
(i.e. it starts in the current working directory) |
|
- The event_handler function is called if the user selects |
|
a file. If the user closes the window without selecting a file |
|
then nothing occurs. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='open_existing_file_box'></a>open_existing_file_box</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler == a valid pointer to a member function of object T. |
|
ensures |
|
- Displays a window titled "Open File" that will allow the user to select |
|
a file. But only a file that already exists. |
|
- The displayed window will start out showing the directory get_current_dir() |
|
(i.e. it starts in the current working directory) |
|
- The event_handler function is called on object if the user selects |
|
a file. If the user closes the window without selecting a file |
|
then nothing occurs. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='open_existing_file_box'></a>open_existing_file_box</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Displays a window titled "Open File" that will allow the user to select |
|
a file. But only a file that already exists. |
|
- The displayed window will start out showing the directory get_current_dir() |
|
(i.e. it starts in the current working directory) |
|
- The event_handler function is called if the user selects |
|
a file. If the user closes the window without selecting a file |
|
then nothing occurs. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='save_file_box'></a>save_file_box</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler == a valid pointer to a member function of object T. |
|
ensures |
|
- Displays a window titled "Save File" that will allow the user to select |
|
a file. |
|
- The displayed window will start out showing the directory get_current_dir() |
|
(i.e. it starts in the current working directory) |
|
- The event_handler function is called on object if the user selects |
|
a file. If the user closes the window without selecting a file |
|
then nothing occurs. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='save_file_box'></a>save_file_box</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Displays a window titled "Save File" that will allow the user to select |
|
a file. |
|
- The displayed window will start out showing the directory get_current_dir() |
|
(i.e. it starts in the current working directory) |
|
- The event_handler function is called if the user selects |
|
a file. If the user closes the window without selecting a file |
|
then nothing occurs. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// function message_box() |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='message_box'></a>message_box</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> title, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> message |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- displays a message box with the given title and message. It will have a |
|
single button and when the user clicks it the message box will go away. |
|
- this function does not block but instead returns immediately. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='message_box_blocking'></a>message_box_blocking</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> title, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> message |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- displays a message box with the given title and message. It will have a |
|
single button and when the user clicks it the message box will go away. |
|
- this function blocks until the user clicks on the message box and |
|
causes it to go away. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='message_box'></a>message_box</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> title, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> message, |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler == a valid pointer to a member function of object T. |
|
ensures |
|
- Displays a message box with the given title and message. It will have a |
|
single button and when the user clicks it the message box will go away. |
|
- The event_handler function is called on object when the user clicks |
|
ok or otherwise closes the message box window. |
|
- this function does not block but instead returns immediately. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='message_box'></a>message_box</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> title, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> message, |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Displays a message box with the given title and message. It will have a |
|
single button and when the user clicks it the message box will go away. |
|
- The event_handler function is called when the user clicks |
|
ok or otherwise closes the message box window. |
|
- this function does not block but instead returns immediately. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class label |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='label'></a>label</b> : <font color='#0000FF'>public</font> drawable |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
text() == "" |
|
the text color will be black |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a simple text label. The size of the label |
|
is automatically set to be just big enough to contain its text. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='label'></a>label</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='label'></a>label</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&</font> text<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&</font> text<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> text |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #text() == text |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> std::wstring <b><a name='wtext'></a>wtext</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> dlib::ustring <b><a name='utext'></a>utext</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::string <b><a name='text'></a>text</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the text of this label |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text_color'></a>set_text_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rgb_pixel color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #text_color() == color |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> rgb_pixel <b><a name='text_color'></a>text_color</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the color used to draw the text in this widget |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='label'></a>label</b><font face='Lucida Console'>(</font>label<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> label<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>label<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class toggle_button |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='toggle_button'></a>toggle_button</b> : <font color='#0000FF'>public</font> button_action |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
name() == "" |
|
is_checked() == false |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a simple two state toggle button. Is is either |
|
in the checked or unchecked state and when a user clicks on it it toggles its |
|
state. |
|
|
|
When this object is disabled it means it will not respond to user clicks. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='toggle_button'></a>toggle_button</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='toggle_button'></a>toggle_button</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_name'></a>set_name</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&</font> name<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_name'></a>set_name</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&</font> name<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_name'></a>set_name</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> name |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #name() == name |
|
- this toggle_button has been resized such that it is big enough to contain |
|
the new name. |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_size'></a>set_size</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width_, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> height_ |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- if (width and height are big enough to contain the name of this button) then |
|
- #width() == width_ |
|
- #height() == height_ |
|
- #top() == top() |
|
- #left() == left() |
|
- i.e. The location of the upper left corner of this button stays the |
|
same but its width and height are modified |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_tooltip_text'></a>set_tooltip_text</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&</font> text<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_tooltip_text'></a>set_tooltip_text</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&</font> text<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_tooltip_text'></a>set_tooltip_text</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> text |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #tooltip_text() == text |
|
- enables the tooltip for this toggle_button |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> dlib::ustring <b><a name='tooltip_utext'></a>tooltip_utext</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::wstring <b><a name='tooltip_wtext'></a>tooltip_wtext</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::string <b><a name='tooltip_text'></a>tooltip_text</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the text that is displayed in the tooltip for this toggle_button |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> style_type |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_style'></a>set_style</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> style_type<font color='#5555FF'>&</font> style |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- style_type == a type that inherits from toggle_button_style |
|
ensures |
|
- this toggle_button object will draw itself using the given |
|
button style |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='is_checked'></a>is_checked</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- if (this box is currently checked) then |
|
- returns true |
|
- else |
|
- returns false |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> std::wstring <b><a name='wname'></a>wname</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> dlib::ustring <b><a name='uname'></a>uname</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::string <b><a name='name'></a>name</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the name of this toggle_button. The name is a string |
|
that appears to the right of the actual check box. |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_checked'></a>set_checked</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #is_checked() == true |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_unchecked'></a>set_unchecked</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #is_checked() == false |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_click_handler'></a>set_click_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when the toggle_button is |
|
toggled by the user. |
|
- this event is NOT triggered by calling set_checked() or set_unchecked(). |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_click_handler'></a>set_click_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when the toggle_button is |
|
toggled by the user. |
|
- this event is NOT triggered by calling set_checked() or set_unchecked(). |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_click_handler'></a>set_click_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>toggle_button<font color='#5555FF'>&</font> self<font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T. |
|
ensures |
|
- the event_handler function is called on object when the toggle_button is |
|
toggled by the user. self will be a reference to the toggle_button object |
|
that the user clicked. |
|
- this event is NOT triggered by calling set_checked() or set_unchecked(). |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_sourced_click_handler'></a>set_sourced_click_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font>toggle_button<font color='#5555FF'>&</font> self<font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when the toggle_button is |
|
toggled by the user. self will be a reference to the toggle_button object |
|
that the user clicked. |
|
- this event is NOT triggered by calling set_checked() or set_unchecked(). |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='toggle_button'></a>toggle_button</b><font face='Lucida Console'>(</font>toggle_button<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> toggle_button<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>toggle_button<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class text_field |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='text_field'></a>text_field</b> : <font color='#0000FF'>public</font> drawable |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
- text() == "" |
|
- width() == 10 |
|
- height() == a height appropriate for the font used. The text color will |
|
be black. |
|
- has_input_focus() == false |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a simple one line text input field. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='text_field'></a>text_field</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='text_field'></a>text_field</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> style_type |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_style'></a>set_style</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> style_type<font color='#5555FF'>&</font> style |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- style_type == a type that inherits from text_field_style |
|
ensures |
|
- this text_field object will draw itself using the given |
|
text field style |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&</font> text<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&</font> text<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> text |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- text.find_first_of('\n') == std::string::npos |
|
(i.e. there aren't any new lines in text) |
|
ensures |
|
- #text() == text |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> std::wstring <b><a name='wtext'></a>wtext</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> dlib::ustring <b><a name='utext'></a>utext</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::string <b><a name='text'></a>text</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the text of this text_field |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_width'></a>set_width</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width_ |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- if (width >= 10) then |
|
- #width() == width_ |
|
- #height() == height() |
|
- #top() == top() |
|
- #left() == left() |
|
- i.e. The width of this drawable is set to the given width but |
|
nothing else changes. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='give_input_focus'></a>give_input_focus</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #has_input_focus() == true |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='has_input_focus'></a>has_input_focus</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Returns true if this txt field has input keyboard focus. If this |
|
is the case then it means that when the user types on the keyboard |
|
the output will appear inside the text field. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='select_all_text'></a>select_all_text</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- causes all the text in the text field to become selected. |
|
(note that it doesn't give input focus) |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text_color'></a>set_text_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rgb_pixel color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #text_color() == color |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> rgb_pixel <b><a name='text_color'></a>text_color</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the color used to draw the text in this widget |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_background_color'></a>set_background_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rgb_pixel color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #background_color() == color |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> rgb_pixel <b><a name='background_color'></a>background_color</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the color used to fill in the background of this widget |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text_modified_handler'></a>set_text_modified_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when the text |
|
in this text_field is modified by the user. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text_modified_handler'></a>set_text_modified_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when the text in this text_field |
|
is modified by the user. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_enter_key_handler'></a>set_enter_key_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when this text field |
|
has input focus and the user hits the enter key on their keyboard. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_enter_key_handler'></a>set_enter_key_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when this text field has input |
|
focus and the user hits the enter key on their keyboard. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_focus_lost_handler'></a>set_focus_lost_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when this object |
|
loses input focus due to the user clicking outside the text field |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_focus_lost_handler'></a>set_focus_lost_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when this object loses input |
|
focus due to the user clicking outside the text field |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='text_field'></a>text_field</b><font face='Lucida Console'>(</font>text_field<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> text_field<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>text_field<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class text_box |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='text_box'></a>text_box</b> : <font color='#0000FF'>public</font> scrollable_region |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
- text() == "" |
|
- The text color will be black. |
|
- width() == 100 |
|
- height() == 100 |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a simple multi-line text input box. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='text_box'></a>text_box</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='text_box'></a>text_box</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> style_type |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_style'></a>set_style</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> style_type<font color='#5555FF'>&</font> style |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- style_type == a type that inherits from text_box_style |
|
ensures |
|
- this text_box object will draw itself using the given |
|
text box style |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&</font> text<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&</font> text<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> text |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #text() == text |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> std::wstring <b><a name='wtext'></a>wtext</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> dlib::ustring <b><a name='utext'></a>utext</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::string <b><a name='text'></a>text</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the text of this text_box |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_size'></a>set_size</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> height |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #width() == width_ |
|
- #height() == height_ |
|
- #top() == top() |
|
- #left() == left() |
|
- i.e. The location of the upper left corner of this widget stays the |
|
same but its width and height are modified |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text_color'></a>set_text_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rgb_pixel color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #text_color() == color |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> rgb_pixel <b><a name='text_color'></a>text_color</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the color used to draw the text in this widget |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_background_color'></a>set_background_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rgb_pixel color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #background_color() == color |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> rgb_pixel <b><a name='background_color'></a>background_color</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the color used to fill in the background of this widget |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text_modified_handler'></a>set_text_modified_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when the text |
|
in this text_box is modified by the user. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text_modified_handler'></a>set_text_modified_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when the text in this text_box |
|
is modified by the user. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_enter_key_handler'></a>set_enter_key_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when this text box |
|
has input focus and the user hits the enter key on their keyboard. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_enter_key_handler'></a>set_enter_key_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when this text box has input |
|
focus and the user hits the enter key on their keyboard. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_focus_lost_handler'></a>set_focus_lost_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when this object |
|
loses input focus due to the user clicking outside the text box |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_focus_lost_handler'></a>set_focus_lost_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when this object loses input |
|
focus due to the user clicking outside the text box |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='text_box'></a>text_box</b><font face='Lucida Console'>(</font>text_box<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> text_box<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>text_box<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class check_box |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='check_box'></a>check_box</b> : <font color='#0000FF'>public</font> toggle_button |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
This is just a toggle button with the style set to |
|
toggle_button_style_check_box. |
|
!*/</font> |
|
<b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class radio_button |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='radio_button'></a>radio_button</b> : <font color='#0000FF'>public</font> toggle_button |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
This is just a toggle button with the style set to |
|
toggle_button_style_radio_button. |
|
!*/</font> |
|
<b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class tabbed_display |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='tabbed_display'></a>tabbed_display</b> : <font color='#0000FF'>public</font> drawable |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
number_of_tabs() == 1 |
|
selected_tab() == 0 |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a row of tabs that are user selectable. |
|
|
|
When this object is disabled it means it will not respond to user clicks. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='tabbed_display'></a>tabbed_display</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='tabbed_display'></a>tabbed_display</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_size'></a>set_size</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width_, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> height_ |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- if (width and height are big enough to contain the tabs) then |
|
- #width() == width_ |
|
- #height() == height_ |
|
- #top() == top() |
|
- #left() == left() |
|
- i.e. The location of the upper left corner of this widget stays the |
|
same but its width and height are modified |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_number_of_tabs'></a>set_number_of_tabs</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> num |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- num > 0 |
|
ensures |
|
- #number_of_tabs() == num |
|
- no tabs have any widget_groups associated with them. |
|
- for all valid idx: |
|
- #tab_name(idx) == "" |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='selected_tab'></a>selected_tab</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the index of the currently selected tab |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='number_of_tabs'></a>number_of_tabs</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the number of tabs in this tabbed_display |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&</font> <b><a name='tab_wname'></a>tab_wname</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&</font> <b><a name='tab_uname'></a>tab_uname</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> <b><a name='tab_name'></a>tab_name</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- idx < number_of_tabs() |
|
ensures |
|
- returns a const reference to the name of the tab given by idx |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_tab_name'></a>set_tab_name</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx, <font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&</font> new_name<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_tab_name'></a>set_tab_name</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx, <font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&</font> new_name<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_tab_name'></a>set_tab_name</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> new_name |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- idx < number_of_tabs() |
|
ensures |
|
- #tab_name(idx) == new_name |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_tab_group'></a>set_tab_group</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx, |
|
widget_group<font color='#5555FF'>&</font> group |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- idx < number_of_tabs() |
|
ensures |
|
- if (is_hidden()) then |
|
- group.is_hidden() == true |
|
- else |
|
- whenever the tab with index idx is selected group.is_hidden() == false |
|
- whenever the tab with index idx is deselected group.is_hidden() == true |
|
- whenever the position of *this changes the position of group will be |
|
updated so that it is still inside the tabbed_display. The position of group |
|
will also be updated after this call to set_tab_group(). |
|
- any previous calls to set_tab_group() with this index are overridden by this |
|
new call. (i.e. you can only have one widget_group associated with a single |
|
tab at a time) |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='fit_to_contents'></a>fit_to_contents</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Adjusts the size this tabbed_display so that it nicely contains |
|
all of its widget_group objects. |
|
- does not change the position of this object. |
|
(i.e. the upper left corner of get_rect() remains at the same position) |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_click_handler'></a>set_click_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> new_idx, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> old_idx<font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- The event_handler function is called on object when the user clicks |
|
on a tab that isn't already selected. new_idx will give the index of |
|
the newly selected tab and old_idx will give the index of the tab |
|
that was previously selected. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_click_handler'></a>set_click_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> new_idx, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> old_idx<font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> eh |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- The event_handler function is called when the user clicks on a tab |
|
that isn't already selected. new_idx will give the index of the |
|
newly selected tab and old_idx will give the index of the tab that |
|
was previously selected. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='tabbed_display'></a>tabbed_display</b><font face='Lucida Console'>(</font>tabbed_display<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> tabbed_display<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>tabbed_display<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class named_rectangle |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='named_rectangle'></a>named_rectangle</b> : <font color='#0000FF'>public</font> drawable |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
name() == "" |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a simple named rectangle. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='named_rectangle'></a>named_rectangle</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='named_rectangle'></a>named_rectangle</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_size'></a>set_size</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width_, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> height_ |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #width() == width_ |
|
- #height() == height_ |
|
- #top() == top() |
|
- #left() == left() |
|
- i.e. The location of the upper left corner of this widget stays the |
|
same but its width and height are modified |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='wrap_around'></a>wrap_around</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&</font> rect |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This object will be repositioned and sized so that it fits |
|
around the given rectangle. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_name'></a>set_name</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&</font> name<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_name'></a>set_name</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&</font> name<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_name'></a>set_name</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> name |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #name() == name |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> std::wstring <b><a name='wname'></a>wname</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> dlib::ustring <b><a name='uname'></a>uname</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::string <b><a name='name'></a>name</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the name of this named_rectangle |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='named_rectangle'></a>named_rectangle</b><font face='Lucida Console'>(</font>named_rectangle<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> named_rectangle<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>named_rectangle<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class mouse_tracker |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='mouse_tracker'></a>mouse_tracker</b> : <font color='#0000FF'>public</font> draggable |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
draggable_area() == rectangle(0,0,500,500) |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a simple draggable box that displays the |
|
current location of the mouse. |
|
|
|
Also, if you hold shift and left click on the parent window then the |
|
mouse_tracker will place a single red pixel where you clicked and will |
|
display the mouse position relative to that point. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='mouse_tracker'></a>mouse_tracker</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='mouse_tracker'></a>mouse_tracker</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='mouse_tracker'></a>mouse_tracker</b><font face='Lucida Console'>(</font>mouse_tracker<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> mouse_tracker<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>mouse_tracker<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class list_box |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='list_box'></a>list_box</b> : <font color='#0000FF'>public</font> scrollable_region, |
|
<font color='#0000FF'>public</font> enumerable<font color='#5555FF'><</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>></font> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
multiple_select_enabled() == false |
|
size() == 0 |
|
|
|
ENUMERATION ORDER |
|
The enumerator will iterate over the elements in the list_box from |
|
the 0th element to the (size()-1)th element. i.e. (*this)[0] to |
|
(*this)[size()-1]. |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a simple textual list box. It contains a |
|
vertical list of strings which the user may select from. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='list_box'></a>list_box</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='list_box'></a>list_box</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> style_type |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_style'></a>set_style</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> style_type<font color='#5555FF'>&</font> style |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- style_type == a type that inherits from list_box_style |
|
ensures |
|
- this list_box object will draw itself using the given style |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_size'></a>set_size</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width_, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> height_ |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #width() == width_ |
|
- #height() == height_ |
|
- #top() == top() |
|
- #left() == left() |
|
- i.e. The location of the upper left corner of this widget stays the |
|
same but its width and height are modified |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='is_selected'></a>is_selected</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> index |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- index < size() |
|
ensures |
|
- if (the item given by index is currently selected) then |
|
- returns true |
|
- else |
|
- returns false |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='select'></a>select</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> index |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- index < size() |
|
ensures |
|
- #is_selected(index) == true |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='unselect'></a>unselect</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> index |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- index < size() |
|
ensures |
|
- #is_selected(index) == false |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='get_selected'></a>get_selected</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> list |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- T == an implementation of dlib/queue/queue_kernel_abstract.h |
|
- T::type == unsigned long |
|
ensures |
|
- #list == a list of all the currently selected indices for this list_box. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='get_selected'></a>get_selected</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- multiple_select_enabled() == false |
|
ensures |
|
- if (there is currently something selected) then |
|
- returns the index of the selected item |
|
- else |
|
- returns size() |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='load'></a>load</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> T<font color='#5555FF'>&</font> list |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- T == compatible with dlib::enumerable<std::string> |
|
ensures |
|
- #size() == list.size() |
|
- Copies all the strings from list into *this in the order in which they are enumerated. |
|
(i.e. The first one goes into (*this)[0], the second into (*this)[1], and so on...) |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b>[] <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> index |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- index < size() |
|
ensures |
|
- returns the name of the indexth item/row in this list box. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='multiple_select_enabled'></a>multiple_select_enabled</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- if (this object will allow the user to select more than one item at a time) then |
|
- returns true |
|
- else |
|
- returns false |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='enable_multiple_select'></a>enable_multiple_select</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #multiple_select_enabled() == true |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='disable_multiple_select'></a>disable_multiple_select</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #multiple_select_enabled() == false |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_double_click_handler'></a>set_double_click_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> index<font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T. |
|
ensures |
|
- The event_handler function is called on object when the user double |
|
clicks on one of the rows in this list box. index gives the row |
|
number for the item the user clicked. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_double_click_handler'></a>set_double_click_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> index<font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- The event_handler function is called when the user double clicks on |
|
one of the rows in this list box. index gives the row number for |
|
the item the user clicked. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_click_handler'></a>set_click_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> index<font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T. |
|
ensures |
|
- The event_handler function is called on object when the user |
|
clicks on one of the rows in this list box. index gives the row |
|
number for the item the user clicked. (Note that the second click |
|
in a double click triggers the double click handler above instead |
|
of this event) |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_click_handler'></a>set_click_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> index<font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- The event_handler function is called when the user clicks on one |
|
of the rows in this list box. index gives the row number for the |
|
item the user clicked. (Note that the second click in a double |
|
click triggers the double click handler above instead of this event) |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='list_box'></a>list_box</b><font face='Lucida Console'>(</font>list_box<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> list_box<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>list_box<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#0000FF'>class</font> <b><a name='wlist_box'></a>wlist_box</b> : <font color='#0000FF'>public</font> scrollable_region, |
|
<font color='#0000FF'>public</font> enumerable<font color='#5555FF'><</font><font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>></font>; |
|
<font color='#009900'>/*! |
|
same as list_box except for std::wstring instead of std::string |
|
!*/</font> |
|
|
|
<font color='#0000FF'>class</font> <b><a name='ulist_box'></a>ulist_box</b> : <font color='#0000FF'>public</font> scrollable_region, |
|
<font color='#0000FF'>public</font> enumerable<font color='#5555FF'><</font><font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>></font>; |
|
<font color='#009900'>/*! |
|
same as list_box except for dlib::ustring instead of std::string |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> <font color='#009900'>// class menu_bar |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font><font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='menu_bar'></a>menu_bar</b> : <font color='#0000FF'>public</font> drawable |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
- number_of_menus() == 0 |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a menu bar that appears at the top of a |
|
window. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='menu_bar'></a>menu_bar</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='menu_bar'></a>menu_bar</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_number_of_menus'></a>set_number_of_menus</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> num |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #number_of_menus() == num |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='number_of_menus'></a>number_of_menus</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the number of menus in this menu_bar |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_menu_name'></a>set_menu_name</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx, <font color='#0000FF'>const</font> std::wstring name, <font color='#0000FF'><u>char</u></font> underline_ch <font color='#5555FF'>=</font> '<font color='#FF0000'>\0</font>'<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_menu_name'></a>set_menu_name</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx, <font color='#0000FF'>const</font> dlib::ustring name, <font color='#0000FF'><u>char</u></font> underline_ch <font color='#5555FF'>=</font> '<font color='#FF0000'>\0</font>'<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_menu_name'></a>set_menu_name</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx, |
|
<font color='#0000FF'>const</font> std::string name, |
|
<font color='#0000FF'><u>char</u></font> underline_ch <font color='#5555FF'>=</font> '<font color='#FF0000'>\0</font>' |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- idx < number_of_menus() |
|
ensures |
|
- #menu_name(idx) == name |
|
- if (underline_ch is present in name) then |
|
- The menu with index idx will have the first underline_ch character |
|
in its name underlined and users will be able to activate the menu |
|
by hitting alt+underline_char |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> std::wstring <b><a name='menu_wname'></a>menu_wname</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> dlib::ustring <b><a name='menu_uname'></a>menu_uname</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::string <b><a name='menu_name'></a>menu_name</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- idx < number_of_menus() |
|
ensures |
|
- returns the name of the menu with index idx |
|
!*/</font> |
|
|
|
popup_menu<font color='#5555FF'>&</font> <b><a name='menu'></a>menu</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- idx < number_of_menus() |
|
ensures |
|
- returns a non-const reference to the popup_menu for the menu with |
|
index idx. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> popup_menu<font color='#5555FF'>&</font> <b><a name='menu'></a>menu</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- idx < number_of_menus() |
|
ensures |
|
- returns a const reference to the popup_menu for the menu with |
|
index idx. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='menu_bar'></a>menu_bar</b><font face='Lucida Console'>(</font>menu_bar<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> menu_bar<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>menu_bar<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> |
|
<b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> graph_type |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'>class</font> <b><a name='directed_graph_drawer'></a>directed_graph_drawer</b> : <font color='#0000FF'>public</font> zoomable_region |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
REQUIREMENTS ON graph_type |
|
- must be an implementation of directed_graph/directed_graph_kernel_abstract.h |
|
|
|
INITIAL VALUE |
|
- get_graph().size() == 0 |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a graphical widget that allows the user to draw |
|
a directed graph. |
|
|
|
The user can create nodes by right clicking on the draw area and add |
|
edges by selecting a node (via left clicking on it) and then holding |
|
shift and clicking on the node that is to be the child node of the |
|
selected node. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='directed_graph_drawer'></a>directed_graph_drawer</b> <font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='directed_graph_drawer'></a>directed_graph_drawer</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> graph_type<font color='#5555FF'>&</font> <b><a name='graph'></a>graph</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- drawable::m is locked |
|
ensures |
|
- returns a const reference to the graph that this widget has been drawing |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='number_of_nodes'></a>number_of_nodes</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns graph().number_of_nodes() |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='clear_graph'></a>clear_graph</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #number_of_nodes() == 0 |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> <font color='#0000FF'>typename</font> graph_type::node_type<font color='#5555FF'>&</font> <b><a name='graph_node'></a>graph_node</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- drawable::m is locked |
|
- i < number_of_nodes() |
|
ensures |
|
- returns a const reference to get_graph().node(i) |
|
!*/</font> |
|
|
|
<font color='#0000FF'>typename</font> graph_type::node_type<font color='#5555FF'>&</font> <b><a name='graph_node'></a>graph_node</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- drawable::m is locked |
|
- i < number_of_nodes() |
|
ensures |
|
- returns a non-const reference to get_graph().node(i) |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='save_graph'></a>save_graph</b> <font face='Lucida Console'>(</font> |
|
std::ostream<font color='#5555FF'>&</font> out |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- saves the state of the graph to the output stream. Does so in a |
|
way that not only preserves the state of the graph this->graph() |
|
but also preserves the graphical layout of the graph in this |
|
GUI widget. |
|
- Also, the first part of the saved state is a serialized |
|
version of this->graph(). Thus, you can deserialize just the |
|
this->graph() object from the serialized data if you like. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='load_graph'></a>load_graph</b> <font face='Lucida Console'>(</font> |
|
std::istream<font color='#5555FF'>&</font> in |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- loads a saved graph from the given input stream. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_node_label'></a>set_node_label</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i, <font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&</font> label<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_node_label'></a>set_node_label</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i, <font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&</font> label<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_node_label'></a>set_node_label</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> label |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- i < number_of_nodes() |
|
ensures |
|
- #node_label(i) == label |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_node_color'></a>set_node_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i, |
|
rgb_pixel color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- i < number_of_nodes() |
|
ensures |
|
- #node_color(i) == color |
|
!*/</font> |
|
|
|
rgb_pixel <b><a name='node_color'></a>node_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- i < number_of_nodes() |
|
ensures |
|
- returns the color used to draw node graph_node(i) |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> std::wstring <b><a name='node_wlabel'></a>node_wlabel</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> dlib::ustring <b><a name='node_ulabel'></a>node_ulabel</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::string <b><a name='node_label'></a>node_label</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- i < number_of_nodes() |
|
ensures |
|
- returns the text label for node graph_node(i) |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_node_selected_handler'></a>set_node_selected_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> node_index<font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when the user selects |
|
a node. |
|
- node_index == the index of the node that was selected |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_node_selected_handler'></a>set_node_selected_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> node_index<font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when the user selects |
|
a node. |
|
- node_index == the index of the node that was selected |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_node_deselected_handler'></a>set_node_deselected_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> node_index<font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when the user |
|
deselects a node. |
|
- node_index == the index of the node that was deselected |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_node_deselected_handler'></a>set_node_deselected_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> node_index<font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when the user deselects a node. |
|
- node_index == the index of the node that was deselected |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_node_deleted_handler'></a>set_node_deleted_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when the user |
|
deletes a node. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_node_deleted_handler'></a>set_node_deleted_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when the user deletes a node. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_graph_modified_handler'></a>set_graph_modified_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when the user |
|
modifies the graph (i.e. adds or removes a node or edge) |
|
- the event_handler function is not called when the user just |
|
moves nodes around on the screen. |
|
- This event is always dispatched before any more specific event |
|
that results from the user modifying the graph. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_graph_modified_handler'></a>set_graph_modified_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when the user modifies |
|
the graph (i.e. adds or removes a node or edge) |
|
- the event_handler function is not called when the user just |
|
moves nodes around on the screen. |
|
- This event is always dispatched before any more specific event |
|
that results from the user modifying the graph. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='directed_graph_drawer'></a>directed_graph_drawer</b><font face='Lucida Console'>(</font>directed_graph_drawer<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> directed_graph_drawer<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>directed_graph_drawer<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='text_grid'></a>text_grid</b> : <font color='#0000FF'>public</font> scrollable_region |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
- vertical_scroll_increment() == 10 |
|
- horizontal_scroll_increment() == 10 |
|
- border_color() == rgb_pixel(128,128,128) |
|
- number_of_columns() == 0 |
|
- number_of_rows() == 0 |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a simple grid of square text fields that |
|
looks more or less like a spreadsheet grid. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='text_grid'></a>text_grid</b> <font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
throws |
|
- std::bad_alloc |
|
- dlib::thread_error |
|
!*/</font> |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='text_grid'></a>text_grid</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_grid_size'></a>set_grid_size</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> rows, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> cols |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #number_of_rows() == rows |
|
- #number_of_columns() == cols |
|
- for all valid r and c: |
|
- #text(r,c) == "" |
|
- #text_color(r,c) == rgb_pixel(0,0,0) |
|
- #background_color(r,c) == rgb_pixel(255,255,255) |
|
- #is_editable(r,c) == true |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='number_of_columns'></a>number_of_columns</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the number of columns contained in this grid |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='number_of_rows'></a>number_of_rows</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the number of rows contained in this grid |
|
!*/</font> |
|
|
|
rgb_pixel <b><a name='border_color'></a>border_color</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the color of the lines drawn between the grid elements |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_border_color'></a>set_border_color</b> <font face='Lucida Console'>(</font> |
|
rgb_pixel color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #border_color() == color |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> std::wstring <b><a name='wtext'></a>wtext</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> dlib::ustring <b><a name='utext'></a>utext</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#0000FF'>const</font> std::string <b><a name='text'></a>text</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- row < number_of_rows() |
|
- col < number_of_columns() |
|
ensures |
|
- returns the text in the given grid location |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col, <font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&</font> str<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col, <font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&</font> str<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text'></a>set_text</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> str |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- row < number_of_rows() |
|
- col < number_of_columns() |
|
ensures |
|
- #text(row,col) == str |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> rgb_pixel <b><a name='text_color'></a>text_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- row < number_of_rows() |
|
- col < number_of_columns() |
|
ensures |
|
- returns the color of the text in the given grid location |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text_color'></a>set_text_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col, |
|
<font color='#0000FF'>const</font> rgb_pixel color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- row < number_of_rows() |
|
- col < number_of_columns() |
|
ensures |
|
- #text_color(row,col) == color |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> rgb_pixel <b><a name='background_color'></a>background_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- row < number_of_rows() |
|
- col < number_of_columns() |
|
ensures |
|
- returns the background color of the given grid location |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_background_color'></a>set_background_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col, |
|
<font color='#0000FF'>const</font> rgb_pixel color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- row < number_of_rows() |
|
- col < number_of_columns() |
|
ensures |
|
- #background_color(row,col) == color |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='is_editable'></a>is_editable</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- row < number_of_rows() |
|
- col < number_of_columns() |
|
ensures |
|
- if (the given grid location is editable by the user) then |
|
- returns true |
|
- else |
|
- returns false |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_editable'></a>set_editable</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col, |
|
<font color='#0000FF'><u>bool</u></font> editable |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- row < number_of_rows() |
|
- col < number_of_columns() |
|
ensures |
|
- #is_editable(row,col) == editable |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_column_width'></a>set_column_width</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- col < number_of_columns() |
|
ensures |
|
- the given column will be displayed such that it is width pixels wide |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_row_height'></a>set_row_height</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> height |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- row < number_of_rows() |
|
ensures |
|
- the given row will be displayed such that it is height pixels wide |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text_modified_handler'></a>set_text_modified_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col<font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when the user selects |
|
a node. |
|
- row == row will give the row of the grid item that was modified |
|
- col == col will give the column of the grid item that was modified |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_text_modified_handler'></a>set_text_modified_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> row, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> col<font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- the event_handler function is called when the user selects a node. |
|
- row == row will give the row of the grid item that was modified |
|
- col == col will give the column of the grid item that was modified |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='text_grid'></a>text_grid</b><font face='Lucida Console'>(</font>text_grid<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> text_grid<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>text_grid<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='image_display'></a>image_display</b> : <font color='#0000FF'>public</font> scrollable_region |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
- This object isn't displaying anything. |
|
- get_overlay_rects().size() == 0 |
|
- get_default_overlay_rect_label() == "" |
|
- get_default_overlay_rect_color() == rgb_alpha_pixel(255,0,0,255) (i.e. RED) |
|
- This object does not have any user labelable parts defined. |
|
- overlay_editing_is_enabled() == true |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents an image inside a scrollable region. |
|
You give it an image to display by calling set_image(). |
|
This widget also allows you to add rectangle and line overlays that |
|
will be drawn on top of the image. |
|
|
|
If you hold the Ctrl key you can zoom in and out using the mouse wheel. |
|
You can also add new overlay rectangles by holding shift, left clicking, |
|
and dragging the mouse. Additionally, you can delete an overlay rectangle |
|
by double clicking on it and hitting delete or backspace. Finally, you |
|
can also add part labels (if they have been defined by calling add_labelable_part_name()) |
|
by selecting an overlay rectangle with the mouse and then right clicking |
|
on the part. If you want to move any rectangle or an object part then |
|
shift+right click and drag it. Alternatively, if you haven't added any |
|
part labels via add_labelable_part_name() you can add parts to a rectangle |
|
by simply shift left clicking while it's selected. This will add parts |
|
with integer names and the integer names begin with 0 and increase. This |
|
feature is only activated if the rectangle has no parts or all the parts |
|
are already integer names. |
|
|
|
Finally, if you hold Ctrl and left click an overlay rectangle it will |
|
change its label to get_default_overlay_rect_label() and color to |
|
get_default_overlay_rect_color(). |
|
|
|
The image is drawn such that: |
|
- the pixel img[0][0] is the upper left corner of the image. |
|
- the pixel img[img.nr()-1][0] is the lower left corner of the image. |
|
- the pixel img[0][img.nc()-1] is the upper right corner of the image. |
|
- the pixel img[img.nr()-1][img.nc()-1] is the lower right corner of the image. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='image_display'></a>image_display</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
!*/</font> |
|
|
|
~<b><a name='image_display'></a>image_display</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> image_type |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_image'></a>set_image</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> image_type<font color='#5555FF'>&</font> new_img |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- image_type == an implementation of array2d/array2d_kernel_abstract.h or |
|
a dlib::matrix or something convertible to a matrix via mat() |
|
- pixel_traits<typename image_type::type> must be defined |
|
ensures |
|
- #*this widget is now displaying the given image new_img. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>struct</font> <b><a name='overlay_rect'></a>overlay_rect</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a rectangle that is drawn on top of the |
|
image shown by this object. Each rectangle is represented by |
|
a rectangle object as well as a color and text label. The label |
|
is drawn below the lower right corner of the rectangle. |
|
|
|
Moreover, the rectangle can have sub-parts. Each part is listed |
|
in the parts member variable. This variable maps the name of the |
|
part to its position. |
|
|
|
Rectangles with crossed_out == true will be drawn with an X through |
|
them. |
|
!*/</font> |
|
|
|
rectangle rect; |
|
rgb_alpha_pixel color; |
|
std::string label; |
|
std::map<font color='#5555FF'><</font>std::string,point<font color='#5555FF'>></font> parts; |
|
<font color='#0000FF'><u>bool</u></font> crossed_out; |
|
|
|
<b><a name='overlay_rect'></a>overlay_rect</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #color == rgb_alpha_pixel(0,0,0,0) |
|
- #rect == rectangle() |
|
- #label.size() == 0 |
|
- #crossed_out == false |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<b><a name='overlay_rect'></a>overlay_rect</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&</font> r, |
|
pixel_type p |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #rect == r |
|
- performs assign_pixel(color, p) |
|
- #label.size() == 0 |
|
- #crossed_out == false |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<b><a name='overlay_rect'></a>overlay_rect</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&</font> r, |
|
pixel_type p, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> l |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #rect == r |
|
- performs assign_pixel(color, p) |
|
- #label == l |
|
- #crossed_out == false |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<b><a name='overlay_rect'></a>overlay_rect</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&</font> r, |
|
pixel_type p, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> l, |
|
<font color='#0000FF'>const</font> std::map<font color='#5555FF'><</font>std::string,point<font color='#5555FF'>></font><font color='#5555FF'>&</font> parts_ |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #rect == r |
|
- performs assign_pixel(color, p) |
|
- #label == l |
|
- #parts == parts_ |
|
- #crossed_out == false |
|
!*/</font> |
|
|
|
<b>}</b>; |
|
|
|
<font color='#0000FF'>struct</font> <b><a name='overlay_line'></a>overlay_line</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a line that is drawn on top of the |
|
image shown by this object. Each line is represented by |
|
its two end points (p1 and p2) as well as a color. |
|
!*/</font> |
|
|
|
dpoint p1; |
|
dpoint p2; |
|
rgb_alpha_pixel color; |
|
|
|
<b><a name='overlay_line'></a>overlay_line</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #color == rgb_alpha_pixel(0,0,0,0) |
|
- #p1 == point() |
|
- #p2 == point() |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<b><a name='overlay_line'></a>overlay_line</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> dpoint<font color='#5555FF'>&</font> p1_, |
|
<font color='#0000FF'>const</font> dpoint<font color='#5555FF'>&</font> p2_, |
|
pixel_type p |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- performs assign_pixel(color, p) |
|
- #p1 == p1_ |
|
- #p2 == p2_ |
|
!*/</font> |
|
|
|
<b>}</b>; |
|
|
|
<font color='#0000FF'>struct</font> <b><a name='overlay_circle'></a>overlay_circle</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a circle that is drawn on top of the |
|
image shown by this object. Each circle is represented by |
|
its center, radius, and color. It can also have an optional |
|
text label which will appear below the circle. |
|
!*/</font> |
|
|
|
point center; |
|
<font color='#0000FF'><u>int</u></font> radius; |
|
rgb_alpha_pixel color; |
|
std::string label; |
|
|
|
<b><a name='overlay_circle'></a>overlay_circle</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #center == point(0,0) |
|
- #radius == 0 |
|
- #color == rgb_alpha_pixel(0,0,0,0) |
|
- #label.size() == 0 |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<b><a name='overlay_circle'></a>overlay_circle</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point<font color='#5555FF'>&</font> center_, |
|
<font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> radius_, |
|
pixel_type p |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- performs assign_pixel(color, p) |
|
- #center == center_ |
|
- #radius == radius_ |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<b><a name='overlay_circle'></a>overlay_circle</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point<font color='#5555FF'>&</font> center_, |
|
<font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> radius_, |
|
pixel_type p, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> label_ |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- performs assign_pixel(color, p) |
|
- #center == center_ |
|
- #radius == radius_ |
|
- #label == label_ |
|
!*/</font> |
|
|
|
<b>}</b>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> overlay_rect<font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given overlay rectangle into this object such |
|
that it will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> overlay_line<font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given overlay line into this object such |
|
that it will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> overlay_circle<font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given overlay circle into this object such |
|
that it will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>overlay_rect<font color='#5555FF'>></font><font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given set of overlay rectangles into this object such |
|
that they will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>overlay_line<font color='#5555FF'>></font><font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given set of overlay lines into this object such |
|
that they will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>overlay_circle<font color='#5555FF'>></font><font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given set of overlay circles into this object such |
|
that they will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='clear_overlay'></a>clear_overlay</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- removes all overlays from this object. |
|
- #get_overlay_rects().size() == 0 |
|
!*/</font> |
|
|
|
std::vector<font color='#5555FF'><</font>overlay_rect<font color='#5555FF'>></font> <b><a name='get_overlay_rects'></a>get_overlay_rects</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns a copy of all the overlay_rect objects currently displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_default_overlay_rect_label'></a>set_default_overlay_rect_label</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> label |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #get_default_overlay_rect_label() == label |
|
!*/</font> |
|
|
|
std::string <b><a name='get_default_overlay_rect_label'></a>get_default_overlay_rect_label</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the label given to new overlay rectangles created by the user |
|
(i.e. when the user holds shift and adds them with the mouse) |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_default_overlay_rect_color'></a>set_default_overlay_rect_color</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rgb_alpha_pixel<font color='#5555FF'>&</font> color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #get_default_overlay_rect_color() == color |
|
!*/</font> |
|
|
|
rgb_alpha_pixel <b><a name='get_default_overlay_rect_color'></a>get_default_overlay_rect_color</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the color given to new overlay rectangles created by the user |
|
(i.e. when the user holds shift and adds them with the mouse) |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_labelable_part_name'></a>add_labelable_part_name</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> name |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds a user labelable part with the given name. If the name has |
|
already been added then this function has no effect. |
|
- These parts can be added by the user by selecting an overlay box |
|
and then right clicking anywhere in it. A popup menu will appear |
|
listing the parts. The user can then click a part name and it will |
|
add it into the overlay_rect::parts variable and also show it on the |
|
screen. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='clear_labelable_part_names'></a>clear_labelable_part_names</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- removes all use labelable parts. Calling this function undoes |
|
all previous calls to add_labelable_part_name(). Therefore, the |
|
user won't be able to label any parts after clear_labelable_part_names() |
|
is called. |
|
!*/</font> |
|
|
|
rectangle <b><a name='get_image_display_rect'></a>get_image_display_rect</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns a rectangle R that tells you how big the image inside the |
|
display is when it appears on the screen. Note that it takes the |
|
current zoom level into account. |
|
- R.width() == the width of the displayed image |
|
- R.height() == the height of the displayed image |
|
- R.tl_corner() == (0,0) |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='enable_overlay_editing'></a>enable_overlay_editing</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #overlay_editing_is_enabled() == true |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='disable_overlay_editing'></a>disable_overlay_editing</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #overlay_editing_is_enabled() == false |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='overlay_editing_is_enabled'></a>overlay_editing_is_enabled</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- if this function returns true then it is possible for the user to add or |
|
remove overlay objects (e.g. rectangles) using the mouse and keyboard. |
|
If it returns false then the overlay is not user editable. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='zoom_in'></a>zoom_in</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- performs a zoom in as if the user tried to zoom by scrolling the mouse wheel. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='zoom_out'></a>zoom_out</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- performs a zoom out as if the user tried to zoom by scrolling the mouse wheel. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_overlay_rects_changed_handler'></a>set_overlay_rects_changed_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/* |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- the event_handler function is called on object when the user adds, |
|
removes, or modifies an overlay rectangle. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_overlay_rects_changed_handler'></a>set_overlay_rects_changed_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/* |
|
ensures |
|
- the event_handler function is called when the user adds or removes |
|
an overlay rectangle. |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_overlay_rect_selected_handler'></a>set_overlay_rect_selected_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> overlay_rect<font color='#5555FF'>&</font> orect<font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/* |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- The event_handler function is called on object when the user selects |
|
an overlay rectangle by double clicking on it. The selected rectangle |
|
will be passed to event_handler(). |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_overlay_rect_selected_handler'></a>set_overlay_rect_selected_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> overlay_rect<font color='#5555FF'>&</font> orect<font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/* |
|
ensures |
|
- The event_handler function is called when the user selects an overlay |
|
rectangle by double clicking on it. The selected rectangle will be |
|
passed to event_handler(). |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> |
|
<font color='#0000FF'>typename</font> T |
|
<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_image_clicked_handler'></a>set_image_clicked_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> point<font color='#5555FF'>&</font> p, <font color='#0000FF'><u>bool</u></font> is_double_click, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn<font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/* |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- The event_handler function is called on object when the user left clicks |
|
anywhere on the image. When they do so this callback is called with the |
|
location of the image pixel which was clicked. The is_double_click bool |
|
will also tell you if it was a double click or single click. |
|
- btn == the button that was released. (either base_window::LEFT, base_window::MIDDLE, or base_window::RIGHT) |
|
- any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
throws |
|
- std::bad_alloc |
|
*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_image_clicked_handler'></a>set_image_clicked_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> point<font color='#5555FF'>&</font> p, <font color='#0000FF'><u>bool</u></font> is_double_click, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn<font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/* |
|
ensures |
|
- The event_handler function is called when the user left clicks anywhere |
|
on the image. When they do so this callback is called with the location |
|
of the image pixel which was clicked. The is_double_click bool will also |
|
tell you if it was a double click or single click. |
|
- btn == the button that was released. (either base_window::LEFT, base_window::MIDDLE, or base_window::RIGHT) |
|
- Any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this event at a |
|
time) |
|
throws |
|
- std::bad_alloc |
|
*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='image_display'></a>image_display</b><font face='Lucida Console'>(</font>image_display<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> image_display<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>image_display<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> <b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='image_window'></a>image_window</b> : <font color='#0000FF'>public</font> drawable_window |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
- initially, this object is visible on the screen |
|
- events_tied() == false |
|
|
|
WHAT THIS OBJECT REPRESENTS |
|
This is a simple window that is just a container for an image_display. |
|
It exists to make it easy to throw image_displays onto the screen |
|
without having to put together your own drawable_window objects. |
|
!*/</font> |
|
<font color='#0000FF'>public</font>: |
|
|
|
<font color='#0000FF'>typedef</font> image_display::overlay_rect overlay_rect; |
|
<font color='#0000FF'>typedef</font> image_display::overlay_line overlay_line; |
|
<font color='#0000FF'>typedef</font> image_display::overlay_circle overlay_circle; |
|
|
|
<b><a name='image_window'></a>image_window</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- this object is properly initialized |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> image_type<font color='#5555FF'>></font> |
|
<b><a name='image_window'></a>image_window</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> image_type<font color='#5555FF'>&</font> img |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- image_type == an implementation of array2d/array2d_kernel_abstract.h or |
|
a dlib::matrix or something convertible to a matrix via mat() |
|
- pixel_traits<typename image_type::type> must be defined |
|
ensures |
|
- this object is properly initialized |
|
- #*this window is now displaying the given image img. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> <font color='#0000FF'>typename</font> image_type<font color='#5555FF'>></font> |
|
<b><a name='image_window'></a>image_window</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> image_type<font color='#5555FF'>&</font> img, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> title |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- image_type == an implementation of array2d/array2d_kernel_abstract.h or |
|
a dlib::matrix or something convertible to a matrix via mat() |
|
- pixel_traits<typename image_type::type> must be defined |
|
ensures |
|
- this object is properly initialized |
|
- #*this window is now displaying the given image img. |
|
- The title of the window will be set to the given title string. |
|
!*/</font> |
|
|
|
~<b><a name='image_window'></a>image_window</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- any resources associated with this object have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> image_type<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_image'></a>set_image</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> image_type<font color='#5555FF'>&</font> img |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- image_type == an implementation of array2d/array2d_kernel_abstract.h |
|
- pixel_traits<typename image_type::type> must be defined |
|
ensures |
|
- #*this window is now displaying the given image img. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> overlay_rect<font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given overlay rectangle into this object such |
|
that it will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&</font> r, |
|
pixel_type p <font color='#5555FF'>=</font> <font color='#BB00BB'>rgb_pixel</font><font face='Lucida Console'>(</font><font color='#979000'>255</font>,<font color='#979000'>0</font>,<font color='#979000'>0</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- performs: add_overlay(overlay_rect(r,p)); |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&</font> r, |
|
pixel_type p, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> l |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- performs: add_overlay(overlay_rect(r,p,l)); |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>rectangle<font color='#5555FF'>></font><font color='#5555FF'>&</font> r, |
|
pixel_type p <font color='#5555FF'>=</font> <font color='#BB00BB'>rgb_pixel</font><font face='Lucida Console'>(</font><font color='#979000'>255</font>,<font color='#979000'>0</font>,<font color='#979000'>0</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given set of rectangles into this object such |
|
that they will be displayed with the color specific by p. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> full_object_detection<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>std::string<font color='#5555FF'>></font><font color='#5555FF'>&</font> part_names |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given full_object_detection to the overlays |
|
and shows it on the screen. This includes any of its |
|
parts that are not set equal to OBJECT_PART_NOT_PRESENT. |
|
- for all valid i < part_names.size(): |
|
- the part object.part(i) will be labeled with the string |
|
part_names[i]. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> full_object_detection<font color='#5555FF'>&</font> object |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given full_object_detection to the overlays |
|
and shows it on the screen. This includes any of its |
|
parts that are not set equal to OBJECT_PART_NOT_PRESENT. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>full_object_detection<font color='#5555FF'>></font><font color='#5555FF'>&</font> objects, |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>std::string<font color='#5555FF'>></font><font color='#5555FF'>&</font> part_names |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- calling this function is equivalent to calling the following |
|
sequence of functions, for all valid i: |
|
- add_overlay(objects[i], part_names); |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>full_object_detection<font color='#5555FF'>></font><font color='#5555FF'>&</font> objects |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- calling this function is equivalent to calling the following |
|
sequence of functions, for all valid i: |
|
- add_overlay(objects[i]); |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> overlay_line<font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given overlay line into this object such |
|
that it will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> line<font color='#5555FF'>&</font> l, |
|
pixel_type p |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- performs: add_overlay(overlay_line(l.p1(),l.p2(),p)); |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> overlay_circle<font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given overlay circle into this object such |
|
that it will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point<font color='#5555FF'>&</font> p1, |
|
<font color='#0000FF'>const</font> point<font color='#5555FF'>&</font> p2, |
|
pixel_type p |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- performs: add_overlay(overlay_line(p1,p2,p)); |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>overlay_rect<font color='#5555FF'>></font><font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given set of overlay rectangles into this object such |
|
that they will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>overlay_line<font color='#5555FF'>></font><font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given set of overlay lines into this object such |
|
that they will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>overlay_circle<font color='#5555FF'>></font><font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- adds the given set of overlay circles into this object such |
|
that they will be displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='clear_overlay'></a>clear_overlay</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- removes all overlays from this object. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='tie_events'></a>tie_events</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #events_tied() == true |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='untie_events'></a>untie_events</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #events_tied() == false |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='events_tied'></a>events_tied</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns true if and only if the get_next_double_click() and |
|
get_next_keypress() events are tied together. If they are tied it means |
|
that you can use a loop of the following form to listen for both events |
|
simultaneously: |
|
while (mywindow.get_next_double_click(p) || mywindow.get_next_keypress(key,printable)) |
|
{ |
|
if (p.x() < 0) |
|
// Do something with the keyboard event |
|
else |
|
// Do something with the mouse event |
|
} |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='get_next_double_click'></a>get_next_double_click</b> <font face='Lucida Console'>(</font> |
|
point<font color='#5555FF'>&</font> p |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This function blocks until the user double clicks on the image or the |
|
window is closed by the user. It will also unblock for a keyboard key |
|
press if events_tied() == true. |
|
- if (this function returns true) then |
|
- This means the user double clicked the mouse. |
|
- #p == the next image pixel the user clicked. |
|
- else |
|
- #p == point(-1,1) |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='get_next_double_click'></a>get_next_double_click</b> <font face='Lucida Console'>(</font> |
|
point<font color='#5555FF'>&</font> p, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font color='#5555FF'>&</font> mouse_button |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This function blocks until the user double clicks on the image or the |
|
window is closed by the user. It will also unblock for a keyboard key |
|
press if events_tied() == true. |
|
- if (this function returns true) then |
|
- This means the user double clicked the mouse. |
|
- #p == the next image pixel the user clicked. |
|
- #mouse_button == the mouse button which was used to double click. |
|
This will be either dlib::base_window::LEFT, |
|
dlib::base_window::MIDDLE, or dlib::base_window::RIGHT |
|
- else |
|
- #p == point(-1,1) |
|
(Note that this point is outside any possible image) |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='get_next_keypress'></a>get_next_keypress</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font color='#5555FF'>&</font> key, |
|
<font color='#0000FF'><u>bool</u></font><font color='#5555FF'>&</font> is_printable, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font color='#5555FF'>&</font> state |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This function blocks until the user presses a keyboard key or the |
|
window is closed by the user. It will also unblock for a mouse double |
|
click if events_tied() == true. |
|
- if (this function returns true) then |
|
- This means the user pressed a keyboard key. |
|
- The keyboard button press is recorded into #key, #is_printable, and |
|
#state. In particular, these variables are populated with the three |
|
identically named arguments to the base_window::on_keydown(key,is_printable,state) |
|
event. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>bool</u></font> <b><a name='get_next_keypress'></a>get_next_keypress</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font color='#5555FF'>&</font> key, |
|
<font color='#0000FF'><u>bool</u></font><font color='#5555FF'>&</font> is_printable |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This function blocks until the user presses a keyboard key or the |
|
window is closed by the user. It will also unblock for a mouse double |
|
click if events_tied() == true. |
|
- This function is the equivalent to calling get_next_keypress(key,is_printable,temp) |
|
and then discarding temp. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='image_window'></a>image_window</b><font face='Lucida Console'>(</font>image_window<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; |
|
image_window<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>image_window<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; |
|
<b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='perspective_display'></a>perspective_display</b> : <font color='#0000FF'>public</font> drawable, noncopyable |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This object is a tool for displaying 3D point clouds on a screen. You can |
|
navigate the display with the mouse. Left click and drag rotates the |
|
camera around the displayed data. Scrolling the mouse wheel zooms and |
|
shift+left click (or just right click) and drag pans the view around. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='perspective_display'></a>perspective_display</b><font face='Lucida Console'>(</font> |
|
drawable_window<font color='#5555FF'>&</font> w |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #*this is properly initialized |
|
- #*this has been added to window w |
|
- #parent_window() == w |
|
!*/</font> |
|
|
|
~<b><a name='perspective_display'></a>perspective_display</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- all resources associated with *this have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_size'></a>set_size</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width, |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> height |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #width() == width |
|
- #height() == height |
|
- #top() == top() |
|
- #left() == left() |
|
- i.e. The location of the upper left corner of this widget stays the |
|
same but its width and height are modified. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>struct</font> <b><a name='overlay_line'></a>overlay_line</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a line that is drawn on the screen. Each line |
|
is represented by its two end points (p1 and p2) as well as a color. |
|
!*/</font> |
|
|
|
<b><a name='overlay_line'></a>overlay_line</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>assign_pixel</font><font face='Lucida Console'>(</font>color, <font color='#979000'>0</font><font face='Lucida Console'>)</font>;<b>}</b> |
|
|
|
<b><a name='overlay_line'></a>overlay_line</b><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p1_, <font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p2_<font face='Lucida Console'>)</font> |
|
: p1<font face='Lucida Console'>(</font>p1_<font face='Lucida Console'>)</font>, p2<font face='Lucida Console'>(</font>p2_<font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>assign_pixel</font><font face='Lucida Console'>(</font>color, <font color='#979000'>255</font><font face='Lucida Console'>)</font>; <b>}</b> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<b><a name='overlay_line'></a>overlay_line</b><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p1_, <font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p2_, pixel_type p<font face='Lucida Console'>)</font> |
|
: p1<font face='Lucida Console'>(</font>p1_<font face='Lucida Console'>)</font>, p2<font face='Lucida Console'>(</font>p2_<font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>assign_pixel</font><font face='Lucida Console'>(</font>color, p<font face='Lucida Console'>)</font>; <b>}</b> |
|
|
|
vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> p1; |
|
vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> p2; |
|
rgb_pixel color; |
|
<b>}</b>; |
|
|
|
<font color='#0000FF'>struct</font> <b><a name='overlay_dot'></a>overlay_dot</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This object represents a dot that is drawn on the screen. Each dot is |
|
represented by one point and a color. |
|
!*/</font> |
|
|
|
<b><a name='overlay_dot'></a>overlay_dot</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>assign_pixel</font><font face='Lucida Console'>(</font>color, <font color='#979000'>0</font><font face='Lucida Console'>)</font>;<b>}</b> |
|
|
|
<b><a name='overlay_dot'></a>overlay_dot</b><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p_<font face='Lucida Console'>)</font> |
|
: p<font face='Lucida Console'>(</font>p_<font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>assign_pixel</font><font face='Lucida Console'>(</font>color, <font color='#979000'>255</font><font face='Lucida Console'>)</font>; <b>}</b> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<b><a name='overlay_dot'></a>overlay_dot</b><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p_, pixel_type color_<font face='Lucida Console'>)</font> |
|
: p<font face='Lucida Console'>(</font>p_<font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>assign_pixel</font><font face='Lucida Console'>(</font>color, color_<font face='Lucida Console'>)</font>; <b>}</b> |
|
|
|
vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> p; <font color='#009900'>// The location of the dot |
|
</font> rgb_pixel color; |
|
<b>}</b>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>overlay_line<font color='#5555FF'>></font><font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Adds the given overlay lines into this object such that it will be |
|
displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>overlay_dot<font color='#5555FF'>></font><font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Adds the given overlay dots into this object such that it will be |
|
displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='clear_overlay'></a>clear_overlay</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Removes all overlays from this object. The display will be empty. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_dot_double_clicked_handler'></a>set_dot_double_clicked_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/* |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- The event_handler function is called on object when the user double |
|
clicks on one of the overlay dots. The selected dot will be passed to |
|
event_handler(). |
|
- Any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_dot_double_clicked_handler'></a>set_dot_double_clicked_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/* |
|
ensures |
|
- The event_handler function is called when the user double clicks on one |
|
of the overlay dots. The selected dot will be passed to event_handler(). |
|
- Any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
*/</font> |
|
<b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='perspective_window'></a>perspective_window</b> : <font color='#0000FF'>public</font> drawable_window, noncopyable |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This is a simple window that is just a container for a perspective_display. |
|
It exists to make it easy to throw perspective_displays onto the screen |
|
without having to put together your own drawable_window objects. |
|
!*/</font> |
|
<font color='#0000FF'>public</font>: |
|
|
|
<font color='#0000FF'>typedef</font> perspective_display::overlay_line overlay_line; |
|
<font color='#0000FF'>typedef</font> perspective_display::overlay_dot overlay_dot; |
|
|
|
<b><a name='perspective_window'></a>perspective_window</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- The window is displayed on the screen and is 100x100 pixels in size. |
|
!*/</font> |
|
|
|
<b><a name='perspective_window'></a>perspective_window</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> <font color='#5555FF'>></font><font color='#5555FF'>&</font> point_cloud |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- The window is displayed on the screen and is 100x100 pixels in size. |
|
- This window will have point_cloud added to it via add_overlay() and the |
|
points will all be white. |
|
!*/</font> |
|
|
|
<b><a name='perspective_window'></a>perspective_window</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> <font color='#5555FF'>></font><font color='#5555FF'>&</font> point_cloud, |
|
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> title |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- The window is displayed on the screen and is 100x100 pixels in size. |
|
- This window will have point_cloud added to it via add_overlay() and the |
|
points will all be white. |
|
- The title of the window will be set to the given title string. |
|
!*/</font> |
|
|
|
~<b><a name='perspective_window'></a>perspective_window</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- any resources associated with this object have been released |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>overlay_line<font color='#5555FF'>></font><font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Adds the given overlay lines into this object such that it will be |
|
displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>overlay_dot<font color='#5555FF'>></font><font color='#5555FF'>&</font> overlay |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Adds the given overlay dots into this object such that it will be |
|
displayed. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='clear_overlay'></a>clear_overlay</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Removes all overlays from this object. The display will be empty. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> <font color='#5555FF'>></font><font color='#5555FF'>&</font> d |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Adds the given dots into this object such that it will be |
|
displayed. They will be colored white. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> <font color='#5555FF'>></font><font color='#5555FF'>&</font> d, |
|
pixel_type p |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Adds the given dots into this object such that it will be |
|
displayed. They will be colored by pixel color p. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> pixel_type<font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='add_overlay'></a>add_overlay</b><font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p1, |
|
<font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p2, |
|
pixel_type color |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Adds an overlay line going from p1 to p2 with the given color. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> <font color='#0000FF'>typename</font> T <font color='#5555FF'>></font> |
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_dot_double_clicked_handler'></a>set_dot_double_clicked_handler</b> <font face='Lucida Console'>(</font> |
|
T<font color='#5555FF'>&</font> object, |
|
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>event_handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font><font face='Lucida Console'>)</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/* |
|
requires |
|
- event_handler is a valid pointer to a member function in T |
|
ensures |
|
- The event_handler function is called on object when the user double |
|
clicks on one of the overlay dots. The selected dot will be passed to |
|
event_handler(). |
|
- Any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
*/</font> |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_dot_double_clicked_handler'></a>set_dot_double_clicked_handler</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> any_function<font color='#5555FF'><</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font><font face='Lucida Console'>)</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> event_handler |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/* |
|
ensures |
|
- The event_handler function is called when the user double clicks on one |
|
of the overlay dots. The selected dot will be passed to event_handler(). |
|
- Any previous calls to this function are overridden by this new call. |
|
(i.e. you can only have one event handler associated with this |
|
event at a time) |
|
*/</font> |
|
|
|
<b>}</b>; |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<b>}</b> |
|
|
|
<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_WIDGETs_ABSTRACT_ |
|
</font> |
|
|
|
</pre></body></html> |