resonance 1.0.1
Loading...
Searching...
No Matches
metbuttonlist.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <vector>
5
6#include "os/hxstr.h"
7#include "rnd/button.h"
8#include "rnd/text.h"
9
35public:
44 void *operator new(size_t nSize);
45
55 void operator delete(void *pBlock);
56
66 }
67
74 virtual ~MetButtonList();
75
85 virtual void SelectPrevious();
86
96 virtual void SelectNext();
97
110 virtual void ChangeButtonSelected(int nPreviousIndex, int nIndex);
111
121 void Clear();
122
138 void Add(const HxStr &objectName, const HxStr &labelText);
139
151 void Append(Rnd::Button *pButton, const HxStr &labelText) {
152 mButtons.push_back(pButton);
153 if (labelText.mLen != 0) {
154 pButton->mText->SetText(labelText);
155 }
156 }
157
173 void SetSelected(int nIndex);
174
183 Rnd::Button *GetButton(int nIndex) const;
184
196
207 std::vector<Rnd::Button *> mButtons;
208
217};
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
unsigned mLen
Length excluding the terminator.
Definition hxstr.h:453
Rnd::Button * mSelectedButton
The button SetSelected() last stored.
Definition metbuttonlist.h:195
MetButtonList()
Construct an empty list with nothing selected.
Definition metbuttonlist.h:65
int mSelected
Index of the selected button, or -1 for none.
Definition metbuttonlist.h:216
void SetSelected(int nIndex)
Move the selection to one index.
virtual void SelectPrevious()
Move the selection to the previous enabled button, wrapping from the first to the last.
virtual void ChangeButtonSelected(int nPreviousIndex, int nIndex)
Respond to the selection moving.
virtual void SelectNext()
Move the selection to the next enabled button, wrapping from the last to the first.
virtual ~MetButtonList()
Release every button reference and the vector.
void Add(const HxStr &objectName, const HxStr &labelText)
Resolve one button by object name and append it.
void Append(Rnd::Button *pButton, const HxStr &labelText)
Append one resolved button and apply its label.
Definition metbuttonlist.h:151
std::vector< Rnd::Button * > mButtons
The buttons in list order.
Definition metbuttonlist.h:207
Rnd::Button * GetButton(int nIndex) const
Resolve one button by index.
void Clear()
Release every button reference and empty mButtons.
Selectable widget, as one mesh and one text run plus a palette for each.
Definition button.h:39
Text * mText
Label drawn over mMesh.
Definition button.h:268
virtual void SetText(const HxStr &text)
Replace the text.