Skip to content

Commit

Permalink
Refactor|libcommon|Menu: Continued reworking menu widgets
Browse files Browse the repository at this point in the history
Widget geometry, page layouts (etc.) now use libcore components such
as de::Rectangle<> Widget drawing functions now const. Cleaned up the
Widget::Action mechanism. Various minor cleanup refactorings.
  • Loading branch information
danij-deng committed Sep 22, 2014
1 parent 0306c24 commit ed50904
Show file tree
Hide file tree
Showing 40 changed files with 723 additions and 944 deletions.
10 changes: 5 additions & 5 deletions doomsday/plugins/common/include/hu_menu.h
Expand Up @@ -188,12 +188,12 @@ void Hu_MenuConsoleRegister();

// ----------------------------------------------------------------------------------------

void Hu_MenuDefaultFocusAction(menu::Widget *wi, menu::Widget::mn_actionid_t action);
void Hu_MenuDefaultFocusAction(menu::Widget &wi, menu::Widget::Action action);

void Hu_MenuDrawFocusCursor(int x, int y, int focusObjectHeight, float alpha);
void Hu_MenuDrawFocusCursor(de::Vector2i const &origin, int focusObjectHeight, float alpha);

void Hu_MenuDrawPageTitle(de::String title, int x, int y);
void Hu_MenuDrawPageHelp(char const *help, int x, int y);
void Hu_MenuDrawPageTitle(de::String titleText, de::Vector2i const &origin);
void Hu_MenuDrawPageHelp(de::String helpText, de::Vector2i const &origin);

/**
* @defgroup menuEffectFlags Menu Effect Flags
Expand All @@ -206,7 +206,7 @@ void Hu_MenuDrawPageHelp(char const *help, int x, int y);
#define MEF_EVERYTHING MEF_TEXT_TYPEIN | MEF_TEXT_SHADOW | MEF_TEXT_GLITTER
///@}

short Hu_MenuMergeEffectWithDrawTextFlags(short f);
short Hu_MenuMergeEffectWithDrawTextFlags(short flags);

} // namespace common

Expand Down
5 changes: 1 addition & 4 deletions doomsday/plugins/common/include/m_ctrl.h
Expand Up @@ -27,8 +27,6 @@
namespace common {
namespace menu {

class Page;

// Control config flags.
#define CCF_NON_INVERSE 0x1
#define CCF_INVERSE 0x2
Expand All @@ -46,8 +44,7 @@ struct controlconfig_t
int flags;
};

void Hu_MenuInitControlsPage(void);
void Hu_MenuDrawControlsPage(Page *page, Point2Raw const *origin);
void Hu_MenuInitControlsPage();
void Hu_MenuControlGrabDrawer(char const *niceName, float alpha);

} // namespace menu
Expand Down
6 changes: 3 additions & 3 deletions doomsday/plugins/common/include/menu/page.h
Expand Up @@ -58,10 +58,10 @@ class Page
public:
typedef QList<Widget *> Widgets;

typedef void (*OnActiveCallback) (Page *);
typedef void (*OnDrawCallback) (Page *, Point2Raw const *);
typedef void (*OnActiveCallback) (Page &);
typedef void (*OnDrawCallback) (Page const &, de::Vector2i const &);

typedef int (*CommandResponder) (Page *, menucommand_e);
typedef int (*CommandResponder) (Page &, menucommand_e);

public:
/**
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/include/menu/widgets/buttonwidget.h
Expand Up @@ -35,8 +35,8 @@ class ButtonWidget : public Widget
explicit ButtonWidget(de::String const &text = "", patchid_t patch = 0);
virtual ~ButtonWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();
int handleCommand(menucommand_e command);

ButtonWidget &setText(de::String const &newText);
Expand Down
Expand Up @@ -49,8 +49,8 @@ class ColorEditWidget : public Widget
bool rgbaMode = false);
virtual ~ColorEditWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();
int handleCommand(menucommand_e command);

/**
Expand Down
Expand Up @@ -51,7 +51,7 @@ class CVarColorEditWidget : public ColorEditWidget
char const *_cvarPaths[4];
};

void CVarColorEditWidget_UpdateCVar(Widget *wi, Widget::mn_actionid_t action);
void CVarColorEditWidget_UpdateCVar(Widget &wi, Widget::Action action);

} // namespace menu
} // namespace common
Expand Down
Expand Up @@ -43,7 +43,7 @@ class CVarInlineListWidget : public InlineListWidget
int _cvarValueMask;
};

void CVarInlineListWidget_UpdateCVar(Widget *wi, Widget::mn_actionid_t action);
void CVarInlineListWidget_UpdateCVar(Widget &wi, Widget::Action action);

} // namespace menu
} // namespace common
Expand Down
Expand Up @@ -41,7 +41,7 @@ class CVarLineEditWidget : public LineEditWidget
char const *_cvarPath;
};

void CVarLineEditWidget_UpdateCVar(Widget *wi, Widget::mn_actionid_t action);
void CVarLineEditWidget_UpdateCVar(Widget &wi, Widget::Action action);

} // namespace menu
} // namespace common
Expand Down
Expand Up @@ -44,7 +44,7 @@ class CVarSliderWidget : public SliderWidget
char const *_cvarPath;
};

void CVarSliderWidget_UpdateCVar(Widget *wi, Widget::mn_actionid_t action);
void CVarSliderWidget_UpdateCVar(Widget &wi, Widget::Action action);

} // namespace menu
} // namespace common
Expand Down
Expand Up @@ -39,8 +39,8 @@ class CVarTextualSliderWidget : public CVarSliderWidget
float step = 0.1f, bool floatMode = true);
virtual ~CVarTextualSliderWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();

CVarTextualSliderWidget &setEmptyText(de::String const &newEmptyText);
de::String emptyText() const;
Expand Down
Expand Up @@ -64,7 +64,7 @@ class CVarToggleWidget : public ButtonWidget
DENG2_PRIVATE(d)
};

void CVarToggleWidget_UpdateCVar(Widget *wi, Widget::mn_actionid_t action);
void CVarToggleWidget_UpdateCVar(Widget &wi, Widget::Action action);

} // namespace menu
} // namespace common
Expand Down
Expand Up @@ -33,10 +33,10 @@ class InlineListWidget : public ListWidget
{
public:
InlineListWidget();
virtual ~InlineListWidget() {}
virtual ~InlineListWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();
int handleCommand(menucommand_e command);
};

Expand Down
Expand Up @@ -40,10 +40,10 @@ class InputBindingWidget : public Widget

public:
InputBindingWidget();
virtual ~InputBindingWidget() {}
virtual ~InputBindingWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();
int handleEvent_Privileged(event_t *ev);
int handleCommand(menucommand_e command);

Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/include/menu/widgets/labelwidget.h
Expand Up @@ -45,8 +45,8 @@ class LabelWidget : public Widget
LabelWidget(de::String const &text = "", patchid_t *patch = 0);
virtual ~LabelWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();

LabelWidget &setPatch(patchid_t *newPatch);
LabelWidget &setText(de::String const &newText);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/include/menu/widgets/lineeditwidget.h
Expand Up @@ -66,8 +66,8 @@ class LineEditWidget : public Widget
LineEditWidget();
virtual ~LineEditWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();
int handleEvent(event_t *ev);
int handleCommand(menucommand_e command);

Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/include/menu/widgets/listwidget.h
Expand Up @@ -68,8 +68,8 @@ class ListWidget : public Widget
ListWidget();
virtual ~ListWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();
int handleCommand(menucommand_e command);

/**
Expand Down
Expand Up @@ -40,8 +40,8 @@ class MobjPreviewWidget : public Widget
MobjPreviewWidget();
virtual ~MobjPreviewWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();

void setMobjType(int mobjType);
void setPlayerClass(int plrClass);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/include/menu/widgets/rectwidget.h
Expand Up @@ -37,8 +37,8 @@ class RectWidget : public Widget
explicit RectWidget(patchid_t backgroundPatch = 0);
virtual ~RectWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();

/**
* Apply the Patch graphic referenced by @a patch as the background for this rect.
Expand Down
6 changes: 2 additions & 4 deletions doomsday/plugins/common/include/menu/widgets/sliderwidget.h
Expand Up @@ -62,12 +62,10 @@ class SliderWidget : public Widget
explicit SliderWidget(float min = 0.0f, float max = 1.0f, float step = 0.1f, bool floatMode = true);
virtual ~SliderWidget();

void draw(Point2Raw const *origin);
void updateGeometry(Page *pagePtr);
void draw() const;
void updateGeometry();
int handleCommand(menucommand_e command);

int thumbPos() const;

/**
* Change the current value represented by the slider.
* @param value New value.
Expand Down

0 comments on commit ed50904

Please sign in to comment.