34 class ButtonFrame :
public Frame {
35 friend class RadioBehavior;
136 Widget::setStateId(stateId);
138 !mStateId.empty() &&
rose()->hasSettings()) {
139 setInvert(
rose()->settings()->getValue(mStateId.value(), 0) != 0);
163 std::string mLabelText{};
165 int mLabelFontSize{};
171 ~
Button()
override =
default;
193 template<
typename String>
195 :
Button(std::string{labelString}, type) {}
212 if (
auto label = getSingleChild<Label>(); label)
213 label->setHorizontalAlignment(alignment);
221 if (
auto label = getSingleChild<Label>(); label)
222 label->setVerticalAlignment(alignment);
229 void setText(
const std::string &text)
override {
230 if (
auto label = getSingleChild<Label>(); label)
231 label->setText(text);
239 if (
auto label = getSingleChild<Label>(); label)
240 return label->getText();
241 return std::string{
""};
249 if (
auto label = getSingleChild<Label>(); label)
250 label->setFontName(fontName);
258 if (
auto label = getSingleChild<Label>(); label)
259 label->setFontSize(fontSize);
267 if (
auto label = getSingleChild<Label>(); label)
268 label->setImageId(imageId);
276 if (
auto label = getSingleChild<Label>(); label)
277 label->setRenderFlip(renderFlip);
298 using ButtonListType = std::pair<SignalToken,shared_ptr<ButtonFrame>>;
299 std::vector<ButtonListType> mButtons{};
303 std::shared_ptr<Slot<ButtonFrame::SignalType>> buttonStateRx{};
306 using SignalType = std::tuple<State,int,SignalToken>;
324 void emplace_back(std::shared_ptr<ButtonFrame> &button);
343 [[nodiscard]] std::pair<State,int>
getState()
const {
344 return std::make_pair(
mState, mSelected);
352 setState(state.first, state.second);
361 void setState(State state,
int selected);
370 inline std::shared_ptr<rose::Button>
372 widget->setRenderFlip(renderFlip);
Invalid image ID.
Definition: Constants.h:172
State mState
The object state Id string.
Definition: Visual.h:140
A normal push button.
Definition: Constants.h:90
A Tab widget button.
Definition: Constants.h:95
RoseImageId
Identifiers for Textures created by the Rose object and available from the Rose ImageRepository.
Definition: Constants.h:171
void setState(std::pair< State, int > state)
Set the state, see setState(State,int).
Definition: Button.h:351
A toggle button.
Definition: Constants.h:93
A normal button with a check badge.
Definition: Constants.h:92
A position in integer (x, y) co-ordinates.
Definition: Types.h:95
HorizontalAlignment
Horizontal alignment values.
Definition: Constants.h:254
VerticalAlignment
Vertical alignment values.
Definition: Constants.h:265
std::pair< State, int > getState() const
Get the current state of the RadioBehavior.
Definition: Button.h:343
Constants and Enumerations.
Abstraction of space consumed around an object for space, borders, etc.
Definition: Types.h:454
ButtonSetState
A type alias for bool to set the button state.
Definition: Constants.h:80
ButtonType
The button type.
Definition: PointerInteractions.h:21
A radio button.
Definition: Constants.h:94
A Cascade Button, treated as a NormalButton.
Definition: Constants.h:96
A normal button with a cancel badge.
Definition: Constants.h:91
A Widget manipulator to indicate if and how rendering a texture should be flipped.
Definition: Renderer.h:33
RadioBehavior(bool noneIsValid)
Constructor.
Definition: Button.h:318
A type to specify an Id value.
Definition: StructuredTypes.h:148
A size in integer dimensions.
Definition: Types.h:230
ToDo: There is an issue that the initial scroll interaction is lost if the click/press lands on a Wid...
Definition: CelestialOverlay.cpp:13
void setState(bool state)
Set the state, true = inverted.
Definition: Frame.h:165
void setSize(const Size &size)
Set preferred Size.
Definition: Visual.h:178
This is a list of icon codes for the entypo.ttf font by Daniel Bruce.