ui: delete empty function bodies

This commit is contained in:
Jan Engelhardt 2024-11-03 11:23:33 +01:00
parent ab0e1c7f5b
commit 9687cd5e27
14 changed files with 3 additions and 92 deletions

View File

@ -135,10 +135,6 @@ int UIButton::m_ButtonFont;
// This is a simple 2 state button (push down or push up)
// Buttons have properties of gadgets, plus bitmap information per state.
UIButton::UIButton() {}
UIButton::~UIButton() {}
// if text = NULL, no text printed out.
void UIButton::Create(UIWindow *parent, int id, UIItem *item, int x, int y, int w, int h, int flags) {
if (item) {

View File

@ -45,10 +45,6 @@
// A listbox may contain text items, BUT only one will be visible
// Allows the user to scroll through them too.
UIComboBox::UIComboBox() {}
UIComboBox::~UIComboBox() {}
// creates a combo box
void UIComboBox::Create(UIWindow *parent, int id, int x, int y, int w, int h, int flags) {
m_ItemList = NULL;

View File

@ -70,10 +70,6 @@
// int m_ConsoleFont; // standard font for text in console
// char *m_ConsoleBuffer; // text buffer of console.
UIConsoleGadget::UIConsoleGadget() {}
UIConsoleGadget::~UIConsoleGadget() {}
// font = console font, NOT GADGET FONT. This font is used to proportion window
void UIConsoleGadget::Create(UIWindow *parent, int id, int x, int y, int font, int cols, int rows, int flags) {
int cw, ch, w, h;
@ -266,10 +262,6 @@ void UIConsoleGadget::Scroll() {
// int m_ConsoleFont; // standard font for text in console
// char *m_ConsoleBuffer; // text buffer of console.
UIConsole::UIConsole() {}
UIConsole::~UIConsole() {}
// font = console font, NOT GADGET FONT. This font is used to proportion window
void UIConsole::Create(int x, int y, int font, int cols, int rows) {
UIWindow::Create(x, y, 10, 10);

View File

@ -149,10 +149,6 @@ static UIEdit *UI_current_editbox = NULL;
// UIEdit
// A single line edit control.
UIEdit::UIEdit() {}
UIEdit::~UIEdit() {}
void UIEdit::Create(UIWindow *parent, int id, int x, int y, int w, int h, int flags) {
m_BufSize = 32;
m_TextBuf = (char *)mem_malloc(m_BufSize + 1);

View File

@ -127,10 +127,6 @@ int UIGadget::m_LastKey = 0;
int UIGadget::m_LastKeyCount = 0;
float UIGadget::m_LastKeyTime = 0.0f;
UIGadget::UIGadget() : UIObject() {}
UIGadget::~UIGadget() {}
// ALL Gadgets must have a parent.
void UIGadget::Create(UIWindow *wnd, int id, int x, int y, int w, int h, int flags) {
ASSERT(!IsCreated());

View File

@ -55,10 +55,6 @@
// UIGroup
// Draws a group box on to the window
UIGroup::UIGroup() {}
UIGroup::~UIGroup() {}
void UIGroup::Create(UIWindow *parent, char *label, int x, int y, int w, int h, ddgr_color label_color,
ddgr_color box_color, int flags) {
ASSERT(parent);

View File

@ -85,10 +85,6 @@
// This is simply a region within the parent window that when clicked on
// or key pressed, does something.
UIHotspot::UIHotspot() {}
UIHotspot::~UIHotspot() {}
// optional key, when pressed, triggers hotspot.
void UIHotspot::Create(UIWindow *wnd, int id, int key, UIItem *itemoff, UIItem *itemon, int x, int y, int w, int h,
int flags) {

View File

@ -168,10 +168,6 @@
// Construction and destruction
UIListBox::UIListBox() {}
UIListBox::~UIListBox() {}
void UIListBox::Create(UIWindow *parent, int id, int x, int y, int w, int h, int flags) {
m_NumItems = 0;
m_ItemList = NULL;

View File

@ -42,10 +42,6 @@
#include "log.h"
#include "pserror.h"
UIObject::UIObject() {}
UIObject::~UIObject() {}
// obj = NULL, then this object has no parent: it is an independent entity.
void UIObject::Create(int x, int y, int w, int h) {
ASSERT(!m_Created);

View File

@ -66,10 +66,6 @@
// Construction and destruction
UISlider::UISlider() {}
UISlider::~UISlider() {}
#define SLIDER_BUTTON_WIDTH (switch_item->width() ? switch_item->width() : 16)
#define SLIDER_BUTTON_HEIGHT (switch_item->height() ? switch_item->height() : 16)

View File

@ -87,10 +87,6 @@ void UIText::OnFormat() {
UIGadget::OnFormat();
}
UIStatic::UIStatic() {}
UIStatic::~UIStatic() {}
void UIStatic::Create(UIWindow *parent, UIItem *item, int x, int y, int w, int h, int flags) {
m_Background = NULL;
if (item)

View File

@ -686,10 +686,6 @@ void UIWindow::ResetAcceleratorKey() { m_naccels = 0; }
// ----------------------------------------------------------------------------
// UITitledWindow class
UITitledWindow::UITitledWindow() {}
UITitledWindow::~UITitledWindow() {}
void UITitledWindow::Create(UITextItem &title, int x, int y, int w, int h) {
m_Title = title;
m_BorderThickness = 2;

38
ui/ui.h
View File

@ -303,8 +303,7 @@ protected:
int m_W = 0, m_H = 0; // Dimensions of the UIObject
public:
UIObject();
virtual ~UIObject();
virtual ~UIObject() = default;
void Create(int x, int y, int w, int h); // define the ui object.
void Destroy() { m_Created = false; };
@ -449,9 +448,6 @@ public:
virtual void OnNotify(UIGadget *){}; // usually called by a child gadget of a gadget.
public:
UIGadget();
virtual ~UIGadget();
UIWindow *GetWindow() { // returns the parent window for a gadget.
return m_Wnd;
};
@ -512,9 +508,6 @@ protected:
virtual void OnDestroy(); // override: behavior when gadget is destroyed.
public:
UIHotspot();
virtual ~UIHotspot();
// optional key, when pressed, triggers hotspot.
void Create(UIWindow *wnd, int id, int key, UIItem *itemoff, UIItem *itemon, int x, int y, int w, int h,
int flags = 0);
@ -563,9 +556,6 @@ public:
};
public:
UIButton();
virtual ~UIButton();
void Create(UIWindow *parent, int id, UIItem *title, int x, int y, int w, int h, int flags = 0);
virtual tUIClass Class() const { // Overide this function to name the class
@ -668,9 +658,6 @@ protected:
UIItem *m_Title = nullptr;
public:
UIStatic();
virtual ~UIStatic();
void Create(UIWindow *parent, UIItem *item, int x, int y, int w, int h, int flags = 0);
void SetBackground(UIPrimativeItem *prim);
void SetTitle(UIItem *item);
@ -718,8 +705,6 @@ protected:
class UIGroup final : public UIStatic {
public:
UIGroup();
~UIGroup();
void Create(UIWindow *parent, char *label, int x, int y, int w, int h, ddgr_color label_color = GR_WHITE,
ddgr_color box_color = GR_WHITE, int flags = 0);
@ -776,9 +761,6 @@ protected:
virtual void OnDestroy(); // override: behavior when gadget is destroyed.
public:
UIEdit();
virtual ~UIEdit();
void Create(UIWindow *parent, int id, int x, int y, int w, int h, int flags = 0);
// settings
@ -813,9 +795,6 @@ class UISlider : public UIGadget {
UIItem *slider_item = nullptr; // slider item
public:
UISlider();
virtual ~UISlider();
void Create(UIWindow *parent, int id, int x, int y, int w, int h, int flags = 0);
// sets visual characteristics of slider.
@ -884,9 +863,6 @@ protected:
int m_CX, m_CY, m_CX2, m_CY2; // clipping text.
public:
UIListBox();
virtual ~UIListBox();
void Create(UIWindow *parent, int id, int x, int y, int w, int h, int flags = 0);
virtual tUIClass Class() const { // Overide this function to name the class
@ -951,9 +927,6 @@ public:
class UIComboBox : public UIGadget {
public:
UIComboBox();
virtual ~UIComboBox();
void Create(UIWindow *parent, int id, int x, int y, int w, int h, int flags = 0);
private:
@ -1022,9 +995,6 @@ protected:
virtual void OnDestroy(); // behavior when gadget is destroyed.
public:
UIConsoleGadget();
virtual ~UIConsoleGadget();
// font = console font, NOT GADGET FONT. This font is used to proportion window
void Create(UIWindow *parent, int id, int x, int y, int font, int cols, int rows, int flags = UIF_BORDER);
@ -1149,9 +1119,6 @@ class UITitledWindow final : public UIWindow {
int m_BorderThickness; // border thickness.
public:
UITitledWindow();
virtual ~UITitledWindow();
void Create(UITextItem &title, int x, int y, int w, int h);
// class id
@ -1187,9 +1154,6 @@ protected:
virtual void OnDraw();
public:
UIConsole();
virtual ~UIConsole();
// font = console font, NOT GADGET FONT. This font is used to proportion window
void Create(int x, int y, int font, int cols, int rows);
void Destroy();

View File

@ -99,8 +99,7 @@ enum tUIDrawClass { uiDrawNormal, uiDrawAlphaSaturate, uiDrawFaded };
class UIItem {
public:
UIItem(){};
virtual ~UIItem(){};
virtual ~UIItem() = default;
// if returns false, then it didn't draw.
virtual bool draw(int x, int y, tUIDrawClass draw_class = uiDrawNormal) { return false; };
@ -235,7 +234,7 @@ public:
m_IsChunked = false;
m_Bitmap.handle = bm_handle;
};
virtual ~UIBitmapItem(){};
virtual ~UIBitmapItem() = default;
// if returns false, then it didn't draw.
virtual bool draw(int x, int y, tUIDrawClass draw_class = uiDrawNormal);