Commit 73352564 authored by Davis King's avatar Davis King

Renamed dragable to draggable.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402588
parent 32ca94c9
......@@ -265,15 +265,15 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// dragable object methods
// draggable object methods
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
dragable::~dragable() {}
draggable::~draggable() {}
// ----------------------------------------------------------------------------------------
void dragable::
void draggable::
on_mouse_move (
unsigned long state,
long x,
......@@ -288,7 +288,7 @@ namespace dlib
long new_x = x - this->x;
long new_y = y - this->y;
// make sure these points are inside the dragable area.
// make sure these points are inside the draggable area.
if (new_x < area.left())
new_x = area.left();
if (new_x + static_cast<long>(rect.width()) - 1 > area.right())
......@@ -326,7 +326,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
void dragable::
void draggable::
on_mouse_up (
unsigned long btn,
unsigned long state,
......@@ -343,7 +343,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
void dragable::
void draggable::
on_mouse_down (
unsigned long btn,
unsigned long ,
......@@ -771,11 +771,11 @@ namespace dlib
rect.top()
);
// move the dragable area for the slider to the new location
// move the draggable area for the slider to the new location
rectangle area = rect;
area.set_left(area.left() + style->get_width());
area.set_right(area.right() - style->get_width());
slider.set_dragable_area(area);
slider.set_draggable_area(area);
}
......@@ -797,11 +797,11 @@ namespace dlib
static_cast<long>(slider_pos) + rect.top() + b1.get_rect().height()
);
// move the dragable area for the slider to the new location
// move the draggable area for the slider to the new location
rectangle area = rect;
area.set_top(area.top() + style->get_width());
area.set_bottom(area.bottom() - style->get_width());
slider.set_dragable_area(area);
slider.set_draggable_area(area);
}
}
......
......@@ -27,11 +27,11 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// class dragable
// class draggable
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class dragable : public drawable
class draggable : public drawable
{
/*!
INITIAL VALUE
......@@ -50,7 +50,7 @@ namespace dlib
public:
dragable(
draggable(
drawable_window& w,
unsigned long events = 0
) :
......@@ -58,13 +58,13 @@ namespace dlib
drag(false)
{}
virtual ~dragable(
virtual ~draggable(
) = 0;
rectangle dragable_area (
rectangle draggable_area (
) const { auto_mutex M(m); return area; }
void set_dragable_area (
void set_draggable_area (
const rectangle& area_
) { auto_mutex M(m); area = area_; }
......@@ -107,8 +107,8 @@ namespace dlib
long x, y;
// restricted functions
dragable(dragable&); // copy constructor
dragable& operator=(dragable&); // assignment operator
draggable(draggable&); // copy constructor
draggable& operator=(draggable&); // assignment operator
};
// ----------------------------------------------------------------------------------------
......@@ -364,7 +364,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
class image_widget : public dragable
class image_widget : public draggable
{
/*!
INITIAL VALUE
......@@ -378,7 +378,7 @@ namespace dlib
image_widget(
drawable_window& w
): dragable(w) { enable_events(); }
): draggable(w) { enable_events(); }
~image_widget(
)
......@@ -1220,7 +1220,7 @@ namespace dlib
};
friend class slider_class;
class slider_class : public dragable
class slider_class : public draggable
{
friend class scroll_bar;
public:
......@@ -1229,7 +1229,7 @@ namespace dlib
scroll_bar& object,
void (scroll_bar::*handler)()
) :
dragable(w, MOUSE_MOVE),
draggable(w, MOUSE_MOVE),
mouse_in_widget(false),
my_scroll_bar(object)
{
......@@ -1264,7 +1264,7 @@ namespace dlib
long y
)
{
dragable::on_mouse_move(state,x,y);
draggable::on_mouse_move(state,x,y);
if (!hidden && my_scroll_bar.style->redraw_on_mouse_over_slider())
{
if (rect.contains(x,y) && !mouse_in_widget)
......
......@@ -33,28 +33,28 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// class dragable
// class draggable
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class dragable : public drawable
class draggable : public drawable
{
/*!
INITIAL VALUE
dragable_area() == an initial value for its type
draggable_area() == an initial value for its type
WHAT THIS OBJECT REPRESENTS
This object represents a drawable object that is dragable by the mouse.
This object represents a drawable object that is draggable by the mouse.
You use it by inheriting from it and defining the draw() method and any
of the on_*() event handlers you need.
This object is dragable by the user when is_enabled() == true and
not dragable otherwise.
This object is draggable by the user when is_enabled() == true and
not draggable otherwise.
!*/
public:
dragable(
draggable(
drawable_window& w,
unsigned long events = 0
);
......@@ -72,26 +72,26 @@ namespace dlib
- dlib::thread_error
!*/
virtual ~dragable(
virtual ~draggable(
) = 0;
/*!
ensures
- all resources associated with *this have been released
!*/
rectangle dragable_area (
rectangle draggable_area (
) const;
/*!
ensures
- returns the area that this dragable can be dragged around in.
- returns the area that this draggable can be dragged around in.
!*/
void set_dragable_area (
void set_draggable_area (
const rectangle& area
);
/*!
ensures
- #dragable_area() == area
- #draggable_area() == area
!*/
protected:
......@@ -141,8 +141,8 @@ namespace dlib
private:
// restricted functions
dragable(dragable&); // copy constructor
dragable& operator=(dragable&); // assignment operator
draggable(draggable&); // copy constructor
draggable& operator=(draggable&); // assignment operator
};
// ----------------------------------------------------------------------------------------
......@@ -915,19 +915,19 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class image_widget : public dragable
class image_widget : public draggable
{
/*!
INITIAL VALUE
dragable_area() == an initial value for its type.
draggable_area() == an initial value for its type.
This object isn't displaying anything.
WHAT THIS OBJECT REPRESENTS
This object represents a dragable image. You give it an image to display
This object represents a draggable image. You give it an image to display
by calling set_image().
Also note that initially the dragable area is empty so it won't be
dragable unless you call set_dragable_area() to some non-empty region.
Also note that initially the draggable area is empty so it won't be
draggable unless you call set_draggable_area() to some non-empty region.
The image is drawn such that:
- the pixel img[0][0] is the upper left corner of the image.
......
......@@ -1887,7 +1887,7 @@ namespace dlib
mouse_tracker(
drawable_window& w
) :
dragable(w),
draggable(w),
offset(18),
nr(w),
x_label(w),
......@@ -1895,7 +1895,7 @@ namespace dlib
click_x(-1),
click_y(-1)
{
set_dragable_area(rectangle(0,0,500,500));
set_draggable_area(rectangle(0,0,500,500));
x_label.set_text("x: ");
......@@ -1951,7 +1951,7 @@ namespace dlib
long y
)
{
dragable::set_pos(x,y);
draggable::set_pos(x,y);
nr.set_pos(x,y);
x_label.set_pos(rect.left()+offset,rect.top()+offset);
y_label.set_pos(x_label.get_rect().left(), x_label.get_rect().bottom()+3);
......@@ -1963,7 +1963,7 @@ namespace dlib
show (
)
{
dragable::show();
draggable::show();
nr.show();
x_label.show();
y_label.show();
......@@ -1975,7 +1975,7 @@ namespace dlib
hide (
)
{
dragable::hide();
draggable::hide();
nr.hide();
x_label.hide();
y_label.hide();
......@@ -1987,7 +1987,7 @@ namespace dlib
enable (
)
{
dragable::enable();
draggable::enable();
nr.enable();
x_label.enable();
y_label.enable();
......@@ -1999,7 +1999,7 @@ namespace dlib
disable (
)
{
dragable::disable();
draggable::disable();
nr.disable();
x_label.disable();
y_label.disable();
......@@ -2016,7 +2016,7 @@ namespace dlib
bool double_clicked
)
{
dragable::on_mouse_down(btn,state,x,y,double_clicked);
draggable::on_mouse_down(btn,state,x,y,double_clicked);
if ((state & base_window::SHIFT) && (btn == base_window::LEFT) && enabled && !hidden)
{
parent.invalidate_rectangle(rectangle(x,y,x,y));
......@@ -2041,7 +2041,7 @@ namespace dlib
if (!hidden && enabled)
{
parent.invalidate_rectangle(rect);
dragable::on_mouse_move(state,x,y);
draggable::on_mouse_move(state,x,y);
long dx = 0;
long dy = 0;
......
......@@ -892,7 +892,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class mouse_tracker : public dragable
class mouse_tracker : public draggable
{
public:
......@@ -1722,7 +1722,7 @@ namespace dlib
mouse_drag = false;
selected_node = 0;
// Whenever you make your own drawable (or inherit from dragable or button_action)
// Whenever you make your own drawable (or inherit from draggable or button_action)
// you have to remember to call this function to enable the events. The idea
// here is that you can perform whatever setup you need to do to get your
// object into a valid state without needing to worry about event handlers
......
......@@ -906,14 +906,14 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class mouse_tracker : public dragable
class mouse_tracker : public draggable
{
/*!
INITIAL VALUE
dragable_area() == rectangle(0,0,500,500)
draggable_area() == rectangle(0,0,500,500)
WHAT THIS OBJECT REPRESENTS
This object represents a simple dragable box that displays the
This object represents a simple draggable box that displays the
current location of the mouse.
Also, if you hold shift and left click on the parent window then the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment