Skip to content

Commit

Permalink
gui cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Feb 2, 2020
1 parent fa92881 commit a02b4e6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
3 changes: 0 additions & 3 deletions src/eez/gui/app_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ class AppContext {
Page *getActivePage();

bool isActivePageInternal();
InternalPage *getActivePageInternal() {
return (InternalPage *)getActivePage();
}

void pushSelectFromEnumPage(const data::EnumItem *enumDefinition, uint16_t currentValue,
bool (*disabledCallback)(uint16_t value), void (*onSet)(uint16_t),
Expand Down
4 changes: 4 additions & 0 deletions src/eez/gui/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ bool isActiveWidget(const WidgetCursor &widgetCursor) {
return result;
}

bool isFocusWidget(const WidgetCursor &widgetCursor) {
return g_appContext->isFocusWidget(widgetCursor);
}

int getAction(const WidgetCursor &widgetCursor) {
return (int16_t)widgetCursor.widget->action;
}
Expand Down
1 change: 1 addition & 0 deletions src/eez/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void stateManagmentHook();
WidgetCursor &getFoundWidgetAtDown();
void clearFoundWidgetAtDown();
bool isActiveWidget(const WidgetCursor &widgetCursor);
bool isFocusWidget(const WidgetCursor &widgetCursor);
uint32_t getShowPageTime();
void setShowPageTime(uint32_t time);
void refreshScreen();
Expand Down
2 changes: 1 addition & 1 deletion src/eez/gui/widgets/display_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void DisplayDataWidget_draw(const WidgetCursor &widgetCursor) {
DisplayDataState *previousState = (DisplayDataState *)widgetCursor.previousState;

widgetCursor.currentState->size = sizeof(DisplayDataState);
widgetCursor.currentState->flags.focused = g_appContext->isFocusWidget(widgetCursor);
widgetCursor.currentState->flags.focused = isFocusWidget(widgetCursor);

const Style *style = getStyle(overrideStyleHook(widgetCursor, widgetCursor.currentState->flags.focused ? display_data_widget->focusStyle : widget->style));

Expand Down
2 changes: 1 addition & 1 deletion src/eez/gui/widgets/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void TextWidget_draw(const WidgetCursor &widgetCursor) {
const TextWidgetSpecific *textWidget = GET_WIDGET_PROPERTY(widget, specific, const TextWidgetSpecific *);

widgetCursor.currentState->size = sizeof(WidgetState);
widgetCursor.currentState->flags.focused = g_appContext->isFocusWidget(widgetCursor);
widgetCursor.currentState->flags.focused = isFocusWidget(widgetCursor);

const Style *style = getStyle(widgetCursor.currentState->flags.focused ? textWidget->focusStyle : widget->style);

Expand Down
2 changes: 1 addition & 1 deletion src/eez/gui/widgets/yt_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ void YTGraphWidget_draw(const WidgetCursor &widgetCursor) {
YTGraphWidgetState *previousState = (YTGraphWidgetState *)widgetCursor.previousState;

widgetCursor.currentState->size = sizeof(YTGraphWidgetState);
widgetCursor.currentState->flags.focused = g_appContext->isFocusWidget(widgetCursor);
widgetCursor.currentState->flags.focused = isFocusWidget(widgetCursor);
widgetCursor.currentState->data = data::get(widgetCursor.cursor, widget->data);

currentState->refreshCounter = data::ytDataGetRefreshCounter(widgetCursor.cursor, widget->data);
Expand Down

0 comments on commit a02b4e6

Please sign in to comment.