Skip to content

Commit

Permalink
libcommon|Menu: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Sep 22, 2014
1 parent 7502fad commit 0306c24
Show file tree
Hide file tree
Showing 4 changed files with 319 additions and 350 deletions.
63 changes: 29 additions & 34 deletions doomsday/plugins/common/include/menu/page.h
Expand Up @@ -74,7 +74,7 @@ class Page
* @param drawer
* @param cmdResponder
*/
Page(de::String name, Point2Raw const &origin = Point2Raw(), int flags = 0,
Page(de::String name, de::Vector2i const &origin = de::Vector2i(), int flags = 0,
OnDrawCallback drawer = 0,
CommandResponder cmdResponder = 0);

Expand All @@ -85,6 +85,18 @@ class Page
*/
de::String name() const;

void setTitle(de::String const &newTitle);
de::String title() const;

void setOrigin(de::Vector2i const &newOrigin);
de::Vector2i origin() const;

void setX(int x);
void setY(int y);

void setPreviousPage(Page *newPreviousPage);
Page *previousPage() const;

/**
* Adds a widget object as a child widget of the Page and sets up the Widget -> Page
* relationship. The object must be an instance of a class derived from Widget.
Expand All @@ -110,25 +122,6 @@ class Page
*/
Widget &addWidget(Widget *widget);

/**
* Provides access to the list of child widgets of the Page, for efficient traversal.
*/
Widgets const &widgets() const;

/**
* Returns the total number of child widgets of the Page.
*/
inline int widgetCount() const { return widgets().count(); }

void setTitle(de::String const &newTitle);
de::String title() const;

void setX(int x);
void setY(int y);

void setPreviousPage(Page *newPreviousPage);
Page *previousPage() const;

/**
* Locate a widget on the page in the specified @a group.
*
Expand All @@ -142,6 +135,16 @@ class Page

Widget *tryFindWidget(int flags, int group = 0);

/**
* Provides access to the list of child widgets of the Page, for efficient traversal.
*/
Widgets const &widgets() const;

/**
* Returns the total number of child widgets of the Page.
*/
inline int widgetCount() const { return widgets().count(); }

/**
* Returns the in-page index of the given @a widget; otherwise @c -1
*/
Expand All @@ -150,13 +153,12 @@ class Page
}

/**
* Attempt to give focus to the given widget which is thought to be on the page.
* If @a newFocusWidget is present and is not currently in-focus, an out-focus
* action is first sent to the presently focused widget, then this page's focused
* widget is set before finally executing an in-focus action on the new widget.
* If the widget is not found on this page then nothing will happen.
* Attempt to give focus to the widget specified. If @a newFocusWidget is not @c nullptr,
* is present and is not currently in-focus, an out-focus action is first sent to the
* presently focused widget, then this page's focused widget is set before finally
* triggering an in-focus action on the new widget.
*
* @param newFocusWidget Widget to be given focus.
* @param newFocusWidget Widget to be given focus. Use @c nullptr to clear.
*/
void setFocus(Widget *newFocusWidget);

Expand All @@ -165,9 +167,6 @@ class Page
*/
Widget *focusWidget();

void clearFocusWidget();
void refocus();

/**
* Returns the current time in tics since last page activation.
*/
Expand Down Expand Up @@ -216,11 +215,7 @@ class Page
*/
int lineHeight(int *lineOffset = 0);

void initialize();
void initWidgets();
void updateWidgets();

void applyLayout();
void activate();

int handleCommand(menucommand_e cmd);

Expand Down

0 comments on commit 0306c24

Please sign in to comment.