Skip to content
Permalink
Browse files

change a bunch of virtual to override (should fix annoying mac compil…

…e warnings)
  • Loading branch information...
jacob1 committed Mar 1, 2019
1 parent 79aef1d commit dd3d9dfaad8d26ab46ff611d49a85a02542a1369
@@ -27,20 +27,20 @@ class AvatarButton : public Component, public RequestListener
AvatarButton(Point position, Point size, ByteString username);
virtual ~AvatarButton();

virtual void OnMouseClick(int x, int y, unsigned int button);
virtual void OnMouseUnclick(int x, int y, unsigned int button);
void OnMouseClick(int x, int y, unsigned int button) override;
void OnMouseUnclick(int x, int y, unsigned int button) override;

virtual void OnMouseEnter(int x, int y);
virtual void OnMouseLeave(int x, int y);
void OnMouseEnter(int x, int y) override;
void OnMouseLeave(int x, int y) override;

virtual void OnContextMenuAction(int item);
void OnContextMenuAction(int item) override;

virtual void Draw(const Point& screenPos);
virtual void Tick(float dt);
void Draw(const Point& screenPos) override;
void Tick(float dt) override;

virtual void OnResponseReady(void * imagePtr, int identifier);
void OnResponseReady(void * imagePtr, int identifier) override;

virtual void DoAction();
void DoAction();

void SetUsername(ByteString username) { name = username; }
ByteString GetUsername() { return name; }
@@ -24,20 +24,20 @@ class Button : public Component
Button(Point position = Point(0, 0), Point size = Point(0, 0), String buttonText = String(), String toolTip = String());
virtual ~Button();

virtual void OnMouseClick(int x, int y, unsigned int button);
virtual void OnMouseUnclick(int x, int y, unsigned int button);
virtual void OnMouseUp(int x, int y, unsigned int button);
void OnMouseClick(int x, int y, unsigned int button) override;
void OnMouseUnclick(int x, int y, unsigned int button) override;
void OnMouseUp(int x, int y, unsigned int button) override;

virtual void OnMouseEnter(int x, int y);
virtual void OnMouseHover(int x, int y);
virtual void OnMouseLeave(int x, int y);
void OnMouseEnter(int x, int y) override;
void OnMouseHover(int x, int y) override;
void OnMouseLeave(int x, int y) override;

virtual void Draw(const Point& screenPos);
void Draw(const Point& screenPos) override;

virtual void TextPosition(String);
void TextPosition(String) override;
inline bool GetState() { return state; }
virtual void DoAction(); //action of button what ever it may be
virtual void DoAltAction(); //action of button what ever it may be
void DoAction(); //action of button what ever it may be
void DoAltAction(); //action of button what ever it may be
void SetTogglable(bool isTogglable);
bool GetTogglable();
bool GetToggleState();
@@ -23,12 +23,12 @@ class Checkbox: public ui::Component {
void SetText(String text);
String GetText();
void SetIcon(Icon icon);
void Draw(const Point& screenPos);
virtual void OnMouseEnter(int x, int y);
virtual void OnMouseHover(int x, int y);
virtual void OnMouseLeave(int x, int y);
virtual void OnMouseClick(int x, int y, unsigned int button);
virtual void OnMouseUp(int x, int y, unsigned int button);
void Draw(const Point& screenPos) override;
void OnMouseEnter(int x, int y) override;
void OnMouseHover(int x, int y) override;
void OnMouseLeave(int x, int y) override;
void OnMouseClick(int x, int y, unsigned int button) override;
void OnMouseUp(int x, int y, unsigned int button) override;
void SetActionCallback(CheckboxAction * action);
CheckboxAction * GetActionCallback() { return actionCallback; }
bool GetChecked() { return checked; }
@@ -25,13 +25,13 @@ class ContextMenu: public ui::Window, public ButtonAction {
ui::Appearance Appearance;
class ItemSelectedAction;
ContextMenu(Component * source);
virtual void ActionCallbackItem(ui::Button *sender, int item);
virtual void AddItem(ContextMenuItem item);
virtual void RemoveItem(int id);
virtual void SetItem(int id, String text);
virtual void Show(ui::Point position);
virtual void OnDraw();
virtual void OnMouseDown(int x, int y, unsigned button);
void ActionCallbackItem(ui::Button *sender, int item);
void AddItem(ContextMenuItem item);
void RemoveItem(int id);
void SetItem(int id, String text);
void Show(ui::Point position);
void OnDraw() override;
void OnMouseDown(int x, int y, unsigned button) override;
virtual ~ContextMenu() {}
};
}
@@ -12,10 +12,10 @@ class CopyTextButton : public Button
public:
CopyTextButton(Point position, Point size, String buttonText, Label *copyTextLabel_);

virtual void OnMouseClick(int x, int y, unsigned int button);
void OnMouseClick(int x, int y, unsigned int button) override;

virtual void OnMouseEnter(int x, int y);
virtual void OnMouseLeave(int x, int y);
void OnMouseEnter(int x, int y) override;
void OnMouseLeave(int x, int y) override;
};
}
#endif /* COPYTEXTBUTTON_H */
@@ -30,10 +30,10 @@ class DropDown: public ui::Component {
void RemoveOption(String option);
void SetOptions(std::vector<std::pair<String, int> > options);
void SetActionCallback(DropDownAction * action) { callback = action;}
virtual void Draw(const Point& screenPos);
virtual void OnMouseClick(int x, int y, unsigned int button);
virtual void OnMouseEnter(int x, int y);
virtual void OnMouseLeave(int x, int y);
void Draw(const Point& screenPos) override;
void OnMouseClick(int x, int y, unsigned int button) override;
void OnMouseEnter(int x, int y) override;
void OnMouseLeave(int x, int y) override;
virtual ~DropDown();
};

@@ -38,33 +38,33 @@ namespace ui
int getLowerSelectionBound();
int getHigherSelectionBound();

virtual void copySelection();
void copySelection();
public:
//Label(Window* parent_state, String labelText);
Label(Point position, Point size, String labelText);
//Label(String labelText);
virtual ~Label();

virtual void SetMultiline(bool status);
void SetMultiline(bool status);

virtual void SetText(String text);
virtual void SetDisplayText(String newText);
virtual String GetText();

virtual bool HasSelection();
virtual void ClearSelection();
virtual void selectAll();
virtual void AutoHeight();
bool HasSelection();
void ClearSelection();
void selectAll();
void AutoHeight();

void SetTextColour(Colour textColour) { this->textColour = textColour; }

virtual void OnContextMenuAction(int item);
virtual void OnMouseClick(int x, int y, unsigned button);
virtual void OnMouseUp(int x, int y, unsigned button);
virtual void OnMouseMoved(int localx, int localy, int dx, int dy);
virtual void OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
virtual void Draw(const Point& screenPos);
virtual void Tick(float dt);
void OnContextMenuAction(int item) override;
void OnMouseClick(int x, int y, unsigned button) override;
void OnMouseUp(int x, int y, unsigned button) override;
void OnMouseMoved(int localx, int localy, int dx, int dy) override;
void OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt) override;
void Draw(const Point& screenPos) override;
void Tick(float dt) override;
};
}

@@ -11,11 +11,11 @@ namespace ui
String progressStatus;
public:
ProgressBar(Point position, Point size, int startProgress = 0, String startStatus = String());
virtual void SetProgress(int progress);
virtual int GetProgress();
virtual void SetStatus(String status);
virtual String GetStatus();
virtual void Draw(const Point & screenPos);
virtual void Tick(float dt);
void SetProgress(int progress);
int GetProgress();
void SetStatus(String status);
String GetStatus();
void Draw(const Point & screenPos) override;
void Tick(float dt) override;
};
}
@@ -22,12 +22,12 @@ namespace ui

virtual ~RichLabel();

virtual void SetText(String text);
virtual String GetDisplayText();
virtual String GetText();
void SetText(String text);
String GetDisplayText();
String GetText();

virtual void Draw(const Point& screenPos);
virtual void OnMouseClick(int x, int y, unsigned button);
void Draw(const Point& screenPos) override;
void OnMouseClick(int x, int y, unsigned button) override;
protected:
String textSource;
String displayText;
@@ -44,21 +44,21 @@ class SaveButton : public Component, public RequestListener
SaveButton(Point position, Point size, SaveFile * file);
virtual ~SaveButton();

virtual void OnMouseClick(int x, int y, unsigned int button);
virtual void OnMouseUnclick(int x, int y, unsigned int button);
void OnMouseClick(int x, int y, unsigned int button) override;
void OnMouseUnclick(int x, int y, unsigned int button) override;

virtual void OnMouseEnter(int x, int y);
virtual void OnMouseLeave(int x, int y);
void OnMouseEnter(int x, int y) override;
void OnMouseLeave(int x, int y) override;

virtual void OnMouseMovedInside(int x, int y, int dx, int dy);
void OnMouseMovedInside(int x, int y, int dx, int dy) override;

void AddContextMenu(int menuType);
virtual void OnContextMenuAction(int item);
void OnContextMenuAction(int item) override;

virtual void Draw(const Point& screenPos);
virtual void Tick(float dt);
void Draw(const Point& screenPos) override;
void Tick(float dt) override;

virtual void OnResponseReady(void * imagePtr, int identifier);
void OnResponseReady(void * imagePtr, int identifier) override;

void SetSelected(bool selected_) { selected = selected_; }
bool GetSelected() { return selected; }
@@ -69,10 +69,10 @@ class SaveButton : public Component, public RequestListener
SaveInfo * GetSave() { return save; }
SaveFile * GetSaveFile() { return file; }
inline bool GetState() { return state; }
virtual void DoAction();
virtual void DoAltAction();
virtual void DoAltAction2();
virtual void DoSelection();
void DoAction();
void DoAltAction();
void DoAltAction2();
void DoSelection();
void SetActionCallback(SaveButtonAction * action);
protected:
bool isButtonDown, state, isMouseInside, selected, selectable;
@@ -25,11 +25,11 @@ namespace ui
int GetScrollLimit();
void SetScrollPosition(int position);

virtual void Draw(const Point& screenPos);
virtual void XTick(float dt);
virtual void XOnMouseWheelInside(int localx, int localy, int d);
virtual void XOnMouseClick(int localx, int localy, unsigned int button);
virtual void XOnMouseUp(int x, int y, unsigned int button);
virtual void XOnMouseMoved(int localx, int localy, int dx, int dy);
void Draw(const Point& screenPos) override;
void XTick(float dt) override;
void XOnMouseWheelInside(int localx, int localy, int d) override;
void XOnMouseClick(int localx, int localy, unsigned int button) override;
void XOnMouseUp(int x, int y, unsigned int button) override;
void XOnMouseMoved(int localx, int localy, int dx, int dy) override;
};
}
@@ -23,10 +23,10 @@ class Slider: public ui::Component {
void updatePosition(int position);
public:
Slider(Point position, Point size, int steps);
virtual void OnMouseMoved(int x, int y, int dx, int dy);
virtual void OnMouseClick(int x, int y, unsigned button);
virtual void OnMouseUp(int x, int y, unsigned button);
virtual void Draw(const Point& screenPos);
void OnMouseMoved(int x, int y, int dx, int dy) override;
void OnMouseClick(int x, int y, unsigned button) override;
void OnMouseUp(int x, int y, unsigned button) override;
void Draw(const Point& screenPos) override;
void SetColour(Colour col1, Colour col2);
void SetActionCallback(SliderAction * action) { actionCallback = action; }
int GetValue();
@@ -12,8 +12,8 @@ class Spinner: public Component
int tickInternal;
public:
Spinner(Point position, Point size);
virtual void Tick(float dt);
virtual void Draw(const Point& screenPos);
void Tick(float dt) override;
void Draw(const Point& screenPos) override;
virtual ~Spinner();
};

@@ -28,8 +28,8 @@ class Textbox : public Label
Textbox(Point position, Point size, String textboxText = String(), String textboxPlaceholder = String());
virtual ~Textbox();

virtual void SetText(String text);
virtual String GetText();
void SetText(String text) override;
String GetText() override;

virtual void SetPlaceholder(String text);

@@ -50,16 +50,16 @@ class Textbox : public Label
bool CharacterValid(int character);
bool StringValid(String text);

virtual void Tick(float dt);
virtual void OnContextMenuAction(int item);
virtual void OnMouseClick(int x, int y, unsigned button);
virtual void OnMouseUp(int x, int y, unsigned button);
virtual void OnMouseMoved(int localx, int localy, int dx, int dy);
virtual void OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
virtual void OnVKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
virtual void OnKeyRelease(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
void OnTextInput(String text) override;
virtual void Draw(const Point& screenPos);
void Tick(float dt) override;
void OnContextMenuAction(int item) override;
void OnMouseClick(int x, int y, unsigned button) override;
void OnMouseUp(int x, int y, unsigned button) override;
void OnMouseMoved(int localx, int localy, int dx, int dy);
void OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt) override;
void OnVKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
void OnKeyRelease(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt) override;
void OnTextInput(String text);
void Draw(const Point& screenPos) override;

protected:
ValidInput inputType;

3 comments on commit dd3d9df

@wolfy1339

This comment has been minimized.

Copy link
Contributor

wolfy1339 replied Mar 1, 2019

Still a bunch of errors related to this. Add -Winconsistent-missing-override to the build flags (or use --debugging) and you'll see

@wolfy1339

This comment has been minimized.

Copy link
Contributor

wolfy1339 replied Mar 1, 2019

Another good one to use is -Woverloaded-virtual, and if you really want to get funky turn on -Wextra

@jacob1

This comment has been minimized.

Copy link
Member Author

jacob1 replied Mar 1, 2019

Yeah I have a feeling the compile logs weren't showing everything. I just manually went through src/gui/interface looking for things.

I'll add those warnings and fix the rest properly later.

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.