Changeset 8b22d44 in mainline
- Timestamp:
- 2022-05-20T12:05:26Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0415776
- Parents:
- ea9024d7
- git-author:
- Jiri Svoboda <jiri@…> (2022-05-19 18:05:08)
- git-committer:
- Jiri Svoboda <jiri@…> (2022-05-20 12:05:26)
- Location:
- uspace/lib/ui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/include/types/ui/pbutton.h
rea9024d7 r8b22d44 43 43 typedef struct ui_pbutton ui_pbutton_t; 44 44 45 /** UI push button flags */ 46 typedef enum { 47 /** Do not depress the button in text mode */ 48 ui_pbf_no_text_depress = 0x1 49 } ui_pbutton_flags_t; 50 45 51 /** Push button callbacks */ 46 52 typedef struct ui_pbutton_cb { -
uspace/lib/ui/include/ui/pbutton.h
rea9024d7 r8b22d44 53 53 extern void ui_pbutton_set_decor_ops(ui_pbutton_t *, ui_pbutton_decor_ops_t *, 54 54 void *); 55 extern void ui_pbutton_set_flags(ui_pbutton_t *, ui_pbutton_flags_t); 55 56 extern void ui_pbutton_set_rect(ui_pbutton_t *, gfx_rect_t *); 56 57 extern void ui_pbutton_set_default(ui_pbutton_t *, bool); -
uspace/lib/ui/private/pbutton.h
rea9024d7 r8b22d44 40 40 #include <gfx/coord.h> 41 41 #include <stdbool.h> 42 #include <types/ui/pbutton.h> 42 43 43 44 /** Actual structure of push button. … … 68 69 /** Pointer is currently inside */ 69 70 bool inside; 71 /** Push button flags */ 72 ui_pbutton_flags_t flags; 70 73 }; 71 74 -
uspace/lib/ui/src/pbutton.c
rea9024d7 r8b22d44 152 152 } 153 153 154 /** Set push button flag.s 155 * 156 * @param pbutton Push button 157 * @param flags Flags 158 */ 159 void ui_pbutton_set_flags(ui_pbutton_t *pbutton, ui_pbutton_flags_t flags) 160 { 161 pbutton->flags = flags; 162 } 163 154 164 /** Set button rectangle. 155 165 * … … 377 387 errno_t rc; 378 388 379 depressed = pbutton->held && pbutton->inside; 389 if ((pbutton->flags & ui_pbf_no_text_depress) == 0) 390 depressed = pbutton->held && pbutton->inside; 391 else 392 depressed = false; 380 393 381 394 rc = gfx_set_color(pbutton->res->gc, pbutton->res->wnd_face_color); -
uspace/lib/ui/src/scrollbar.c
rea9024d7 r8b22d44 205 205 &ui_scrollbar_up_btn_decor_ops, (void *) scrollbar); 206 206 207 ui_pbutton_set_flags(scrollbar->up_btn, ui_pbf_no_text_depress); 208 207 209 rc = ui_pbutton_create(resource, down_text, &scrollbar->down_btn); 208 210 if (rc != EOK) … … 214 216 ui_pbutton_set_decor_ops(scrollbar->down_btn, 215 217 &ui_scrollbar_down_btn_decor_ops, (void *) scrollbar); 218 219 ui_pbutton_set_flags(scrollbar->down_btn, ui_pbf_no_text_depress); 216 220 217 221 scrollbar->thumb_len = resource->textmode ? -
uspace/lib/ui/test/pbutton.c
rea9024d7 r8b22d44 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 133 133 } 134 134 135 /** Set flags sets internal field */ 136 PCUT_TEST(set_flags) 137 { 138 ui_pbutton_t *pbutton; 139 errno_t rc; 140 141 rc = ui_pbutton_create(NULL, "Hello", &pbutton); 142 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 143 144 ui_pbutton_set_flags(pbutton, ui_pbf_no_text_depress); 145 PCUT_ASSERT_INT_EQUALS(ui_pbf_no_text_depress, pbutton->flags); 146 147 ui_pbutton_destroy(pbutton); 148 } 149 135 150 /** Set button rectangle sets internal field */ 136 151 PCUT_TEST(set_rect)
Note:
See TracChangeset
for help on using the changeset viewer.