Commit ab964fee authored by Davis King's avatar Davis King

Removed all the arrow button styles and replaced them with a single

button style.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402599
parent 9db0ca77
......@@ -285,23 +285,17 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
namespace arrow_button_style_helper
{
enum arrow_direction
{
UP,
DOWN,
LEFT,
RIGHT
};
void draw_arrow_button (
void button_style_arrow::
draw_button (
const canvas& c,
const rectangle& rect,
const bool enabled,
const bool is_depressed,
const arrow_direction dir
)
const font& mfont,
const long lastx,
const long lasty,
const ustring& name,
const bool is_depressed
) const
{
rectangle area = rect.intersect(c);
if (area.is_empty())
......@@ -405,83 +399,6 @@ namespace dlib
}
}
}
void button_style_left_arrow::
draw_button (
const canvas& c,
const rectangle& rect,
const bool enabled,
const font& mfont,
const long lastx,
const long lasty,
const ustring& name,
const bool is_depressed
) const
{
using namespace arrow_button_style_helper;
draw_arrow_button(c, rect, enabled, is_depressed, LEFT);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
void button_style_right_arrow::
draw_button (
const canvas& c,
const rectangle& rect,
const bool enabled,
const font& mfont,
const long lastx,
const long lasty,
const ustring& name,
const bool is_depressed
) const
{
using namespace arrow_button_style_helper;
draw_arrow_button(c, rect, enabled, is_depressed, RIGHT);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
void button_style_up_arrow::
draw_button (
const canvas& c,
const rectangle& rect,
const bool enabled,
const font& mfont,
const long lastx,
const long lasty,
const ustring& name,
const bool is_depressed
) const
{
using namespace arrow_button_style_helper;
draw_arrow_button(c, rect, enabled, is_depressed, UP);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
void button_style_down_arrow::
draw_button (
const canvas& c,
const rectangle& rect,
const bool enabled,
const font& mfont,
const long lastx,
const long lasty,
const ustring& name,
const bool is_depressed
) const
{
using namespace arrow_button_style_helper;
draw_arrow_button(c, rect, enabled, is_depressed, DOWN);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
......
......@@ -229,75 +229,23 @@ namespace dlib
// ----------------------------------------------------------------------------------------
class button_style_left_arrow : public button_style
class button_style_arrow : public button_style
{
public:
virtual void draw_button (
const canvas& c,
const rectangle& rect,
const bool enabled,
const font& mfont,
const long lastx,
const long lasty,
const ustring& name,
const bool is_depressed
) const;
virtual rectangle get_min_size (
const ustring& name,
const font& mfont
) const { return rectangle(); }
};
// ----------------------------------------------------------------------------------------
class button_style_right_arrow : public button_style
{
public:
virtual void draw_button (
const canvas& c,
const rectangle& rect,
const bool enabled,
const font& mfont,
const long lastx,
const long lasty,
const ustring& name,
const bool is_depressed
) const;
virtual rectangle get_min_size (
const ustring& name,
const font& mfont
) const { return rectangle(); }
};
// ----------------------------------------------------------------------------------------
class button_style_up_arrow : public button_style
enum arrow_direction
{
public:
virtual void draw_button (
const canvas& c,
const rectangle& rect,
const bool enabled,
const font& mfont,
const long lastx,
const long lasty,
const ustring& name,
const bool is_depressed
) const;
virtual rectangle get_min_size (
const ustring& name,
const font& mfont
) const { return rectangle(); }
UP,
DOWN,
LEFT,
RIGHT
};
// ----------------------------------------------------------------------------------------
button_style_arrow (
arrow_direction dir_
) : dir(dir_) {}
class button_style_down_arrow : public button_style
{
public:
virtual void draw_button (
const canvas& c,
const rectangle& rect,
......@@ -313,6 +261,9 @@ namespace dlib
const ustring& name,
const font& mfont
) const { return rectangle(); }
private:
arrow_direction dir;
};
// ----------------------------------------------------------------------------------------
......@@ -488,17 +439,17 @@ namespace dlib
class scroll_bar_style_default : public scroll_bar_style
{
public:
button_style_up_arrow get_up_button_style (
) const { return button_style_up_arrow(); }
button_style_arrow get_up_button_style (
) const { return button_style_arrow(button_style_arrow::UP); }
button_style_down_arrow get_down_button_style (
) const { return button_style_down_arrow(); }
button_style_arrow get_down_button_style (
) const { return button_style_arrow(button_style_arrow::DOWN); }
button_style_left_arrow get_left_button_style (
) const { return button_style_left_arrow(); }
button_style_arrow get_left_button_style (
) const { return button_style_arrow(button_style_arrow::LEFT); }
button_style_right_arrow get_right_button_style (
) const { return button_style_right_arrow(); }
button_style_arrow get_right_button_style (
) const { return button_style_arrow(button_style_arrow::RIGHT); }
virtual long get_width (
) const { return 16; }
......
......@@ -136,37 +136,27 @@ namespace dlib
// ----------------------------------------------------------------------------------------
class button_style_left_arrow : public button_style
{
/*!
This draws a simple button with a left pointing arrow in it
!*/
};
// ----------------------------------------------------------------------------------------
class button_style_right_arrow : public button_style
class button_style_arrow : public button_style
{
public:
/*!
This draws a simple button with a right pointing arrow in it
This draws a simple button with an arrow in it
!*/
};
// ----------------------------------------------------------------------------------------
class button_style_up_arrow : public button_style
enum arrow_direction
{
/*!
This draws a simple button with an up pointing arrow in it
!*/
UP,
DOWN,
LEFT,
RIGHT
};
// ----------------------------------------------------------------------------------------
class button_style_down_arrow : public button_style
{
button_style_arrow (
arrow_direction dir
);
/*!
This draws a simple button with a down pointing arrow in it
ensures
- the arrow in the button will point in the given direction
!*/
};
......
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