mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[escher/button_row_controller] Access the app directly
This commit is contained in:
committed by
EmilieNumworks
parent
e4ec398ecd
commit
2888eddd06
@@ -6,7 +6,6 @@
|
||||
#include <escher/invocation.h>
|
||||
#include <escher/i18n.h>
|
||||
#include <escher/button.h>
|
||||
#include <escher/app.h>
|
||||
#include <assert.h>
|
||||
|
||||
class ButtonRowDelegate;
|
||||
@@ -48,7 +47,7 @@ private:
|
||||
View * subviewAtIndex(int index) override;
|
||||
void layoutSubviews() override;
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
bool setSelectedButton(int selectedButton, App * app);
|
||||
bool setSelectedButton(int selectedButton);
|
||||
int selectedButton() const { return m_selectedButton; }
|
||||
ViewController * mainViewController() const { return m_mainViewController; }
|
||||
ButtonRowDelegate * buttonRowDelegate() const { return m_delegate; }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <escher/button_row_controller.h>
|
||||
#include <escher/app.h>
|
||||
#include <escher/palette.h>
|
||||
#include <cmath>
|
||||
|
||||
@@ -141,7 +142,7 @@ void ButtonRowController::ContentView::drawRect(KDContext * ctx, KDRect rect) co
|
||||
}
|
||||
}
|
||||
|
||||
bool ButtonRowController::ContentView::setSelectedButton(int selectedButton, App * application) {
|
||||
bool ButtonRowController::ContentView::setSelectedButton(int selectedButton) {
|
||||
if (selectedButton < -1 || selectedButton >= numberOfButtons() || selectedButton == m_selectedButton) {
|
||||
return false;
|
||||
}
|
||||
@@ -153,7 +154,7 @@ bool ButtonRowController::ContentView::setSelectedButton(int selectedButton, App
|
||||
if (m_selectedButton >= 0) {
|
||||
Button * button = buttonAtIndex(selectedButton);
|
||||
button->setHighlighted(true);
|
||||
application->setFirstResponder(button);
|
||||
app()->setFirstResponder(button);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -178,8 +179,7 @@ int ButtonRowController::selectedButton() {
|
||||
}
|
||||
|
||||
bool ButtonRowController::setSelectedButton(int selectedButton) {
|
||||
App * application = app();
|
||||
return m_contentView.setSelectedButton(selectedButton, application);
|
||||
return m_contentView.setSelectedButton(selectedButton);
|
||||
}
|
||||
|
||||
void ButtonRowController::setMessageOfButtonAtIndex(I18n::Message message, int index) {
|
||||
|
||||
Reference in New Issue
Block a user