Changeset fe5c7a1 in mainline for uspace/app/nav/panel.c
- Timestamp:
- 2021-10-14T10:41:07Z (4 years ago)
- Children:
- 03c4b23
- Parents:
- b9d689b
- git-author:
- Jiri Svoboda <jiri@…> (2021-10-13 18:40:48)
- git-committer:
- Jiri Svoboda <jiri@…> (2021-10-14 10:41:07)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nav/panel.c
rb9d689b rfe5c7a1 63 63 * 64 64 * @param window Containing window 65 * @param active @c true iff panel should be active 65 66 * @param rpanel Place to store pointer to new panel 66 67 * @return EOK on success or an error code 67 68 */ 68 errno_t panel_create(ui_window_t *window, panel_t **rpanel)69 errno_t panel_create(ui_window_t *window, bool active, panel_t **rpanel) 69 70 { 70 71 panel_t *panel; … … 90 91 goto error; 91 92 93 rc = gfx_color_new_ega(0x0f, &panel->act_border_color); 94 if (rc != EOK) 95 goto error; 96 92 97 panel->window = window; 93 98 list_initialize(&panel->entries); 94 99 panel->entries_cnt = 0; 100 panel->active = active; 95 101 *rpanel = panel; 96 102 return EOK; … … 113 119 gfx_color_delete(panel->color); 114 120 gfx_color_delete(panel->curs_color); 121 gfx_color_delete(panel->act_border_color); 115 122 panel_clear_entries(panel); 116 123 ui_control_delete(panel->control); … … 147 154 pos.y = panel->rect.p0.y + 1 + entry_idx - panel->page_idx; 148 155 149 if (entry == panel->cursor )156 if (entry == panel->cursor && panel->active) 150 157 fmt.color = panel->curs_color; 151 158 else … … 182 189 gfx_text_fmt_t fmt; 183 190 panel_entry_t *entry; 191 ui_box_style_t bstyle; 192 gfx_color_t *bcolor; 184 193 int i, lines; 185 194 errno_t rc; … … 195 204 return rc; 196 205 197 rc = ui_paint_text_box(res, &panel->rect, ui_box_single, 198 panel->color); 206 if (panel->active) { 207 bstyle = ui_box_double; 208 bcolor = panel->act_border_color; 209 } else { 210 bstyle = ui_box_single; 211 bcolor = panel->color; 212 } 213 214 rc = ui_paint_text_box(res, &panel->rect, bstyle, bcolor); 199 215 if (rc != EOK) 200 216 return rc; … … 228 244 ui_evclaim_t panel_kbd_event(panel_t *panel, kbd_event_t *event) 229 245 { 246 if (!panel->active) 247 return ui_unclaimed; 248 230 249 if (event->type == KEY_PRESS) { 231 250 if ((event->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) { … … 255 274 } 256 275 257 return ui_ unclaimed;276 return ui_claimed; 258 277 } 259 278 … … 297 316 { 298 317 return panel->rect.p1.y - panel->rect.p0.y - 2; 318 } 319 320 /** Determine if panel is active. 321 * 322 * @param panel Panel 323 * @return @c true iff panel is active 324 */ 325 bool panel_is_active(panel_t *panel) 326 { 327 return panel->active; 328 } 329 330 /** Activate panel. 331 * 332 * @param panel Panel 333 */ 334 void panel_activate(panel_t *panel) 335 { 336 panel->active = true; 337 (void) panel_paint(panel); 338 } 339 340 /** Deactivate panel. 341 * 342 * @param panel Panel 343 */ 344 void panel_deactivate(panel_t *panel) 345 { 346 panel->active = false; 347 (void) panel_paint(panel); 299 348 } 300 349
Note:
See TracChangeset
for help on using the changeset viewer.