Changeset ba09d06 in mainline
- Timestamp:
- 2020-10-20T11:10:32Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 20d2c6c
- Parents:
- 1769693
- git-author:
- Jiri Svoboda <jiri@…> (2020-10-19 21:10:12)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-10-20 11:10:32)
- Location:
- uspace
- Files:
-
- 5 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/uidemo/uidemo.c
r1769693 rba09d06 40 40 #include <str.h> 41 41 #include <task.h> 42 #include <ui/label.h> 42 43 #include <ui/pbutton.h> 43 44 #include <ui/resource.h> … … 138 139 { 139 140 ui_demo_t *demo = (ui_demo_t *) arg; 141 errno_t rc; 140 142 141 143 if (pbutton == demo->pb1) { 142 144 printf("Clicked 'Confirm' button\n"); 145 rc = ui_label_set_text(demo->label, "Confirmed"); 146 if (rc != EOK) 147 printf("Error changing label text.\n"); 148 (void) ui_label_paint(demo->label); 143 149 } else { 144 150 printf("Clicked 'Cancel' button\n"); 151 rc = ui_label_set_text(demo->label, "Cancelled"); 152 if (rc != EOK) 153 printf("Error changing label text.\n"); 154 (void) ui_label_paint(demo->label); 145 155 } 146 156 } … … 221 231 ui_wdecor_set_cb(demo.wdecor, &wdecor_cb, (void *) &demo); 222 232 233 rc = ui_label_create(ui_res, "Hello there!", &demo.label); 234 if (rc != EOK) { 235 printf("Error creating label.\n"); 236 return rc; 237 } 238 239 rect.p0.x = 60; 240 rect.p0.y = 37; 241 rect.p1.x = 160; 242 rect.p1.y = 50; 243 ui_label_set_rect(demo.label, &rect); 244 223 245 rc = ui_pbutton_create(ui_res, "Confirm", &demo.pb1); 224 246 if (rc != EOK) { … … 229 251 ui_pbutton_set_cb(demo.pb1, &pbutton_cb, (void *) &demo); 230 252 231 rect.p0.x = 20;232 rect.p0.y = 50;233 rect.p1.x = 10 0;234 rect.p1.y = 8 0;253 rect.p0.x = 15; 254 rect.p0.y = 60; 255 rect.p1.x = 105; 256 rect.p1.y = 88; 235 257 ui_pbutton_set_rect(demo.pb1, &rect); 236 258 … … 245 267 ui_pbutton_set_cb(demo.pb2, &pbutton_cb, (void *) &demo); 246 268 247 rect.p0.x = 1 20;248 rect.p0.y = 50;249 rect.p1.x = 20 0;250 rect.p1.y = 8 0;269 rect.p0.x = 115; 270 rect.p0.y = 60; 271 rect.p1.x = 205; 272 rect.p1.y = 88; 251 273 ui_pbutton_set_rect(demo.pb2, &rect); 252 274 … … 275 297 if (rc != EOK) { 276 298 printf("Error painting window decoration.\n"); 299 return rc; 300 } 301 302 rc = ui_label_paint(demo.label); 303 if (rc != EOK) { 304 printf("Error painting button.\n"); 277 305 return rc; 278 306 } -
uspace/app/uidemo/uidemo.h
r1769693 rba09d06 38 38 39 39 #include <display.h> 40 #include <ui/label.h> 40 41 #include <ui/pbutton.h> 41 42 #include <ui/wdecor.h> … … 45 46 display_window_t *dwindow; 46 47 ui_wdecor_t *wdecor; 48 ui_label_t *label; 47 49 ui_pbutton_t *pb1; 48 50 ui_pbutton_t *pb2; -
uspace/lib/ui/meson.build
r1769693 rba09d06 29 29 deps = [ 'gfx', 'gfxfont' ] 30 30 src = files( 31 'src/label.c', 31 32 'src/paint.c', 32 33 'src/pbutton.c', … … 36 37 37 38 test_src = files( 39 'test/label.c', 38 40 'test/main.c', 39 41 'test/paint.c', -
uspace/lib/ui/src/pbutton.c
r1769693 rba09d06 107 107 * 108 108 * @param pbutton Button 109 * @param rect New button rectan le109 * @param rect New button rectangle 110 110 */ 111 111 void ui_pbutton_set_rect(ui_pbutton_t *pbutton, gfx_rect_t *rect) -
uspace/lib/ui/src/resource.c
r1769693 rba09d06 50 50 * 51 51 * @param gc Graphic context 52 * @param rresource Place to store pointer to new push button52 * @param rresource Place to store pointer to new UI resource 53 53 * @return EOK on success, ENOMEM if out of memory 54 54 */ -
uspace/lib/ui/src/wdecor.c
r1769693 rba09d06 102 102 * 103 103 * @param wdecor Window decoration 104 * @param rect New button rectanle104 * @param rect New window decoration rectangle 105 105 */ 106 106 void ui_wdecor_set_rect(ui_wdecor_t *wdecor, gfx_rect_t *rect) -
uspace/lib/ui/test/main.c
r1769693 rba09d06 31 31 PCUT_INIT; 32 32 33 PCUT_IMPORT(label); 33 34 PCUT_IMPORT(paint); 34 35 PCUT_IMPORT(pbutton);
Note:
See TracChangeset
for help on using the changeset viewer.