AshanGimhana's picture
Upload folder using huggingface_hub
9375c9a verified
<html><!-- Created using the cpp_pretty_printer from the dlib C++ library. See http://dlib.net for updates. --><head><title>dlib C++ Library - base_widgets.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'>#ifndef</font> DLIB_BASE_WIDGETs_
<font color='#0000FF'>#define</font> DLIB_BASE_WIDGETs_
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>cctype<font color='#5555FF'>&gt;</font>
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>memory<font color='#5555FF'>&gt;</font>
<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='drawable.h.html'>drawable.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> "<a style='text-decoration:none' href='../algs.h.html'>../algs.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../member_function_pointer.h.html'>../member_function_pointer.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../timer.h.html'>../timer.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../map.h.html'>../map.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../set.h.html'>../set.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../array2d.h.html'>../array2d.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../pixel.h.html'>../pixel.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../image_transforms/assign_image.h.html'>../image_transforms/assign_image.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../array.h.html'>../array.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='style.h.html'>style.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../unicode.h.html'>../unicode.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../any.h.html'>../any.h</a>"
<font color='#0000FF'>namespace</font> dlib
<b>{</b>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font> <font color='#009900'>// class draggable
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='draggable'></a>draggable</b> : <font color='#0000FF'>public</font> drawable
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
- drag == false
CONVENTION
- if (the user is holding the left button down over this object) then
- drag == true
- x == the x position of the mouse relative to the upper left corner
of this object.
- y == the y position of the mouse relative to the upper left corner
of this object.
- else
- drag == false
!*/</font>
<font color='#0000FF'>public</font>:
<b><a name='draggable'></a>draggable</b><font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> events <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
drawable<font face='Lucida Console'>(</font>w,events <font color='#5555FF'>|</font> MOUSE_MOVE <font color='#5555FF'>|</font> MOUSE_CLICK<font face='Lucida Console'>)</font>,
drag<font face='Lucida Console'>(</font><font color='#979000'>false</font><font face='Lucida Console'>)</font>
<b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> ~<b><a name='draggable'></a>draggable</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
rectangle <b><a name='draggable_area'></a>draggable_area</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>; <font color='#0000FF'>return</font> area; <b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='set_draggable_area'></a>set_draggable_area</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> area_
<font face='Lucida Console'>)</font> <b>{</b> auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>; area <font color='#5555FF'>=</font> area_; <b>}</b>
<font color='#0000FF'>protected</font>:
<font color='#0000FF'><u>bool</u></font> <b><a name='is_being_dragged'></a>is_being_dragged</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> drag; <b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_drag'></a>on_drag</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font><b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_drag_stop'></a>on_drag_stop</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font><b>{</b><b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_move'></a>on_mouse_move</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_down'></a>on_mouse_down</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> ,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y,
<font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_up'></a>on_mouse_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>private</font>:
rectangle area;
<font color='#0000FF'><u>bool</u></font> drag;
<font color='#0000FF'><u>long</u></font> x, y;
<font color='#009900'>// restricted functions
</font> <b><a name='draggable'></a>draggable</b><font face='Lucida Console'>(</font>draggable<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> draggable<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>draggable<font color='#5555FF'>&amp;</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_over_event
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='mouse_over_event'></a>mouse_over_event</b> : <font color='#0000FF'>public</font> drawable
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
- is_mouse_over_ == false
CONVENTION
- is_mouse_over_ == is_mouse_over()
!*/</font>
<font color='#0000FF'>public</font>:
<b><a name='mouse_over_event'></a>mouse_over_event</b><font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> events <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
drawable<font face='Lucida Console'>(</font>w,events <font color='#5555FF'>|</font> MOUSE_MOVE<font face='Lucida Console'>)</font>,
is_mouse_over_<font face='Lucida Console'>(</font><font color='#979000'>false</font><font face='Lucida Console'>)</font>
<b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> ~<b><a name='mouse_over_event'></a>mouse_over_event</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
<font color='#0000FF'><u>int</u></font> <b><a name='next_free_user_event_number'></a>next_free_user_event_number</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'>return</font> drawable::<font color='#BB00BB'>next_free_user_event_number</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>1</font>;
<b>}</b>
<font color='#0000FF'>protected</font>:
<font color='#0000FF'><u>bool</u></font> <b><a name='is_mouse_over'></a>is_mouse_over</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_over'></a>on_mouse_over</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font><b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_not_over'></a>on_mouse_not_over</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font><b>{</b><b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_leave'></a>on_mouse_leave</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_move'></a>on_mouse_move</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_user_event'></a>on_user_event</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>int</u></font> num
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>private</font>:
<font color='#0000FF'>mutable</font> <font color='#0000FF'><u>bool</u></font> is_mouse_over_;
<font color='#009900'>// restricted functions
</font> <b><a name='mouse_over_event'></a>mouse_over_event</b><font face='Lucida Console'>(</font>mouse_over_event<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> mouse_over_event<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>mouse_over_event<font color='#5555FF'>&amp;</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 button_action
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='button_action'></a>button_action</b> : <font color='#0000FF'>public</font> mouse_over_event
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
- is_depressed_ == false
- seen_click == false
CONVENTION
- is_depressed_ == is_depressed()
- if (the user has clicked the button but hasn't yet released the
left mouse button) then
- seen_click == true
- else
- seen_click == false
!*/</font>
<font color='#0000FF'>public</font>:
<b><a name='button_action'></a>button_action</b><font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> events <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
mouse_over_event<font face='Lucida Console'>(</font>w,events <font color='#5555FF'>|</font> MOUSE_MOVE <font color='#5555FF'>|</font> MOUSE_CLICK<font face='Lucida Console'>)</font>,
is_depressed_<font face='Lucida Console'>(</font><font color='#979000'>false</font><font face='Lucida Console'>)</font>,
seen_click<font face='Lucida Console'>(</font><font color='#979000'>false</font><font face='Lucida Console'>)</font>
<b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> ~<b><a name='button_action'></a>button_action</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
<font color='#0000FF'><u>int</u></font> <b><a name='next_free_user_event_number'></a>next_free_user_event_number</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'>return</font> mouse_over_event::<font color='#BB00BB'>next_free_user_event_number</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>1</font>;
<b>}</b>
<font color='#0000FF'>protected</font>:
<font color='#0000FF'><u>bool</u></font> <b><a name='is_depressed'></a>is_depressed</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_button_down'></a>on_button_down</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font><b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_button_up'></a>on_button_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font><b>{</b><b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_not_over'></a>on_mouse_not_over</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_down'></a>on_mouse_down</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> ,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y,
<font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_move'></a>on_mouse_move</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_up'></a>on_mouse_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font>,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>private</font>:
<font color='#0000FF'>mutable</font> <font color='#0000FF'><u>bool</u></font> is_depressed_;
<font color='#0000FF'><u>bool</u></font> seen_click;
<font color='#0000FF'><u>void</u></font> <b><a name='on_user_event'></a>on_user_event</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>int</u></font> num
<font face='Lucida Console'>)</font>;
<font color='#009900'>// restricted functions
</font> <b><a name='button_action'></a>button_action</b><font face='Lucida Console'>(</font>button_action<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> button_action<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>button_action<font color='#5555FF'>&amp;</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 widget_group
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='widget_group'></a>widget_group</b> : <font color='#0000FF'>public</font> drawable
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
widgets.size() == 0
CONVENTION
- widgets contains all the drawable objects and their relative positions
that are in *this.
- wg_widgets contains pointers to just the widgets that happen
to be widget_group objects.
!*/</font>
<font color='#0000FF'>struct</font> <b><a name='relpos'></a>relpos</b>
<b>{</b>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> x;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> y;
<b>}</b>;
<font color='#0000FF'>public</font>:
<b><a name='widget_group'></a>widget_group</b><font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w
<font face='Lucida Console'>)</font> : drawable<font face='Lucida Console'>(</font>w<font face='Lucida Console'>)</font> <b>{</b> rect <font color='#5555FF'>=</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#5555FF'>-</font><font color='#979000'>1</font>,<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>; <font color='#BB00BB'>enable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;<b>}</b>
<font color='#0000FF'>virtual</font> ~<b><a name='widget_group'></a>widget_group</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font><b>{</b> <font color='#BB00BB'>disable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='empty'></a>empty</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='add'></a>add</b> <font face='Lucida Console'>(</font>
drawable<font color='#5555FF'>&amp;</font> widget,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='add'></a>add</b> <font face='Lucida Console'>(</font>
widget_group<font color='#5555FF'>&amp;</font> widget,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>bool</u></font> <b><a name='is_member'></a>is_member</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> drawable<font color='#5555FF'>&amp;</font> widget
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='remove'></a>remove</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> drawable<font color='#5555FF'>&amp;</font> widget
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>size_t</u></font> <b><a name='size'></a>size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_pos'></a>set_pos</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_z_order'></a>set_z_order</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> order
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='show'></a>show</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='hide'></a>hide</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='enable'></a>enable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='disable'></a>disable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</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='#0000FF'>protected</font>:
<font color='#009900'>// this object doesn't draw anything but also isn't abstract
</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw'></a>draw</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b><b>}</b>
<font color='#0000FF'>private</font>:
map<font color='#5555FF'>&lt;</font>drawable<font color='#5555FF'>*</font>,relpos<font color='#5555FF'>&gt;</font>::kernel_1a_c widgets;
set<font color='#5555FF'>&lt;</font>widget_group<font color='#5555FF'>*</font><font color='#5555FF'>&gt;</font>::kernel_1a_c wg_widgets;
<font color='#009900'>// restricted functions
</font> <b><a name='widget_group'></a>widget_group</b><font face='Lucida Console'>(</font>widget_group<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> widget_group<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>widget_group<font color='#5555FF'>&amp;</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_widget'></a>image_widget</b> : <font color='#0000FF'>public</font> draggable
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
- img.size() == 0
CONVENTION
- img == the image this object displays
!*/</font>
<font color='#0000FF'>public</font>:
<b><a name='image_widget'></a>image_widget</b><font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w
<font face='Lucida Console'>)</font>: draggable<font face='Lucida Console'>(</font>w<font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>enable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
~<b><a name='image_widget'></a>image_widget</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>disable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> image_type
<font color='#5555FF'>&gt;</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'>&amp;</font> new_img
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
<font color='#BB00BB'>assign_image_scaled</font><font face='Lucida Console'>(</font>img,new_img<font face='Lucida Console'>)</font>;
rectangle <font color='#BB00BB'>old</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>;
rect.<font color='#BB00BB'>set_right</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#BB00BB'>num_columns</font><font face='Lucida Console'>(</font>img<font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
rect.<font color='#BB00BB'>set_bottom</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#BB00BB'>num_rows</font><font face='Lucida Console'>(</font>img<font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>rect<font color='#5555FF'>+</font>old<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>private</font>:
<font color='#0000FF'><u>void</u></font> <b><a name='draw'></a>draw</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
rectangle area <font color='#5555FF'>=</font> rect.<font color='#BB00BB'>intersect</font><font face='Lucida Console'>(</font>c<font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>area.<font color='#BB00BB'>is_empty</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
<font color='#0000FF'>return</font>;
<font color='#BB00BB'>draw_image</font><font face='Lucida Console'>(</font>c, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>, img<font face='Lucida Console'>)</font>;
<b>}</b>
array2d<font color='#5555FF'>&lt;</font>rgb_alpha_pixel<font color='#5555FF'>&gt;</font> img;
<font color='#009900'>// restricted functions
</font> <b><a name='image_widget'></a>image_widget</b><font face='Lucida Console'>(</font>image_widget<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> image_widget<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>image_widget<font color='#5555FF'>&amp;</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 tooltip
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='tooltip'></a>tooltip</b> : <font color='#0000FF'>public</font> mouse_over_event
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
- stuff.get() == 0
- events_are_enabled() == false
CONVENTION
- if (events_are_enabled() == true) then
- stuff.get() != 0
!*/</font>
<font color='#0000FF'>public</font>:
<b><a name='tooltip'></a>tooltip</b><font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w
<font face='Lucida Console'>)</font> :
mouse_over_event<font face='Lucida Console'>(</font>w,MOUSE_CLICK<font face='Lucida Console'>)</font>
<b>{</b><b>}</b>
~<b><a name='tooltip'></a>tooltip</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font><b>{</b> <font color='#BB00BB'>disable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;<b>}</b>
<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>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
rect <font color='#5555FF'>=</font> <font color='#BB00BB'>resize_rect</font><font face='Lucida Console'>(</font>rect,width,height<font face='Lucida Console'>)</font>;
<b>}</b>
<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'>&amp;</font> str
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>set_text</font><font face='Lucida Console'>(</font><font color='#BB00BB'>convert_mbstring_to_wstring</font><font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<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'>&amp;</font> str
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>set_text</font><font face='Lucida Console'>(</font><font color='#BB00BB'>convert_wstring_to_utf32</font><font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<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> ustring<font color='#5555FF'>&amp;</font> str
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font>stuff<font face='Lucida Console'>)</font>
<b>{</b>
stuff.<font color='#BB00BB'>reset</font><font face='Lucida Console'>(</font><font color='#0000FF'>new</font> <font color='#BB00BB'>data</font><font face='Lucida Console'>(</font><font color='#5555FF'>*</font><font color='#0000FF'>this</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>enable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>win.<font color='#BB00BB'>set_text</font><font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font>;
<b>}</b>
<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>
<b>{</b>
<font color='#0000FF'>return</font> <font color='#BB00BB'>convert_wstring_to_mbstring</font><font face='Lucida Console'>(</font><font color='#BB00BB'>wtext</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<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>
<b>{</b>
<font color='#0000FF'>return</font> <font color='#BB00BB'>convert_utf32_to_wstring</font><font face='Lucida Console'>(</font><font color='#BB00BB'>utext</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<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>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
dlib::ustring temp;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>stuff<font face='Lucida Console'>)</font>
<b>{</b>
temp <font color='#5555FF'>=</font> stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>win.text;
<b>}</b>
<font color='#0000FF'>return</font> temp.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='hide'></a>hide</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
mouse_over_event::<font color='#BB00BB'>hide</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>stuff<font face='Lucida Console'>)</font>
<b>{</b>
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>tt_timer.<font color='#BB00BB'>stop</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>win.<font color='#BB00BB'>hide</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='disable'></a>disable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
mouse_over_event::<font color='#BB00BB'>disable</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>stuff<font face='Lucida Console'>)</font>
<b>{</b>
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>tt_timer.<font color='#BB00BB'>stop</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>win.<font color='#BB00BB'>hide</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<font color='#0000FF'>protected</font>:
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_over'></a>on_mouse_over</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
<b>{</b>
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>x <font color='#5555FF'>=</font> lastx;
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>y <font color='#5555FF'>=</font> lasty;
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>tt_timer.<font color='#BB00BB'>start</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_not_over'></a>on_mouse_not_over</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
<b>{</b>
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>tt_timer.<font color='#BB00BB'>stop</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>win.<font color='#BB00BB'>hide</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_down'></a>on_mouse_down</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y,
<font color='#0000FF'><u>bool</u></font> is_double_click
<font face='Lucida Console'>)</font>
<b>{</b>
mouse_over_event::<font color='#BB00BB'>on_mouse_down</font><font face='Lucida Console'>(</font>btn,state,x,y,is_double_click<font face='Lucida Console'>)</font>;
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>tt_timer.<font color='#BB00BB'>stop</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>win.<font color='#BB00BB'>hide</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='draw'></a>draw</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font><b>{</b><b>}</b>
<font color='#0000FF'>private</font>:
<font color='#0000FF'>class</font> <b><a name='tooltip_window'></a>tooltip_window</b> : <font color='#0000FF'>public</font> base_window
<b>{</b>
<font color='#0000FF'>public</font>:
<b><a name='tooltip_window'></a>tooltip_window</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::shared_ptr<font color='#5555FF'>&lt;</font>font<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> f<font face='Lucida Console'>)</font> : base_window<font face='Lucida Console'>(</font><font color='#979000'>false</font>,<font color='#979000'>true</font><font face='Lucida Console'>)</font>, pad<font face='Lucida Console'>(</font><font color='#979000'>3</font><font face='Lucida Console'>)</font>, mfont<font face='Lucida Console'>(</font>f<font face='Lucida Console'>)</font>
<b>{</b>
<b>}</b>
ustring text;
rectangle rect_all;
rectangle rect_text;
<font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> pad;
<font color='#0000FF'>const</font> std::shared_ptr<font color='#5555FF'>&lt;</font>font<font color='#5555FF'>&gt;</font> mfont;
<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'>&amp;</font> str
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>set_text</font><font face='Lucida Console'>(</font><font color='#BB00BB'>convert_mbstring_to_wstring</font><font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<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'>&amp;</font> str
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>set_text</font><font face='Lucida Console'>(</font><font color='#BB00BB'>convert_wstring_to_utf32</font><font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<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'>&amp;</font> str
<font face='Lucida Console'>)</font>
<b>{</b>
text <font color='#5555FF'>=</font> str.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width, height;
mfont<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>compute_size</font><font face='Lucida Console'>(</font>text,width,height<font face='Lucida Console'>)</font>;
<font color='#BB00BB'>set_size</font><font face='Lucida Console'>(</font>width<font color='#5555FF'>+</font>pad<font color='#5555FF'>*</font><font color='#979000'>2</font>, height<font color='#5555FF'>+</font>pad<font color='#5555FF'>*</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>;
rect_all.<font color='#BB00BB'>set_left</font><font face='Lucida Console'>(</font><font color='#979000'>0</font><font face='Lucida Console'>)</font>;
rect_all.<font color='#BB00BB'>set_top</font><font face='Lucida Console'>(</font><font color='#979000'>0</font><font face='Lucida Console'>)</font>;
rect_all.<font color='#BB00BB'>set_right</font><font face='Lucida Console'>(</font>width<font color='#5555FF'>+</font>pad<font color='#5555FF'>*</font><font color='#979000'>2</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
rect_all.<font color='#BB00BB'>set_bottom</font><font face='Lucida Console'>(</font>height<font color='#5555FF'>+</font>pad<font color='#5555FF'>*</font><font color='#979000'>2</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
rect_text <font color='#5555FF'>=</font> <font color='#BB00BB'>move_rect</font><font face='Lucida Console'>(</font><font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font>width,height<font face='Lucida Console'>)</font>,pad,pad<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='paint'></a>paint</b><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c<font face='Lucida Console'>)</font>
<b>{</b>
c.<font color='#BB00BB'>fill</font><font face='Lucida Console'>(</font><font color='#979000'>255</font>,<font color='#979000'>255</font>,<font color='#979000'>150</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>draw_rectangle</font><font face='Lucida Console'>(</font>c, rect_all<font face='Lucida Console'>)</font>;
mfont<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>draw_string</font><font face='Lucida Console'>(</font>c,rect_text,text<font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>;
<font color='#0000FF'><u>void</u></font> <b><a name='show_tooltip'></a>show_tooltip</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>long</u></font> x, y;
<font color='#009900'>// if the mouse has moved since we started the timer then
</font> <font color='#009900'>// keep waiting until the user stops moving it
</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>lastx <font color='#5555FF'>!</font><font color='#5555FF'>=</font> stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>x <font color='#5555FF'>|</font><font color='#5555FF'>|</font> lasty <font color='#5555FF'>!</font><font color='#5555FF'>=</font> stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>y<font face='Lucida Console'>)</font>
<b>{</b>
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>x <font color='#5555FF'>=</font> lastx;
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>y <font color='#5555FF'>=</font> lasty;
<font color='#0000FF'>return</font>;
<b>}</b>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> display_width, display_height;
<font color='#009900'>// stop the timer
</font> stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>tt_timer.<font color='#BB00BB'>stop</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
parent.<font color='#BB00BB'>get_pos</font><font face='Lucida Console'>(</font>x,y<font face='Lucida Console'>)</font>;
x <font color='#5555FF'>+</font><font color='#5555FF'>=</font> lastx<font color='#5555FF'>+</font><font color='#979000'>15</font>;
y <font color='#5555FF'>+</font><font color='#5555FF'>=</font> lasty<font color='#5555FF'>+</font><font color='#979000'>15</font>;
<font color='#009900'>// make sure the tooltip isn't going to be off the screen
</font> parent.<font color='#BB00BB'>get_display_size</font><font face='Lucida Console'>(</font>display_width, display_height<font face='Lucida Console'>)</font>;
rectangle <font color='#BB00BB'>wrect</font><font face='Lucida Console'>(</font><font color='#BB00BB'>move_rect</font><font face='Lucida Console'>(</font>stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>win.rect_all,x,y<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
rectangle <font color='#BB00BB'>srect</font><font face='Lucida Console'>(</font>display_width, display_height<font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>srect.<font color='#BB00BB'>contains</font><font face='Lucida Console'>(</font>wrect<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>false</font><font face='Lucida Console'>)</font>
<b>{</b>
rectangle <font color='#BB00BB'>temp</font><font face='Lucida Console'>(</font>srect.<font color='#BB00BB'>intersect</font><font face='Lucida Console'>(</font>wrect<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
x <font color='#5555FF'>-</font><font color='#5555FF'>=</font> wrect.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>temp.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
y <font color='#5555FF'>-</font><font color='#5555FF'>=</font> wrect.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>temp.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>win.<font color='#BB00BB'>set_pos</font><font face='Lucida Console'>(</font>x,y<font face='Lucida Console'>)</font>;
stuff<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font>win.<font color='#BB00BB'>show</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#009900'>// put all this stuff in data so we can arrange to only
</font> <font color='#009900'>// construct it when someone is actually using the tooltip widget
</font> <font color='#009900'>// rather than just instantiating it.
</font> <font color='#0000FF'>struct</font> <b><a name='data'></a>data</b>
<b>{</b>
<b><a name='data'></a>data</b><font face='Lucida Console'>(</font>
tooltip<font color='#5555FF'>&amp;</font> self
<font face='Lucida Console'>)</font> :
x<font face='Lucida Console'>(</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>,
y<font face='Lucida Console'>(</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>,
win<font face='Lucida Console'>(</font>self.mfont<font face='Lucida Console'>)</font>,
tt_timer<font face='Lucida Console'>(</font>self,<font color='#5555FF'>&amp;</font>tooltip::show_tooltip<font face='Lucida Console'>)</font>
<b>{</b>
tt_timer.<font color='#BB00BB'>set_delay_time</font><font face='Lucida Console'>(</font><font color='#979000'>400</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>long</u></font> x, y;
tooltip_window win;
timer<font color='#5555FF'>&lt;</font>tooltip<font color='#5555FF'>&gt;</font> tt_timer;
<b>}</b>;
<font color='#0000FF'>friend</font> <font color='#0000FF'>struct</font> data;
std::unique_ptr<font color='#5555FF'>&lt;</font>data<font color='#5555FF'>&gt;</font> stuff;
<font color='#009900'>// restricted functions
</font> <b><a name='tooltip'></a>tooltip</b><font face='Lucida Console'>(</font>tooltip<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> tooltip<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>tooltip<font color='#5555FF'>&amp;</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 button
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='button'></a>button</b> : <font color='#0000FF'>public</font> button_action
<b>{</b>
<font color='#0000FF'>public</font>:
<b><a name='button'></a>button</b><font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w
<font face='Lucida Console'>)</font> :
button_action<font face='Lucida Console'>(</font>w<font face='Lucida Console'>)</font>,
btn_tooltip<font face='Lucida Console'>(</font>w<font face='Lucida Console'>)</font>
<b>{</b>
style.<font color='#BB00BB'>reset</font><font face='Lucida Console'>(</font><font color='#0000FF'>new</font> <font color='#BB00BB'>button_style_default</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>enable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
~<b><a name='button'></a>button</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>disable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>get_invalidation_rect</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>; <b>}</b>
<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='#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'>&amp;</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::wstring<font color='#5555FF'>&amp;</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'>&amp;</font> name_
<font face='Lucida Console'>)</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='#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'><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'>&amp;</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::wstring<font color='#5555FF'>&amp;</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'>&amp;</font> text
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_pos'></a>set_pos</b><font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</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='#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> 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'><u>void</u></font> <b><a name='set_main_font'></a>set_main_font</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> std::shared_ptr<font color='#5555FF'>&lt;</font>font<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> f
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='show'></a>show</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='hide'></a>hide</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='enable'></a>enable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='disable'></a>disable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> style_type
<font color='#5555FF'>&gt;</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'>&amp;</font> style_
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
style.<font color='#BB00BB'>reset</font><font face='Lucida Console'>(</font><font color='#0000FF'>new</font> <font color='#BB00BB'>style_type</font><font face='Lucida Console'>(</font>style_<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
rect <font color='#5555FF'>=</font> <font color='#BB00BB'>move_rect</font><font face='Lucida Console'>(</font>style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>get_min_size</font><font face='Lucida Console'>(</font>name_,<font color='#5555FF'>*</font>mfont<font face='Lucida Console'>)</font>, rect.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>get_invalidation_rect</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> T
<font color='#5555FF'>&gt;</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'>&amp;</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>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
event_handler <font color='#5555FF'>=</font> <font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object,event_handler_<font face='Lucida Console'>)</font>;
event_handler_self.<font color='#BB00BB'>clear</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<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'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> event_handler_
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
event_handler <font color='#5555FF'>=</font> event_handler_;
event_handler_self.<font color='#BB00BB'>clear</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> T
<font color='#5555FF'>&gt;</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'>&amp;</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>button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
event_handler_self <font color='#5555FF'>=</font> <font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object,event_handler_<font face='Lucida Console'>)</font>;
event_handler.<font color='#BB00BB'>clear</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<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'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font>button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> event_handler_
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
event_handler_self <font color='#5555FF'>=</font> event_handler_;
event_handler.<font color='#BB00BB'>clear</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>bool</u></font> <b><a name='is_depressed'></a>is_depressed</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
<font color='#0000FF'>return</font> button_action::<font color='#BB00BB'>is_depressed</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> T
<font color='#5555FF'>&gt;</font>
<font color='#0000FF'><u>void</u></font> <b><a name='set_button_down_handler'></a>set_button_down_handler</b> <font face='Lucida Console'>(</font>
T<font color='#5555FF'>&amp;</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>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
button_down_handler <font color='#5555FF'>=</font> <font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object,event_handler<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='set_button_down_handler'></a>set_button_down_handler</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> event_handler
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
button_down_handler <font color='#5555FF'>=</font> event_handler;
<b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> T
<font color='#5555FF'>&gt;</font>
<font color='#0000FF'><u>void</u></font> <b><a name='set_button_up_handler'></a>set_button_up_handler</b> <font face='Lucida Console'>(</font>
T<font color='#5555FF'>&amp;</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>bool</u></font> mouse_over<font face='Lucida Console'>)</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
button_up_handler <font color='#5555FF'>=</font> <font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object,event_handler<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='set_button_up_handler'></a>set_button_up_handler</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>bool</u></font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> event_handler
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
button_up_handler <font color='#5555FF'>=</font> event_handler;
<b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> T
<font color='#5555FF'>&gt;</font>
<font color='#0000FF'><u>void</u></font> <b><a name='set_button_down_handler'></a>set_button_down_handler</b> <font face='Lucida Console'>(</font>
T<font color='#5555FF'>&amp;</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>button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
button_down_handler_self <font color='#5555FF'>=</font> <font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object,event_handler<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='set_sourced_button_down_handler'></a>set_sourced_button_down_handler</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font>button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> event_handler
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
button_down_handler_self <font color='#5555FF'>=</font> event_handler;
<b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> T
<font color='#5555FF'>&gt;</font>
<font color='#0000FF'><u>void</u></font> <b><a name='set_button_up_handler'></a>set_button_up_handler</b> <font face='Lucida Console'>(</font>
T<font color='#5555FF'>&amp;</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>bool</u></font> mouse_over, button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
button_up_handler_self <font color='#5555FF'>=</font> <font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object,event_handler<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='set_sourced_button_up_handler'></a>set_sourced_button_up_handler</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>bool</u></font>,button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> event_handler
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
button_up_handler_self <font color='#5555FF'>=</font> event_handler;
<b>}</b>
<font color='#0000FF'>private</font>:
<font color='#009900'>// restricted functions
</font> <b><a name='button'></a>button</b><font face='Lucida Console'>(</font>button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> button<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator
</font>
dlib::ustring name_;
tooltip btn_tooltip;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> event_handler;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font>button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> event_handler_self;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> button_down_handler;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>bool</u></font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> button_up_handler;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font>button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> button_down_handler_self;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>bool</u></font>,button<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> button_up_handler_self;
std::unique_ptr<font color='#5555FF'>&lt;</font>button_style<font color='#5555FF'>&gt;</font> style;
<font color='#0000FF'>protected</font>:
<font color='#0000FF'><u>void</u></font> <b><a name='draw'></a>draw</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>draw_button</font><font face='Lucida Console'>(</font>c,rect,enabled,<font color='#5555FF'>*</font>mfont,lastx,lasty,name_,<font color='#BB00BB'>is_depressed</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_button_up'></a>on_button_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>bool</u></font> mouse_over
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_button_down'></a>on_button_down</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_over'></a>on_mouse_over</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font><b>{</b> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>redraw_on_mouse_over</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>get_invalidation_rect</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_not_over'></a>on_mouse_not_over</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font><b>{</b> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>redraw_on_mouse_over</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>get_invalidation_rect</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>; <b>}</b>
<b>}</b>;
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font> <font color='#009900'>// class scroll_bar
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='scroll_bar'></a>scroll_bar</b> : <font color='#0000FF'>public</font> drawable
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
- ori == a value given by the constructor
- style == a scroll_bar_style_default object
- pos == 0
- max_pos == 0
- js == 10
CONVENTION
- ori == orientation()
- b1 == the button that is near the 0 end of the scroll bar
- b2 == the button that is near the max_pos() end of the scroll bar
- max_pos == max_slider_pos()
- pos == slider_pos()
- js == jump_size()
!*/</font>
<font color='#0000FF'>public</font>:
<font color='#0000FF'>enum</font> <b><a name='bar_orientation'></a>bar_orientation</b>
<b>{</b>
HORIZONTAL,
VERTICAL
<b>}</b>;
<b><a name='scroll_bar'></a>scroll_bar</b><font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w,
bar_orientation orientation_
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>virtual</font> ~<b><a name='scroll_bar'></a>scroll_bar</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
bar_orientation <b><a name='orientation'></a>orientation</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_length'></a>set_length</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> length
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>long</u></font> <b><a name='max_slider_pos'></a>max_slider_pos</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_max_slider_pos'></a>set_max_slider_pos</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> mpos
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_slider_pos'></a>set_slider_pos</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> pos
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>long</u></font> <b><a name='slider_pos'></a>slider_pos</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> T
<font color='#5555FF'>&gt;</font>
<font color='#0000FF'><u>void</u></font> <b><a name='set_scroll_handler'></a>set_scroll_handler</b> <font face='Lucida Console'>(</font>
T<font color='#5555FF'>&amp;</font> object,
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>eh<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
<font face='Lucida Console'>)</font> <b>{</b> auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>; scroll_handler <font color='#5555FF'>=</font> <font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object,eh<font face='Lucida Console'>)</font>; <b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='set_scroll_handler'></a>set_scroll_handler</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> eh
<font face='Lucida Console'>)</font> <b>{</b> auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>; scroll_handler <font color='#5555FF'>=</font> eh; <b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='set_pos'></a>set_pos</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='enable'></a>enable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font>hidden<font face='Lucida Console'>)</font>
<font color='#BB00BB'>show_slider</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>max_pos <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
<b>{</b>
b1.<font color='#BB00BB'>enable</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
b2.<font color='#BB00BB'>enable</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
drawable::<font color='#BB00BB'>enable</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='disable'></a>disable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
<font color='#BB00BB'>hide_slider</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
b1.<font color='#BB00BB'>disable</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
b2.<font color='#BB00BB'>disable</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
drawable::<font color='#BB00BB'>disable</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='hide'></a>hide</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
<font color='#BB00BB'>hide_slider</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
top_filler.<font color='#BB00BB'>hide</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
bottom_filler.<font color='#BB00BB'>hide</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
b1.<font color='#BB00BB'>hide</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
b2.<font color='#BB00BB'>hide</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
drawable::<font color='#BB00BB'>hide</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='show'></a>show</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
b1.<font color='#BB00BB'>show</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
b2.<font color='#BB00BB'>show</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
drawable::<font color='#BB00BB'>show</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
top_filler.<font color='#BB00BB'>show</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>enabled<font face='Lucida Console'>)</font>
<font color='#BB00BB'>show_slider</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='set_z_order'></a>set_z_order</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> order
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
slider.<font color='#BB00BB'>set_z_order</font><font face='Lucida Console'>(</font>order<font face='Lucida Console'>)</font>;
top_filler.<font color='#BB00BB'>set_z_order</font><font face='Lucida Console'>(</font>order<font face='Lucida Console'>)</font>;
bottom_filler.<font color='#BB00BB'>set_z_order</font><font face='Lucida Console'>(</font>order<font face='Lucida Console'>)</font>;
b1.<font color='#BB00BB'>set_z_order</font><font face='Lucida Console'>(</font>order<font face='Lucida Console'>)</font>;
b2.<font color='#BB00BB'>set_z_order</font><font face='Lucida Console'>(</font>order<font face='Lucida Console'>)</font>;
drawable::<font color='#BB00BB'>set_z_order</font><font face='Lucida Console'>(</font>order<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='set_jump_size'></a>set_jump_size</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> js
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>long</u></font> <b><a name='jump_size'></a>jump_size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> style_type
<font color='#5555FF'>&gt;</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'>&amp;</font> style_
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
style.<font color='#BB00BB'>reset</font><font face='Lucida Console'>(</font><font color='#0000FF'>new</font> <font color='#BB00BB'>style_type</font><font face='Lucida Console'>(</font>style_<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>ori <font color='#5555FF'>=</font><font color='#5555FF'>=</font> HORIZONTAL<font face='Lucida Console'>)</font>
<b>{</b>
b1.<font color='#BB00BB'>set_style</font><font face='Lucida Console'>(</font>style_.<font color='#BB00BB'>get_left_button_style</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
b2.<font color='#BB00BB'>set_style</font><font face='Lucida Console'>(</font>style_.<font color='#BB00BB'>get_right_button_style</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>set_length</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>else</font>
<b>{</b>
b1.<font color='#BB00BB'>set_style</font><font face='Lucida Console'>(</font>style_.<font color='#BB00BB'>get_up_button_style</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
b2.<font color='#BB00BB'>set_style</font><font face='Lucida Console'>(</font>style_.<font color='#BB00BB'>get_down_button_style</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>set_length</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<font color='#0000FF'>private</font>:
<font color='#0000FF'><u>void</u></font> <b><a name='hide_slider'></a>hide_slider</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
ensures
- hides the slider and makes any other changes needed so that the
scroll_bar still looks right.
!*/</font>
<font color='#0000FF'><u>void</u></font> <b><a name='show_slider'></a>show_slider</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
ensures
- shows the slider and makes any other changes needed so that the
scroll_bar still looks right.
!*/</font>
<font color='#0000FF'><u>void</u></font> <b><a name='on_slider_drag'></a>on_slider_drag</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
requires
- is called whenever the user drags the slider
!*/</font>
<font color='#0000FF'><u>void</u></font> <b><a name='draw'></a>draw</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='b1_down'></a>b1_down</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='b1_up'></a>b1_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>bool</u></font> mouse_over
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='b2_down'></a>b2_down</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='b2_up'></a>b2_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>bool</u></font> mouse_over
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='top_filler_down'></a>top_filler_down</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='top_filler_up'></a>top_filler_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>bool</u></font> mouse_over
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='bottom_filler_down'></a>bottom_filler_down</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='bottom_filler_up'></a>bottom_filler_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>bool</u></font> mouse_over
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_user_event'></a>on_user_event</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>int</u></font> i
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='delayed_set_slider_pos'></a>delayed_set_slider_pos</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> dpos
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='b1_down_t'></a>b1_down_t</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='b2_down_t'></a>b2_down_t</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='top_filler_down_t'></a>top_filler_down_t</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='bottom_filler_down_t'></a>bottom_filler_down_t</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>friend</font> <font color='#0000FF'>class</font> filler;
<font color='#0000FF'>class</font> <b><a name='filler'></a>filler</b> : <font color='#0000FF'>public</font> button_action
<b>{</b>
<font color='#0000FF'>friend</font> <font color='#0000FF'>class</font> scroll_bar;
<font color='#0000FF'>public</font>:
<b><a name='filler'></a>filler</b> <font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w,
scroll_bar<font color='#5555FF'>&amp;</font> object,
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>scroll_bar::<font color='#5555FF'>*</font>down<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>scroll_bar::<font color='#5555FF'>*</font>up<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>bool</u></font><font face='Lucida Console'>)</font>
<font face='Lucida Console'>)</font>:
button_action<font face='Lucida Console'>(</font>w<font face='Lucida Console'>)</font>,
my_scroll_bar<font face='Lucida Console'>(</font>object<font face='Lucida Console'>)</font>
<b>{</b>
bup <font color='#5555FF'>=</font> <font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object,up<font face='Lucida Console'>)</font>;
bdown <font color='#5555FF'>=</font> <font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object,down<font face='Lucida Console'>)</font>;
<font color='#BB00BB'>enable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
~<b><a name='filler'></a>filler</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>disable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<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>
<b>{</b>
rectangle <font color='#BB00BB'>old</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>;
<font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> x <font color='#5555FF'>=</font> rect.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> y <font color='#5555FF'>=</font> rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
rect.<font color='#BB00BB'>set_right</font><font face='Lucida Console'>(</font>x<font color='#5555FF'>+</font>width<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
rect.<font color='#BB00BB'>set_bottom</font><font face='Lucida Console'>(</font>y<font color='#5555FF'>+</font>height<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>rect<font color='#5555FF'>+</font>old<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>private</font>:
<font color='#0000FF'><u>void</u></font> <b><a name='draw'></a>draw</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
my_scroll_bar.style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>draw_scroll_bar_background</font><font face='Lucida Console'>(</font>c,rect,enabled,lastx,lasty,<font color='#BB00BB'>is_depressed</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_button_down'></a>on_button_down</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>bdown</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_button_up'></a>on_button_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>bool</u></font> mouse_over
<font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>bup</font><font face='Lucida Console'>(</font>mouse_over<font face='Lucida Console'>)</font>; <b>}</b>
scroll_bar<font color='#5555FF'>&amp;</font> my_scroll_bar;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> bdown;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font color='#0000FF'><u>bool</u></font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> bup;
<b>}</b>;
<font color='#0000FF'>friend</font> <font color='#0000FF'>class</font> slider_class;
<font color='#0000FF'>class</font> <b><a name='slider_class'></a>slider_class</b> : <font color='#0000FF'>public</font> draggable
<b>{</b>
<font color='#0000FF'>friend</font> <font color='#0000FF'>class</font> scroll_bar;
<font color='#0000FF'>public</font>:
<b><a name='slider_class'></a>slider_class</b> <font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w,
scroll_bar<font color='#5555FF'>&amp;</font> object,
<font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>scroll_bar::<font color='#5555FF'>*</font>handler<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
<font face='Lucida Console'>)</font> :
draggable<font face='Lucida Console'>(</font>w, MOUSE_MOVE<font face='Lucida Console'>)</font>,
mouse_in_widget<font face='Lucida Console'>(</font><font color='#979000'>false</font><font face='Lucida Console'>)</font>,
my_scroll_bar<font face='Lucida Console'>(</font>object<font face='Lucida Console'>)</font>
<b>{</b>
callback <font color='#5555FF'>=</font> <font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object,handler<font face='Lucida Console'>)</font>;
<font color='#BB00BB'>enable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
~<b><a name='slider_class'></a>slider_class</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>disable_events</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<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>
<b>{</b>
rectangle <font color='#BB00BB'>old</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>;
<font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> x <font color='#5555FF'>=</font> rect.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> y <font color='#5555FF'>=</font> rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
rect.<font color='#BB00BB'>set_right</font><font face='Lucida Console'>(</font>x<font color='#5555FF'>+</font>width<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
rect.<font color='#BB00BB'>set_bottom</font><font face='Lucida Console'>(</font>y<font color='#5555FF'>+</font>height<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>rect<font color='#5555FF'>+</font>old<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>private</font>:
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_move'></a>on_mouse_move</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>
<b>{</b>
draggable::<font color='#BB00BB'>on_mouse_move</font><font face='Lucida Console'>(</font>state,x,y<font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font>hidden <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> my_scroll_bar.style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>redraw_on_mouse_over_slider</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
<b>{</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>contains</font><font face='Lucida Console'>(</font>x,y<font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#5555FF'>!</font>mouse_in_widget<font face='Lucida Console'>)</font>
<b>{</b>
mouse_in_widget <font color='#5555FF'>=</font> <font color='#979000'>true</font>;
parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>contains</font><font face='Lucida Console'>(</font>x,y<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>false</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> mouse_in_widget<font face='Lucida Console'>)</font>
<b>{</b>
mouse_in_widget <font color='#5555FF'>=</font> <font color='#979000'>false</font>;
parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_leave'></a>on_mouse_leave</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>mouse_in_widget <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> my_scroll_bar.style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>redraw_on_mouse_over_slider</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
<b>{</b>
mouse_in_widget <font color='#5555FF'>=</font> <font color='#979000'>false</font>;
parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_drag_stop'></a>on_drag_stop</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>my_scroll_bar.style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>redraw_on_mouse_over_slider</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
parent.<font color='#BB00BB'>invalidate_rectangle</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='on_drag'></a>on_drag</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>callback</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='draw'></a>draw</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
my_scroll_bar.style<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>draw_scroll_bar_slider</font><font face='Lucida Console'>(</font>c,rect,enabled,lastx,lasty, <font color='#BB00BB'>is_being_dragged</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>bool</u></font> mouse_in_widget;
scroll_bar<font color='#5555FF'>&amp;</font> my_scroll_bar;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> callback;
<b>}</b>;
<font color='#0000FF'><u>void</u></font> <b><a name='adjust_fillers'></a>adjust_fillers</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
ensures
- top_filler and bottom_filler appear in their correct positions
relative to the current positions of the slider and the b1 and
b2 buttons
!*/</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='get_slider_size'></a>get_slider_size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#009900'>/*!
ensures
- returns the length in pixels the slider should have based on the current
state of this scroll bar
!*/</font>
button b1, b2;
slider_class slider;
bar_orientation ori;
filler top_filler, bottom_filler;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> scroll_handler;
<font color='#0000FF'><u>long</u></font> pos;
<font color='#0000FF'><u>long</u></font> max_pos;
<font color='#0000FF'><u>long</u></font> js;
timer<font color='#5555FF'>&lt;</font>scroll_bar<font color='#5555FF'>&gt;</font> b1_timer;
timer<font color='#5555FF'>&lt;</font>scroll_bar<font color='#5555FF'>&gt;</font> b2_timer;
timer<font color='#5555FF'>&lt;</font>scroll_bar<font color='#5555FF'>&gt;</font> top_filler_timer;
timer<font color='#5555FF'>&lt;</font>scroll_bar<font color='#5555FF'>&gt;</font> bottom_filler_timer;
<font color='#0000FF'><u>long</u></font> delayed_pos;
std::unique_ptr<font color='#5555FF'>&lt;</font>scroll_bar_style<font color='#5555FF'>&gt;</font> style;
<font color='#009900'>// restricted functions
</font> <b><a name='scroll_bar'></a>scroll_bar</b><font face='Lucida Console'>(</font>scroll_bar<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> scroll_bar<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>scroll_bar<font color='#5555FF'>&amp;</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 popup_menu
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='menu_item'></a>menu_item</b>
<b>{</b>
<font color='#0000FF'>public</font>:
<font color='#0000FF'>virtual</font> ~<b><a name='menu_item'></a>menu_item</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> rectangle <b><a name='get_left_size'></a>get_left_size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#0000FF'>virtual</font> rectangle <b><a name='get_middle_size'></a>get_middle_size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
<font color='#0000FF'>virtual</font> rectangle <b><a name='get_right_size'></a>get_right_size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#0000FF'>virtual</font> unichar <b><a name='get_hot_key'></a>get_hot_key</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font color='#979000'>0</font>; <b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_background'></a>draw_background</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> ,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_left'></a>draw_left</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> ,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_middle'></a>draw_middle</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> ,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_right'></a>draw_right</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> ,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_click'></a>on_click</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b><b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>bool</u></font> <b><a name='has_click_event'></a>has_click_event</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font color='#979000'>false</font>; <b>}</b>
<b>}</b>;
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='menu_item_submenu'></a>menu_item_submenu</b> : <font color='#0000FF'>public</font> menu_item
<b>{</b>
<font color='#0000FF'><u>void</u></font> <b><a name='initialize'></a>initialize</b> <font face='Lucida Console'>(</font>
unichar hk
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#0000FF'>const</font> dlib::ustring <font color='#5555FF'>&amp;</font>str <font color='#5555FF'>=</font> text;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>hk <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
<b>{</b>
std::string::size_type pos <font color='#5555FF'>=</font> str.<font color='#BB00BB'>find_first_of</font><font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>pos <font color='#5555FF'>!</font><font color='#5555FF'>=</font> std::string::npos<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#009900'>// now compute the location of the underline bar
</font> rectangle r1 <font color='#5555FF'>=</font> f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>compute_cursor_rect</font><font face='Lucida Console'>(</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font color='#979000'>100000</font>,<font color='#979000'>100000</font><font face='Lucida Console'>)</font>, str, pos<font face='Lucida Console'>)</font>;
rectangle r2 <font color='#5555FF'>=</font> f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>compute_cursor_rect</font><font face='Lucida Console'>(</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font color='#979000'>100000</font>,<font color='#979000'>100000</font><font face='Lucida Console'>)</font>, str, pos<font color='#5555FF'>+</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
underline_p1.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> r1.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>1</font>;
underline_p2.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> r2.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font>;
underline_p1.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> r1.<font color='#BB00BB'>bottom</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>ascender</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>2</font>;
underline_p2.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> r2.<font color='#BB00BB'>bottom</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>ascender</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>2</font>;
<b>}</b>
<b>}</b>
<b>}</b>
<font color='#0000FF'>public</font>:
<b><a name='menu_item_submenu'></a>menu_item_submenu</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> str,
unichar hk <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
text<font face='Lucida Console'>(</font>convert_wstring_to_utf32<font face='Lucida Console'>(</font>convert_mbstring_to_wstring<font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
f<font face='Lucida Console'>(</font>default_font::get_font<font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
hotkey<font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>initialize</font><font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>;
<b>}</b>
<b><a name='menu_item_submenu'></a>menu_item_submenu</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&amp;</font> str,
unichar hk <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
text<font face='Lucida Console'>(</font>convert_wstring_to_utf32<font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
f<font face='Lucida Console'>(</font>default_font::get_font<font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
hotkey<font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>initialize</font><font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>;
<b>}</b>
<b><a name='menu_item_submenu'></a>menu_item_submenu</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&amp;</font> str,
unichar hk <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
text<font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font>,
f<font face='Lucida Console'>(</font>default_font::get_font<font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
hotkey<font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>initialize</font><font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>virtual</font> unichar <b><a name='get_hot_key'></a>get_hot_key</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> hotkey; <b>}</b>
<font color='#0000FF'>virtual</font> rectangle <b><a name='get_middle_size'></a>get_middle_size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width, height;
f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>compute_size</font><font face='Lucida Console'>(</font>text,width,height<font face='Lucida Console'>)</font>;
<font color='#0000FF'>return</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font>width<font color='#5555FF'>+</font><font color='#979000'>30</font>,height<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>virtual</font> rectangle <b><a name='get_right_size'></a>get_right_size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'>return</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font color='#979000'>15</font>, <font color='#979000'>5</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_background'></a>draw_background</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> rect,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> enabled,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> is_selected
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>c.<font color='#BB00BB'>intersect</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>.<font color='#BB00BB'>is_empty</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
<font color='#0000FF'>return</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>enabled <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_selected<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>fill_rect_with_vertical_gradient</font><font face='Lucida Console'>(</font>c, rect,<font color='#BB00BB'>rgb_alpha_pixel</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>200</font>,<font color='#979000'>0</font>,<font color='#979000'>100</font><font face='Lucida Console'>)</font>, <font color='#BB00BB'>rgb_alpha_pixel</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#979000'>100</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>draw_rectangle</font><font face='Lucida Console'>(</font>c, rect,<font color='#BB00BB'>rgb_alpha_pixel</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#979000'>100</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_right'></a>draw_right</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> rect,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> enabled,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>c.<font color='#BB00BB'>intersect</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>.<font color='#BB00BB'>is_empty</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
<font color='#0000FF'>return</font>;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>char</u></font> color <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>enabled <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>false</font><font face='Lucida Console'>)</font>
color <font color='#5555FF'>=</font> <font color='#979000'>128</font>;
<font color='#0000FF'><u>long</u></font> x, y;
x <font color='#5555FF'>=</font> rect.<font color='#BB00BB'>right</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>-</font> <font color='#979000'>7</font>;
y <font color='#5555FF'>=</font> rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>+</font> rect.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>2</font>;
<font color='#0000FF'>for</font> <font face='Lucida Console'>(</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> <font color='#979000'>5</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
<font color='#BB00BB'>draw_line</font> <font face='Lucida Console'>(</font>c, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>x <font color='#5555FF'>-</font> i, y <font color='#5555FF'>+</font> i<font face='Lucida Console'>)</font>, <font color='#BB00BB'>point</font><font face='Lucida Console'>(</font>x <font color='#5555FF'>-</font> i, y <font color='#5555FF'>-</font> i<font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_middle'></a>draw_middle</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> rect,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> enabled,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>c.<font color='#BB00BB'>intersect</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>.<font color='#BB00BB'>is_empty</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
<font color='#0000FF'>return</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>enabled<font face='Lucida Console'>)</font>
<b>{</b>
f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>draw_string</font><font face='Lucida Console'>(</font>c,rect,text<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>else</font>
<b>{</b>
f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>draw_string</font><font face='Lucida Console'>(</font>c,rect,text,<font color='#979000'>128</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>underline_p1 <font color='#5555FF'>!</font><font color='#5555FF'>=</font> underline_p2<font face='Lucida Console'>)</font>
<b>{</b>
point <font color='#BB00BB'>base</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>draw_line</font><font face='Lucida Console'>(</font>c, base<font color='#5555FF'>+</font>underline_p1, base<font color='#5555FF'>+</font>underline_p2<font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<font color='#0000FF'>private</font>:
dlib::ustring text;
<font color='#0000FF'>const</font> std::shared_ptr<font color='#5555FF'>&lt;</font>font<font color='#5555FF'>&gt;</font> f;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> action;
unichar hotkey;
point underline_p1;
point underline_p2;
<b>}</b>;
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='menu_item_text'></a>menu_item_text</b> : <font color='#0000FF'>public</font> menu_item
<b>{</b>
<font color='#0000FF'><u>void</u></font> <b><a name='initialize'></a>initialize</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> event_handler_,
unichar hk
<font face='Lucida Console'>)</font>
<b>{</b>
dlib::ustring <font color='#5555FF'>&amp;</font>str <font color='#5555FF'>=</font> text;
action <font color='#5555FF'>=</font> event_handler_;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>hk <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
<b>{</b>
std::string::size_type pos <font color='#5555FF'>=</font> str.<font color='#BB00BB'>find_first_of</font><font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>pos <font color='#5555FF'>!</font><font color='#5555FF'>=</font> std::string::npos<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#009900'>// now compute the location of the underline bar
</font> rectangle r1 <font color='#5555FF'>=</font> f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>compute_cursor_rect</font><font face='Lucida Console'>(</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font color='#979000'>100000</font>,<font color='#979000'>100000</font><font face='Lucida Console'>)</font>, str, pos<font face='Lucida Console'>)</font>;
rectangle r2 <font color='#5555FF'>=</font> f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>compute_cursor_rect</font><font face='Lucida Console'>(</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font color='#979000'>100000</font>,<font color='#979000'>100000</font><font face='Lucida Console'>)</font>, str, pos<font color='#5555FF'>+</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
underline_p1.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> r1.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>1</font>;
underline_p2.<font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> r2.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font>;
underline_p1.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> r1.<font color='#BB00BB'>bottom</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>ascender</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>2</font>;
underline_p2.<font color='#BB00BB'>y</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> r2.<font color='#BB00BB'>bottom</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>ascender</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>2</font>;
<b>}</b>
<b>}</b>
<b>}</b>
<font color='#0000FF'>public</font>:
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
<b><a name='menu_item_text'></a>menu_item_text</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> str,
T<font color='#5555FF'>&amp;</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>,
unichar hk <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
text<font face='Lucida Console'>(</font>convert_wstring_to_utf32<font face='Lucida Console'>(</font>convert_mbstring_to_wstring<font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
f<font face='Lucida Console'>(</font>default_font::get_font<font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
hotkey<font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>initialize</font><font face='Lucida Console'>(</font><font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object, event_handler_<font face='Lucida Console'>)</font>, hk<font face='Lucida Console'>)</font>;
<b>}</b>
<b><a name='menu_item_text'></a>menu_item_text</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> str,
<font color='#0000FF'>const</font> any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> event_handler_,
unichar hk <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
text<font face='Lucida Console'>(</font>convert_wstring_to_utf32<font face='Lucida Console'>(</font>convert_mbstring_to_wstring<font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
f<font face='Lucida Console'>(</font>default_font::get_font<font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
hotkey<font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>initialize</font><font face='Lucida Console'>(</font>event_handler_, hk<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
<b><a name='menu_item_text'></a>menu_item_text</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&amp;</font> str,
T<font color='#5555FF'>&amp;</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>,
unichar hk <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
text<font face='Lucida Console'>(</font>convert_wstring_to_utf32<font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
f<font face='Lucida Console'>(</font>default_font::get_font<font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
hotkey<font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>initialize</font><font face='Lucida Console'>(</font><font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object, event_handler_<font face='Lucida Console'>)</font>, hk<font face='Lucida Console'>)</font>;
<b>}</b>
<b><a name='menu_item_text'></a>menu_item_text</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> std::wstring<font color='#5555FF'>&amp;</font> str,
<font color='#0000FF'>const</font> any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> event_handler_,
unichar hk <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
text<font face='Lucida Console'>(</font>convert_wstring_to_utf32<font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
f<font face='Lucida Console'>(</font>default_font::get_font<font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
hotkey<font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>initialize</font><font face='Lucida Console'>(</font>event_handler_, hk<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
<b><a name='menu_item_text'></a>menu_item_text</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&amp;</font> str,
T<font color='#5555FF'>&amp;</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>,
unichar hk <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
text<font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font>,
f<font face='Lucida Console'>(</font>default_font::get_font<font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
hotkey<font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>initialize</font><font face='Lucida Console'>(</font><font color='#BB00BB'>make_mfp</font><font face='Lucida Console'>(</font>object, event_handler_<font face='Lucida Console'>)</font>, hk<font face='Lucida Console'>)</font>;
<b>}</b>
<b><a name='menu_item_text'></a>menu_item_text</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> dlib::ustring<font color='#5555FF'>&amp;</font> str,
<font color='#0000FF'>const</font> any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> event_handler_,
unichar hk <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font> :
text<font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font>,
f<font face='Lucida Console'>(</font>default_font::get_font<font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>,
hotkey<font face='Lucida Console'>(</font>hk<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>initialize</font><font face='Lucida Console'>(</font>event_handler_, hk<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>virtual</font> unichar <b><a name='get_hot_key'></a>get_hot_key</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> hotkey; <b>}</b>
<font color='#0000FF'>virtual</font> rectangle <b><a name='get_middle_size'></a>get_middle_size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> width, height;
f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>compute_size</font><font face='Lucida Console'>(</font>text,width,height<font face='Lucida Console'>)</font>;
<font color='#0000FF'>return</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font>width,height<font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_background'></a>draw_background</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> rect,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> enabled,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> is_selected
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>c.<font color='#BB00BB'>intersect</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>.<font color='#BB00BB'>is_empty</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
<font color='#0000FF'>return</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>enabled <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_selected<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#BB00BB'>fill_rect_with_vertical_gradient</font><font face='Lucida Console'>(</font>c, rect,<font color='#BB00BB'>rgb_alpha_pixel</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>200</font>,<font color='#979000'>0</font>,<font color='#979000'>100</font><font face='Lucida Console'>)</font>, <font color='#BB00BB'>rgb_alpha_pixel</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#979000'>100</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>draw_rectangle</font><font face='Lucida Console'>(</font>c, rect,<font color='#BB00BB'>rgb_alpha_pixel</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#979000'>0</font>,<font color='#979000'>100</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_middle'></a>draw_middle</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> rect,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> enabled,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>c.<font color='#BB00BB'>intersect</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>.<font color='#BB00BB'>is_empty</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
<font color='#0000FF'>return</font>;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>char</u></font> color <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>enabled <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>false</font><font face='Lucida Console'>)</font>
color <font color='#5555FF'>=</font> <font color='#979000'>128</font>;
f<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>draw_string</font><font face='Lucida Console'>(</font>c,rect,text,color<font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>underline_p1 <font color='#5555FF'>!</font><font color='#5555FF'>=</font> underline_p2<font face='Lucida Console'>)</font>
<b>{</b>
point <font color='#BB00BB'>base</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>draw_line</font><font face='Lucida Console'>(</font>c, base<font color='#5555FF'>+</font>underline_p1, base<font color='#5555FF'>+</font>underline_p2, color<font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_click'></a>on_click</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#BB00BB'>action</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>bool</u></font> <b><a name='has_click_event'></a>has_click_event</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font color='#979000'>true</font>; <b>}</b>
<font color='#0000FF'>private</font>:
dlib::ustring text;
<font color='#0000FF'>const</font> std::shared_ptr<font color='#5555FF'>&lt;</font>font<font color='#5555FF'>&gt;</font> f;
any_function<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font> action;
unichar hotkey;
point underline_p1;
point underline_p2;
<b>}</b>;
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='menu_item_separator'></a>menu_item_separator</b> : <font color='#0000FF'>public</font> menu_item
<b>{</b>
<font color='#0000FF'>public</font>:
<font color='#0000FF'>virtual</font> rectangle <b><a name='get_middle_size'></a>get_middle_size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'>return</font> <font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font><font color='#979000'>10</font>,<font color='#979000'>4</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_background'></a>draw_background</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> rect,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>c.<font color='#BB00BB'>intersect</font><font face='Lucida Console'>(</font>rect<font face='Lucida Console'>)</font>.<font color='#BB00BB'>is_empty</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
<font color='#0000FF'>return</font>;
point <font color='#BB00BB'>p1</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>rect.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>2</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
point <font color='#BB00BB'>p2</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>right</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>rect.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>2</font><font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
point <font color='#BB00BB'>p3</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>rect.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>;
point <font color='#BB00BB'>p4</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>right</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>rect.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>draw_line</font><font face='Lucida Console'>(</font>c, p1,p2,<font color='#979000'>128</font><font face='Lucida Console'>)</font>;
<font color='#BB00BB'>draw_line</font><font face='Lucida Console'>(</font>c, p3,p4,<font color='#979000'>255</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='draw_middle'></a>draw_middle</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> ,
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> ,
<font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
<b>{</b>
<b>}</b>
<b>}</b>;
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='popup_menu'></a>popup_menu</b> : <font color='#0000FF'>public</font> base_window
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
- pad == 2
- item_pad == 3
- cur_rect == rectangle(pad,pad,pad-1,pad-1)
- left_width == 0
- middle_width == 0
- selected_item == 0
- submenu_open == false
- items.size() == 0
- item_enabled.size() == 0
- left_rects.size() == 0
- middle_rects.size() == 0
- right_rects.size() == 0
- line_rects.size() == 0
- submenus.size() == 0
- hide_handlers.size() == 0
CONVENTION
- pad = 2
- item_pad = 3
- all of the following arrays have the same size:
- items.size()
- item_enabled.size()
- left_rects.size()
- middle_rects.size()
- right_rects.size()
- line_rects.size()
- submenus.size()
- win_rect == a rectangle that is the exact size of this window and with
its upper left corner at (0,0)
- cur_rect == the rect inside which all the menu items are drawn
- if (a menu_item is supposed to be selected) then
- selected_item == the index in menus of the menu_item
- else
- selected_item == submenus.size()
- if (there is a selected submenu and it is currently open) then
- submenu_open == true
- else
- submenu_open == false
- for all valid i:
- items[i] == a pointer to the ith menu_item
- item_enabled[i] == true if the ith menu_item is enabled, false otherwise
- left_rects[i] == the left rectangle for the ith menu item
- middle_rects[i] == the middle rectangle for the ith menu item
- right_rects[i] == the right rectangle for the ith menu item
- line_rects[i] == the rectangle for the entire line on which the ith menu
item appears.
- if (submenus[i] != 0) then
- the ith menu item has a submenu and it is pointed to by submenus[i]
- hide_handlers == an array of all the on_hide events registered for
this popup_menu
!*/</font>
<font color='#0000FF'>public</font>:
<b><a name='popup_menu'></a>popup_menu</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> menu_item_type
<font color='#5555FF'>&gt;</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='add_menu_item'></a>add_menu_item</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> menu_item_type<font color='#5555FF'>&amp;</font> new_item
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>wm<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>bool</u></font> t <font color='#5555FF'>=</font> <font color='#979000'>true</font>;
std::unique_ptr<font color='#5555FF'>&lt;</font>menu_item<font color='#5555FF'>&gt;</font> <font color='#BB00BB'>item</font><font face='Lucida Console'>(</font><font color='#0000FF'>new</font> <font color='#BB00BB'>menu_item_type</font><font face='Lucida Console'>(</font>new_item<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
items.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font>;
item_enabled.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>t<font face='Lucida Console'>)</font>;
<font color='#009900'>// figure out how big the window should be now and what not
</font> rectangle left <font color='#5555FF'>=</font> new_item.<font color='#BB00BB'>get_left_size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
rectangle middle <font color='#5555FF'>=</font> new_item.<font color='#BB00BB'>get_middle_size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
rectangle right <font color='#5555FF'>=</font> new_item.<font color='#BB00BB'>get_right_size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>bool</u></font> recalc_rect_positions <font color='#5555FF'>=</font> <font color='#979000'>false</font>;
<font color='#0000FF'>const</font> rectangle all <font color='#5555FF'>=</font> left<font color='#5555FF'>+</font>middle<font color='#5555FF'>+</font>right;
<font color='#009900'>// make sure left_width contains the max of all the left rectangles
</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>left.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&gt;</font> left_width<font face='Lucida Console'>)</font>
<b>{</b>
left_width <font color='#5555FF'>=</font> left.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
recalc_rect_positions <font color='#5555FF'>=</font> <font color='#979000'>true</font>;
<b>}</b>
<font color='#009900'>// make sure middle_width contains the max of all the middle rectangles
</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>middle.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&gt;</font> middle_width<font face='Lucida Console'>)</font>
<b>{</b>
middle_width <font color='#5555FF'>=</font> middle.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
recalc_rect_positions <font color='#5555FF'>=</font> <font color='#979000'>true</font>;
<b>}</b>
<font color='#009900'>// make the current rectangle wider if necessary
</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>cur_rect.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font> left_width <font color='#5555FF'>+</font> middle_width <font color='#5555FF'>+</font> right.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>+</font> <font color='#979000'>2</font><font color='#5555FF'>*</font>item_pad<font face='Lucida Console'>)</font>
<b>{</b>
cur_rect <font color='#5555FF'>=</font> <font color='#BB00BB'>resize_rect_width</font><font face='Lucida Console'>(</font>cur_rect, left_width <font color='#5555FF'>+</font> middle_width <font color='#5555FF'>+</font> right.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>+</font> <font color='#979000'>2</font><font color='#5555FF'>*</font>item_pad<font face='Lucida Console'>)</font>;
recalc_rect_positions <font color='#5555FF'>=</font> <font color='#979000'>true</font>;
<b>}</b>
<font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> y <font color='#5555FF'>=</font> cur_rect.<font color='#BB00BB'>bottom</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>+</font> item_pad;
<font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> x <font color='#5555FF'>=</font> cur_rect.<font color='#BB00BB'>left</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>+</font> item_pad;
<font color='#009900'>// make the current rectangle taller to account for this new menu item
</font> cur_rect.<font color='#BB00BB'>set_bottom</font><font face='Lucida Console'>(</font>cur_rect.<font color='#BB00BB'>bottom</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>all.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>+</font> <font color='#979000'>2</font><font color='#5555FF'>*</font>item_pad<font face='Lucida Console'>)</font>;
<font color='#009900'>// adjust all the saved rectangles since the width of the window changed
</font> <font color='#009900'>// or left_width changed
</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>recalc_rect_positions<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#0000FF'><u>long</u></font> y <font color='#5555FF'>=</font> cur_rect.<font color='#BB00BB'>top</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>+</font> item_pad;
<font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> left_rects.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
<b>{</b>
middle_rects[i] <font color='#5555FF'>=</font> <font color='#BB00BB'>move_rect</font><font face='Lucida Console'>(</font>middle_rects[i], x<font color='#5555FF'>+</font>left_width, y<font face='Lucida Console'>)</font>;
right_rects[i] <font color='#5555FF'>=</font> <font color='#BB00BB'>move_rect</font><font face='Lucida Console'>(</font>right_rects[i], x<font color='#5555FF'>+</font>cur_rect.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>right_rects[i].<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>item_pad, y<font face='Lucida Console'>)</font>;
line_rects[i] <font color='#5555FF'>=</font> <font color='#BB00BB'>resize_rect_width</font><font face='Lucida Console'>(</font>line_rects[i], cur_rect.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
y <font color='#5555FF'>+</font><font color='#5555FF'>=</font> line_rects[i].<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<font color='#009900'>// save the rectangles for later use. Also position them at the
</font> <font color='#009900'>// right spots
</font> left <font color='#5555FF'>=</font> <font color='#BB00BB'>move_rect</font><font face='Lucida Console'>(</font>left,x,y<font face='Lucida Console'>)</font>;
middle <font color='#5555FF'>=</font> <font color='#BB00BB'>move_rect</font><font face='Lucida Console'>(</font>middle,x<font color='#5555FF'>+</font>left_width,y<font face='Lucida Console'>)</font>;
right <font color='#5555FF'>=</font> <font color='#BB00BB'>move_rect</font><font face='Lucida Console'>(</font>right,x<font color='#5555FF'>+</font>cur_rect.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>right.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>item_pad,y<font face='Lucida Console'>)</font>;
rectangle <font color='#BB00BB'>line</font><font face='Lucida Console'>(</font><font color='#BB00BB'>move_rect</font><font face='Lucida Console'>(</font><font color='#BB00BB'>rectangle</font><font face='Lucida Console'>(</font>cur_rect.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,all.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font><font color='#979000'>2</font><font color='#5555FF'>*</font>item_pad<font face='Lucida Console'>)</font>, x<font color='#5555FF'>-</font>item_pad, y<font color='#5555FF'>-</font>item_pad<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#009900'>// make sure the left, middle, and right rectangles are centered in the
</font> <font color='#009900'>// line.
</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>left.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font> all.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
left <font color='#5555FF'>=</font> <font color='#BB00BB'>translate_rect</font><font face='Lucida Console'>(</font>left,<font color='#979000'>0</font>, <font face='Lucida Console'>(</font>all.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>left.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>middle.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font> all.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
middle <font color='#5555FF'>=</font> <font color='#BB00BB'>translate_rect</font><font face='Lucida Console'>(</font>middle,<font color='#979000'>0</font>, <font face='Lucida Console'>(</font>all.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>middle.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>right.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font> all.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
right <font color='#5555FF'>=</font> <font color='#BB00BB'>translate_rect</font><font face='Lucida Console'>(</font>right,<font color='#979000'>0</font>, <font face='Lucida Console'>(</font>all.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font>right.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font color='#5555FF'>/</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>;
left_rects.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>left<font face='Lucida Console'>)</font>;
middle_rects.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>middle<font face='Lucida Console'>)</font>;
right_rects.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>right<font face='Lucida Console'>)</font>;
line_rects.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>line<font face='Lucida Console'>)</font>;
popup_menu<font color='#5555FF'>*</font> junk <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
submenus.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>junk<font face='Lucida Console'>)</font>;
win_rect.<font color='#BB00BB'>set_right</font><font face='Lucida Console'>(</font>cur_rect.<font color='#BB00BB'>right</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>pad<font face='Lucida Console'>)</font>;
win_rect.<font color='#BB00BB'>set_bottom</font><font face='Lucida Console'>(</font>cur_rect.<font color='#BB00BB'>bottom</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>+</font>pad<font face='Lucida Console'>)</font>;
<font color='#BB00BB'>set_size</font><font face='Lucida Console'>(</font>win_rect.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,win_rect.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#009900'>// make it so that nothing is selected
</font> selected_item <font color='#5555FF'>=</font> submenus.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<font color='#0000FF'>return</font> items.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font>;
<b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> menu_item_type
<font color='#5555FF'>&gt;</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='add_submenu'></a>add_submenu</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> menu_item_type<font color='#5555FF'>&amp;</font> new_item,
popup_menu<font color='#5555FF'>&amp;</font> submenu
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>wm<font face='Lucida Console'>)</font>;
submenus[<font color='#BB00BB'>add_menu_item</font><font face='Lucida Console'>(</font>new_item<font face='Lucida Console'>)</font>] <font color='#5555FF'>=</font> <font color='#5555FF'>&amp;</font>submenu;
submenu.<font color='#BB00BB'>set_on_hide_handler</font><font face='Lucida Console'>(</font><font color='#5555FF'>*</font><font color='#0000FF'>this</font>,<font color='#5555FF'>&amp;</font>popup_menu::on_submenu_hide<font face='Lucida Console'>)</font>;
<font color='#0000FF'>return</font> items.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='enable_menu_item'></a>enable_menu_item</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'><u>void</u></font> <b><a name='disable_menu_item'></a>disable_menu_item</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'><u>size_t</u></font> <b><a name='size'></a>size</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='clear'></a>clear</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='show'></a>show</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='hide'></a>hide</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
<font color='#0000FF'><u>void</u></font> <b><a name='set_on_hide_handler'></a>set_on_hide_handler</b> <font face='Lucida Console'>(</font>
T<font color='#5555FF'>&amp;</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>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>wm<font face='Lucida Console'>)</font>;
member_function_pointer<font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font> temp;
temp.<font color='#BB00BB'>set</font><font face='Lucida Console'>(</font>object,event_handler<font face='Lucida Console'>)</font>;
<font color='#009900'>// if this handler isn't already registered then add it
</font> <font color='#0000FF'><u>bool</u></font> found_handler <font color='#5555FF'>=</font> <font color='#979000'>false</font>;
<font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> hide_handlers.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>hide_handlers[i] <font color='#5555FF'>=</font><font color='#5555FF'>=</font> temp<font face='Lucida Console'>)</font>
<b>{</b>
found_handler <font color='#5555FF'>=</font> <font color='#979000'>true</font>;
<font color='#0000FF'>break</font>;
<b>}</b>
<b>}</b>
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>found_handler <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>false</font><font face='Lucida Console'>)</font>
<b>{</b>
hide_handlers.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>temp<font face='Lucida Console'>)</font>;
<b>}</b>
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='select_first_item'></a>select_first_item</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>bool</u></font> <b><a name='forwarded_on_keydown'></a>forwarded_on_keydown</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> key,
<font color='#0000FF'><u>bool</u></font> is_printable,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>private</font>:
<font color='#0000FF'><u>void</u></font> <b><a name='on_submenu_hide'></a>on_submenu_hide</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_window_resized'></a>on_window_resized</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_up'></a>on_mouse_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font>,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_move'></a>on_mouse_move</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='close_submenu'></a>close_submenu</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>bool</u></font> <b><a name='display_selected_submenu'></a>display_selected_submenu</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
ensures
- if (submenus[selected_item] isn't null) then
- displays the selected submenu
- returns true
- else
- returns false
!*/</font>
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_leave'></a>on_mouse_leave</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='paint'></a>paint</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> pad;
<font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> item_pad;
rectangle cur_rect;
rectangle win_rect;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> left_width;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> middle_width;
array<font color='#5555FF'>&lt;</font>std::unique_ptr<font color='#5555FF'>&lt;</font>menu_item<font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font> items;
array<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>bool</u></font><font color='#5555FF'>&gt;</font> item_enabled;
array<font color='#5555FF'>&lt;</font>rectangle<font color='#5555FF'>&gt;</font> left_rects;
array<font color='#5555FF'>&lt;</font>rectangle<font color='#5555FF'>&gt;</font> middle_rects;
array<font color='#5555FF'>&lt;</font>rectangle<font color='#5555FF'>&gt;</font> right_rects;
array<font color='#5555FF'>&lt;</font>rectangle<font color='#5555FF'>&gt;</font> line_rects;
array<font color='#5555FF'>&lt;</font>popup_menu<font color='#5555FF'>*</font><font color='#5555FF'>&gt;</font> submenus;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> selected_item;
<font color='#0000FF'><u>bool</u></font> submenu_open;
array<font color='#5555FF'>&lt;</font>member_function_pointer<font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font> hide_handlers;
<font color='#009900'>// restricted functions
</font> <b><a name='popup_menu'></a>popup_menu</b><font face='Lucida Console'>(</font>popup_menu<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> popup_menu<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>popup_menu<font color='#5555FF'>&amp;</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='zoomable_region'></a>zoomable_region</b> : <font color='#0000FF'>public</font> drawable
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
- min_scale == 0.15
- max_scale == 1.0
- zoom_increment_ == 0.02
- scale == 1.0
- mouse_drag_screen == false
CONVENTION
- zoom_increment() == zoom_increment_
- min_zoom_scale() == min_scale
- max_zoom_scale() == max_scale
- zoom_scale() == scale
- if (the user is currently dragging the graph around via the mouse) then
- mouse_drag_screen == true
- else
- mouse_drag_screen == false
- max_graph_point() == lr_point
- display_rect() == display_rect_
- gui_to_graph_space(point(display_rect.left(),display_rect.top())) == gr_orig
!*/</font>
<font color='#0000FF'>public</font>:
<b><a name='zoomable_region'></a>zoomable_region</b> <font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> events <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>virtual</font> ~<b><a name='zoomable_region'></a>zoomable_region</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font><font color='#5555FF'>=</font> <font color='#979000'>0</font>;
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='set_pos'></a>set_pos</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> style_type
<font color='#5555FF'>&gt;</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'>&amp;</font> style_
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
style.<font color='#BB00BB'>reset</font><font face='Lucida Console'>(</font><font color='#0000FF'>new</font> <font color='#BB00BB'>style_type</font><font face='Lucida Console'>(</font>style_<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
hsb.<font color='#BB00BB'>set_style</font><font face='Lucida Console'>(</font>style_.<font color='#BB00BB'>get_horizontal_scroll_bar_style</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
vsb.<font color='#BB00BB'>set_style</font><font face='Lucida Console'>(</font>style_.<font color='#BB00BB'>get_vertical_scroll_bar_style</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#009900'>// do this just so that everything gets redrawn right
</font> <font color='#BB00BB'>set_size</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, rect.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='set_zoom_increment'></a>set_zoom_increment</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>double</u></font> zi
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>double</u></font> <b><a name='zoom_increment'></a>zoom_increment</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_max_zoom_scale'></a>set_max_zoom_scale</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>double</u></font> ms
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_min_zoom_scale'></a>set_min_zoom_scale</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>double</u></font> ms
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>double</u></font> <b><a name='min_zoom_scale'></a>min_zoom_scale</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>double</u></font> <b><a name='max_zoom_scale'></a>max_zoom_scale</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'>virtual</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='#0000FF'><u>void</u></font> <b><a name='show'></a>show</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='hide'></a>hide</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='enable'></a>enable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='disable'></a>disable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_z_order'></a>set_z_order</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> order
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>protected</font>:
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_view_changed'></a>on_view_changed</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <b>{</b><b>}</b>
point <b><a name='graph_to_gui_space'></a>graph_to_gui_space</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> vector<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> p
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
vector<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>&gt;</font> <b><a name='gui_to_graph_space'></a>gui_to_graph_space</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> point<font color='#5555FF'>&amp;</font> p
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
point <b><a name='max_graph_point'></a>max_graph_point</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
rectangle <b><a name='display_rect'></a>display_rect</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>double</u></font> <b><a name='zoom_scale'></a>zoom_scale</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_zoom_scale'></a>set_zoom_scale</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>double</u></font> new_scale
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='center_display_at_graph_point'></a>center_display_at_graph_point</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> vector<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> p
<font face='Lucida Console'>)</font>;
<font color='#009900'>// ----------- event handlers ---------------
</font>
<font color='#0000FF'><u>void</u></font> <b><a name='on_wheel_down'></a>on_wheel_down</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_wheel_up'></a>on_wheel_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_move'></a>on_mouse_move</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_up'></a>on_mouse_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_down'></a>on_mouse_down</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y,
<font color='#0000FF'><u>bool</u></font> is_double_click
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='draw'></a>draw</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'>private</font>:
<font color='#0000FF'><u>void</u></font> <b><a name='on_h_scroll'></a>on_h_scroll</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_v_scroll'></a>on_v_scroll</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='redraw_graph'></a>redraw_graph</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='adjust_origin'></a>adjust_origin</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> point<font color='#5555FF'>&amp;</font> gui_p,
<font color='#0000FF'>const</font> vector<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> graph_p
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
ensures
- adjusts gr_orig so that we are as close to the following as possible:
- graph_to_gui_space(graph_p) == gui_p
- gui_to_graph_space(gui_p) == graph_p
!*/</font>
vector<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>&gt;</font> gr_orig; <font color='#009900'>// point in graph space such that it's gui space point is the upper left of display_rect_
</font> vector<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>&gt;</font> lr_point; <font color='#009900'>// point in graph space such that it is at the lower right corner of the screen at max zoom
</font>
<font color='#0000FF'>mutable</font> std::ostringstream sout;
<font color='#0000FF'><u>double</u></font> scale; <font color='#009900'>// 0 &lt; scale &lt;= 1
</font> <font color='#0000FF'><u>double</u></font> min_scale;
<font color='#0000FF'><u>double</u></font> max_scale;
<font color='#0000FF'><u>double</u></font> zoom_increment_;
rectangle display_rect_;
<font color='#0000FF'><u>bool</u></font> mouse_drag_screen; <font color='#009900'>// true if the user is dragging the white background area
</font> vector<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>&gt;</font> drag_screen_point; <font color='#009900'>// the starting point the mouse was at in graph space for the background area drag
</font>
scroll_bar vsb;
scroll_bar hsb;
std::unique_ptr<font color='#5555FF'>&lt;</font>scrollable_region_style<font color='#5555FF'>&gt;</font> style;
<font color='#009900'>// restricted functions
</font> <b><a name='zoomable_region'></a>zoomable_region</b><font face='Lucida Console'>(</font>zoomable_region<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> zoomable_region<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>zoomable_region<font color='#5555FF'>&amp;</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='scrollable_region'></a>scrollable_region</b> : <font color='#0000FF'>public</font> drawable
<b>{</b>
<font color='#009900'>/*!
INITIAL VALUE
- hscroll_bar_inc == 1
- vscroll_bar_inc == 1
- h_wheel_scroll_bar_inc == 1
- v_wheel_scroll_bar_inc == 1
- mouse_drag_enabled_ == false
- user_is_dragging_mouse == false
CONVENTION
- mouse_drag_enabled() == mouse_drag_enabled_
- horizontal_scroll_increment() == hscroll_bar_inc
- vertical_scroll_increment() == vscroll_bar_inc
- horizontal_mouse_wheel_scroll_increment() == h_wheel_scroll_bar_inc
- vertical_mouse_wheel_scroll_increment() == v_wheel_scroll_bar_inc
- vertical_scroll_pos() == vsb.slider_pos()
- horizontal_scroll_pos() == hsb.slider_pos()
- total_rect() == total_rect_
- display_rect() == display_rect_
- if (the user is currently dragging the total_rect around with a mouse drag) then
- user_is_dragging_mouse == true
- drag_origin == the point the mouse was at, with respect to total_rect,
when the dragging started
- else
- user_is_dragging_mouse == false
!*/</font>
<font color='#0000FF'>public</font>:
<b><a name='scrollable_region'></a>scrollable_region</b> <font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> events <font color='#5555FF'>=</font> <font color='#979000'>0</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>virtual</font> ~<b><a name='scrollable_region'></a>scrollable_region</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
<font color='#0000FF'>typename</font> style_type
<font color='#5555FF'>&gt;</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'>&amp;</font> style_
<font face='Lucida Console'>)</font>
<b>{</b>
auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>;
style.<font color='#BB00BB'>reset</font><font face='Lucida Console'>(</font><font color='#0000FF'>new</font> <font color='#BB00BB'>style_type</font><font face='Lucida Console'>(</font>style_<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
hsb.<font color='#BB00BB'>set_style</font><font face='Lucida Console'>(</font>style_.<font color='#BB00BB'>get_horizontal_scroll_bar_style</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
vsb.<font color='#BB00BB'>set_style</font><font face='Lucida Console'>(</font>style_.<font color='#BB00BB'>get_vertical_scroll_bar_style</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<font color='#009900'>// do this just so that everything gets redrawn right
</font> <font color='#BB00BB'>set_size</font><font face='Lucida Console'>(</font>rect.<font color='#BB00BB'>width</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, rect.<font color='#BB00BB'>height</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#0000FF'><u>void</u></font> <b><a name='show'></a>show</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='hide'></a>hide</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='enable'></a>enable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='disable'></a>disable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_z_order'></a>set_z_order</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> order
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>virtual</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='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='horizontal_mouse_wheel_scroll_increment'></a>horizontal_mouse_wheel_scroll_increment</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='vertical_mouse_wheel_scroll_increment'></a>vertical_mouse_wheel_scroll_increment</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_horizontal_mouse_wheel_scroll_increment'></a>set_horizontal_mouse_wheel_scroll_increment</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> inc
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_vertical_mouse_wheel_scroll_increment'></a>set_vertical_mouse_wheel_scroll_increment</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> inc
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='horizontal_scroll_increment'></a>horizontal_scroll_increment</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='vertical_scroll_increment'></a>vertical_scroll_increment</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_horizontal_scroll_increment'></a>set_horizontal_scroll_increment</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> inc
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_vertical_scroll_increment'></a>set_vertical_scroll_increment</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> inc
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>long</u></font> <b><a name='horizontal_scroll_pos'></a>horizontal_scroll_pos</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>long</u></font> <b><a name='vertical_scroll_pos'></a>vertical_scroll_pos</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_horizontal_scroll_pos'></a>set_horizontal_scroll_pos</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> pos
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_vertical_scroll_pos'></a>set_vertical_scroll_pos</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> pos
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='set_pos'></a>set_pos</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>bool</u></font> <b><a name='mouse_drag_enabled'></a>mouse_drag_enabled</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='enable_mouse_drag'></a>enable_mouse_drag</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='disable_mouse_drag'></a>disable_mouse_drag</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>protected</font>:
<font color='#0000FF'>virtual</font> <font color='#0000FF'><u>void</u></font> <b><a name='on_view_changed'></a>on_view_changed</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <b>{</b><b>}</b>
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> <b><a name='display_rect'></a>display_rect</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='set_total_rect_size'></a>set_total_rect_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='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> <b><a name='total_rect'></a>total_rect</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='scroll_to_rect'></a>scroll_to_rect</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> r_
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_wheel_down'></a>on_wheel_down</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_move'></a>on_mouse_move</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_down'></a>on_mouse_down</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y,
<font color='#0000FF'><u>bool</u></font> is_double_click
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_up'></a>on_mouse_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_wheel_up'></a>on_wheel_up</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='draw'></a>draw</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font> c
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'>private</font>:
<font color='#0000FF'><u>bool</u></font> <b><a name='need_h_scroll'></a>need_h_scroll</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>bool</u></font> <b><a name='need_v_scroll'></a>need_v_scroll</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_h_scroll'></a>on_h_scroll</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_v_scroll'></a>on_v_scroll</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
rectangle total_rect_;
rectangle display_rect_;
scroll_bar hsb;
scroll_bar vsb;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> hscroll_bar_inc;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> vscroll_bar_inc;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> h_wheel_scroll_bar_inc;
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> v_wheel_scroll_bar_inc;
<font color='#0000FF'><u>bool</u></font> mouse_drag_enabled_;
<font color='#0000FF'><u>bool</u></font> user_is_dragging_mouse;
point drag_origin;
std::unique_ptr<font color='#5555FF'>&lt;</font>scrollable_region_style<font color='#5555FF'>&gt;</font> style;
<b>}</b>;
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font> <font color='#009900'>// class popup_menu_region
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>class</font> <b><a name='popup_menu_region'></a>popup_menu_region</b> : <font color='#0000FF'>public</font> drawable
<b>{</b>
<font color='#009900'>/*!
CONVENTION
popup_menu_visible() == popup_menu_shown
!*/</font>
<font color='#0000FF'>public</font>:
<b><a name='popup_menu_region'></a>popup_menu_region</b><font face='Lucida Console'>(</font>
drawable_window<font color='#5555FF'>&amp;</font> w
<font face='Lucida Console'>)</font>;
<font color='#0000FF'>virtual</font> ~<b><a name='popup_menu_region'></a>popup_menu_region</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</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='#0000FF'><u>void</u></font> <b><a name='set_rect'></a>set_rect</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> new_rect
<font face='Lucida Console'>)</font>;
popup_menu<font color='#5555FF'>&amp;</font> <b><a name='menu'></a>menu</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='hide'></a>hide</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='disable'></a>disable</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>bool</u></font> <b><a name='popup_menu_visible'></a>popup_menu_visible</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> auto_mutex <font color='#BB00BB'>M</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>; <font color='#0000FF'>return</font> popup_menu_shown; <b>}</b>
<font color='#0000FF'>protected</font>:
<font color='#0000FF'><u>void</u></font> <b><a name='on_keydown'></a>on_keydown</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> key,
<font color='#0000FF'><u>bool</u></font> is_printable,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_focus_lost'></a>on_focus_lost</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_focus_gained'></a>on_focus_gained</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_window_moved'></a>on_window_moved</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_mouse_down'></a>on_mouse_down</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> btn,
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> state,
<font color='#0000FF'><u>long</u></font> x,
<font color='#0000FF'><u>long</u></font> y,
<font color='#0000FF'><u>bool</u></font> is_double_click
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='on_menu_becomes_hidden'></a>on_menu_becomes_hidden</b> <font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>;
<font color='#0000FF'><u>void</u></font> <b><a name='draw'></a>draw</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> canvas<font color='#5555FF'>&amp;</font>
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
<font color='#0000FF'>private</font>:
popup_menu menu_;
<font color='#0000FF'><u>bool</u></font> popup_menu_shown;
<font color='#009900'>// restricted functions
</font> <b><a name='popup_menu_region'></a>popup_menu_region</b><font face='Lucida Console'>(</font>popup_menu_region<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor
</font> popup_menu_region<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>popup_menu_region<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator
</font> <b>}</b>;
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<b>}</b>
<font color='#0000FF'>#ifdef</font> NO_MAKEFILE
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='base_widgets.cpp.html'>base_widgets.cpp</a>"
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_BASE_WIDGETs_
</font>
</pre></body></html>