Files
Upsilon/escher/include/escher/button_state.h
Hugo Saint-Vignes 2f97dab6d1 [apps/shared] Add toggle buttons in Graph view
Change-Id: I7548d11fb114b2605ce34d3bda0776277b79ff9d
2020-11-04 15:58:25 +01:00

25 lines
743 B
C++

#ifndef ESCHER_BUTTON_STATE_H
#define ESCHER_BUTTON_STATE_H
#include <escher/button.h>
#include <escher/toggleable_dot_view.h>
class ButtonState : public Button {
public:
using Button::Button;
void setState(bool state) { m_stateView.setState(state); }
KDSize minimalSizeForOptimalDisplay() const override;
void drawRect(KDContext * ctx, KDRect rect) const override;
private:
// Dot right margin.
constexpr static KDCoordinate k_stateMargin = 9;
// Dot vertical position offset.
constexpr static KDCoordinate k_verticalOffset = 5;
int numberOfSubviews() const override { return 2; }
View * subviewAtIndex(int index) override;
void layoutSubviews(bool force = false) override;
ToggleableDotView m_stateView;
};
#endif