Skip to content

Commit

Permalink
Scrollbar: made tstate enum public
Browse files Browse the repository at this point in the history
We should evaluate whether this should be done for all widgets. Right now, having them private makes a public get_state
rather useless, since it can't be stored or compared against anything.
  • Loading branch information
Vultraz committed Oct 22, 2016
1 parent 2e982c0 commit 4595e8d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/gui/widgets/scrollbar.hpp
Expand Up @@ -111,6 +111,19 @@ class tscrollbar_ : public tcontrol
/** See @ref tcontrol::get_state. */
virtual unsigned get_state() const override;

/**
* Possible states of the widget.
*
* Note the order of the states must be the same as defined in settings.hpp.
*/
enum tstate {
ENABLED,
DISABLED,
PRESSED,
FOCUSED,
COUNT
};

/***** ***** ***** setters / getters for members ***** ****** *****/

void set_item_count(const unsigned item_count)
Expand Down Expand Up @@ -183,19 +196,6 @@ class tscrollbar_ : public tcontrol
}

private:
/**
* Possible states of the widget.
*
* Note the order of the states must be the same as defined in settings.hpp.
*/
enum tstate {
ENABLED,
DISABLED,
PRESSED,
FOCUSED,
COUNT
};

void set_state(const tstate state);
/**
* Current state of the widget.
Expand Down

3 comments on commit 4595e8d

@CelticMinstrel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it could be compared against a number.

@Vultraz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing a enum value against a number constant is evil :|

@CelticMinstrel
Copy link
Member

@CelticMinstrel CelticMinstrel commented on 4595e8d Oct 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure set_retval and get_retval work exactly like this. (Okay, that's not comparing, but still.)

Please sign in to comment.