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 ...@@ -285,23 +285,17 @@ namespace dlib
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
namespace arrow_button_style_helper void button_style_arrow::
{ draw_button (
enum arrow_direction
{
UP,
DOWN,
LEFT,
RIGHT
};
void draw_arrow_button (
const canvas& c, const canvas& c,
const rectangle& rect, const rectangle& rect,
const bool enabled, const bool enabled,
const bool is_depressed, const font& mfont,
const arrow_direction dir const long lastx,
) const long lasty,
const ustring& name,
const bool is_depressed
) const
{ {
rectangle area = rect.intersect(c); rectangle area = rect.intersect(c);
if (area.is_empty()) if (area.is_empty())
...@@ -405,83 +399,6 @@ namespace dlib ...@@ -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 ...@@ -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: 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 ( enum arrow_direction
const ustring& name,
const font& mfont
) const { return rectangle(); }
};
// ----------------------------------------------------------------------------------------
class button_style_up_arrow : public button_style
{ {
public: UP,
virtual void draw_button ( DOWN,
const canvas& c, LEFT,
const rectangle& rect, RIGHT
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(); }
}; };
// ---------------------------------------------------------------------------------------- button_style_arrow (
arrow_direction dir_
) : dir(dir_) {}
class button_style_down_arrow : public button_style
{
public:
virtual void draw_button ( virtual void draw_button (
const canvas& c, const canvas& c,
const rectangle& rect, const rectangle& rect,
...@@ -313,6 +261,9 @@ namespace dlib ...@@ -313,6 +261,9 @@ namespace dlib
const ustring& name, const ustring& name,
const font& mfont const font& mfont
) const { return rectangle(); } ) const { return rectangle(); }
private:
arrow_direction dir;
}; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
...@@ -488,17 +439,17 @@ namespace dlib ...@@ -488,17 +439,17 @@ namespace dlib
class scroll_bar_style_default : public scroll_bar_style class scroll_bar_style_default : public scroll_bar_style
{ {
public: public:
button_style_up_arrow get_up_button_style ( button_style_arrow get_up_button_style (
) const { return button_style_up_arrow(); } ) const { return button_style_arrow(button_style_arrow::UP); }
button_style_down_arrow get_down_button_style ( button_style_arrow get_down_button_style (
) const { return button_style_down_arrow(); } ) const { return button_style_arrow(button_style_arrow::DOWN); }
button_style_left_arrow get_left_button_style ( button_style_arrow get_left_button_style (
) const { return button_style_left_arrow(); } ) const { return button_style_arrow(button_style_arrow::LEFT); }
button_style_right_arrow get_right_button_style ( button_style_arrow get_right_button_style (
) const { return button_style_right_arrow(); } ) const { return button_style_arrow(button_style_arrow::RIGHT); }
virtual long get_width ( virtual long get_width (
) const { return 16; } ) const { return 16; }
......
...@@ -136,37 +136,27 @@ namespace dlib ...@@ -136,37 +136,27 @@ namespace dlib
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
class button_style_left_arrow : public button_style class button_style_arrow : public button_style
{
/*!
This draws a simple button with a left pointing arrow in it
!*/
};
// ----------------------------------------------------------------------------------------
class button_style_right_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
!*/ !*/
};
// ---------------------------------------------------------------------------------------- enum arrow_direction
class button_style_up_arrow : public button_style
{ {
/*! UP,
This draws a simple button with an up pointing arrow in it DOWN,
!*/ LEFT,
RIGHT
}; };
// ---------------------------------------------------------------------------------------- button_style_arrow (
arrow_direction dir
class button_style_down_arrow : public button_style );
{
/*! /*!
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