MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / onShow

Method onShow

Tactility/Source/app/notes/Notes.cpp:123–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121 }
122 }
123 void onShow(AppContext& context, lv_obj_t* parent) override {
124 lv_obj_remove_flag(parent, LV_OBJ_FLAG_SCROLLABLE);
125 lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
126 lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
127
128 lv_obj_t* toolbar = lvgl::toolbar_create(parent, context);
129 lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
130
131 uiDropDownMenu = lv_dropdown_create(toolbar);
132 lv_dropdown_set_options(uiDropDownMenu, LV_SYMBOL_FILE " New File\n" LV_SYMBOL_SAVE " Save\n" LV_SYMBOL_SAVE " Save As...\n" LV_SYMBOL_DIRECTORY " Open File");
133 lv_dropdown_set_text(uiDropDownMenu, "Menu");
134 lv_dropdown_set_symbol(uiDropDownMenu, LV_SYMBOL_DOWN);
135 lv_dropdown_set_selected_highlight(uiDropDownMenu, false);
136 lv_obj_align(uiDropDownMenu, LV_ALIGN_RIGHT_MID, 0, 0);
137 lv_obj_add_event_cb(uiDropDownMenu,
138 [](lv_event_t* e) {
139 auto *self = static_cast<NotesApp *>(lv_event_get_user_data(e));
140 self->appNotesEventCb(e);
141 },
142 LV_EVENT_VALUE_CHANGED,
143 this
144 );
145
146 lv_obj_t* wrapper = lv_obj_create(parent);
147 lv_obj_set_flex_flow(wrapper, LV_FLEX_FLOW_COLUMN);
148 lv_obj_set_flex_align(wrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START);
149 lv_obj_set_flex_grow(wrapper, 1);
150 lv_obj_set_width(wrapper, LV_PCT(100));
151 lv_obj_set_height(wrapper, LV_PCT(100));
152 lv_obj_set_style_pad_all(wrapper, 0, LV_PART_MAIN);
153 lv_obj_set_style_pad_row(wrapper, 0, LV_PART_MAIN);
154 lv_obj_set_style_border_width(wrapper, 0, LV_PART_MAIN);
155 lv_obj_remove_flag(wrapper, LV_OBJ_FLAG_SCROLLABLE);
156
157 uiNoteText = lv_textarea_create(wrapper);
158 lv_obj_set_width(uiNoteText, LV_PCT(100));
159 lv_obj_set_height(uiNoteText, LV_PCT(86));
160 lv_textarea_set_password_mode(uiNoteText, false);
161 if (lv_display_get_color_format(lv_obj_get_display(parent)) != LV_COLOR_FORMAT_L8) {
162 lv_obj_set_style_bg_color(uiNoteText, lv_color_hex(0x262626), LV_PART_MAIN);
163 }
164 lv_textarea_set_placeholder_text(uiNoteText, "Notes...");
165
166 lv_obj_t* footer = lv_obj_create(wrapper);
167 lv_obj_set_flex_flow(footer, LV_FLEX_FLOW_ROW);
168 lv_obj_set_flex_align(footer, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
169 if (lv_display_get_color_format(lv_obj_get_display(parent)) == LV_COLOR_FORMAT_L8) {
170 lv_obj_set_style_bg_color(footer, lv_color_hex(0xEEEEEE), LV_PART_MAIN);
171 lv_obj_set_style_border_width(footer, 1, LV_PART_MAIN);
172 lv_obj_set_style_border_color(footer, lv_theme_get_color_secondary(footer), LV_PART_MAIN);
173 lv_obj_set_style_border_side(footer, LV_BORDER_SIDE_TOP, LV_PART_MAIN);
174 } else {
175 lv_obj_set_style_bg_color(footer, lv_color_hex(0x262626), LV_PART_MAIN);
176 lv_obj_set_style_border_width(footer, 0, LV_PART_MAIN);
177 }
178 lv_obj_set_width(footer, LV_PCT(100));
179 lv_obj_set_height(footer, LV_PCT(14));
180 lv_obj_set_style_pad_all(footer, 0, LV_PART_MAIN);

Callers

nothing calls this directly

Calls 2

appNotesEventCbMethod · 0.95
toolbar_createFunction · 0.85

Tested by

no test coverage detected