Changeset db3895d in mainline for uspace/lib/ui/src/entry.c
- Timestamp:
- 2021-06-10T17:10:11Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- af5d62eb
- Parents:
- 90f1f19
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/entry.c
r90f1f19 rdb3895d 47 47 #include <ui/entry.h> 48 48 #include <ui/ui.h> 49 #include <ui/window.h> 49 50 #include "../private/entry.h" 50 51 #include "../private/resource.h" … … 70 71 /** Create new text entry. 71 72 * 72 * @param resource UI resource73 * @param window UI window 73 74 * @param text Text 74 75 * @param rentry Place to store pointer to new text entry 75 76 * @return EOK on success, ENOMEM if out of memory 76 77 */ 77 errno_t ui_entry_create(ui_ resource_t *resource, const char *text,78 errno_t ui_entry_create(ui_window_t *window, const char *text, 78 79 ui_entry_t **rentry) 79 80 { … … 98 99 } 99 100 100 entry-> res = resource;101 entry->window = window; 101 102 entry->halign = gfx_halign_left; 102 103 *rentry = entry; … … 174 175 errno_t ui_entry_paint(ui_entry_t *entry) 175 176 { 177 ui_resource_t *res; 176 178 gfx_text_fmt_t fmt; 177 179 gfx_coord2_t pos; … … 181 183 errno_t rc; 182 184 183 if (entry->res->textmode) { 185 res = ui_window_get_res(entry->window); 186 187 if (res->textmode) { 184 188 hpad = ui_entry_hpad_text; 185 189 vpad = ui_entry_vpad_text; … … 189 193 } 190 194 191 if ( entry->res->textmode == false) {195 if (res->textmode == false) { 192 196 /* Paint inset frame */ 193 rc = ui_paint_inset_frame( entry->res, &entry->rect, &inside);197 rc = ui_paint_inset_frame(res, &entry->rect, &inside); 194 198 if (rc != EOK) 195 199 goto error; … … 200 204 /* Paint entry background */ 201 205 202 rc = gfx_set_color( entry->res->gc, entry->res->entry_bg_color);206 rc = gfx_set_color(res->gc, res->entry_bg_color); 203 207 if (rc != EOK) 204 208 goto error; 205 209 206 rc = gfx_fill_rect( entry->res->gc, &inside);210 rc = gfx_fill_rect(res->gc, &inside); 207 211 if (rc != EOK) 208 212 goto error; … … 224 228 225 229 gfx_text_fmt_init(&fmt); 226 fmt.color = entry->res->entry_fg_color;230 fmt.color = res->entry_fg_color; 227 231 fmt.halign = entry->halign; 228 232 fmt.valign = gfx_valign_top; 229 233 230 rc = gfx_puttext( entry->res->font, &pos, &fmt, entry->text);234 rc = gfx_puttext(res->font, &pos, &fmt, entry->text); 231 235 if (rc != EOK) 232 236 goto error; 233 237 234 rc = gfx_update( entry->res->gc);238 rc = gfx_update(res->gc); 235 239 if (rc != EOK) 236 240 goto error; … … 273 277 { 274 278 ui_entry_t *entry = (ui_entry_t *) arg; 275 276 (void) entry; 279 gfx_coord2_t pos; 280 281 if (event->type == POS_UPDATE) { 282 pos.x = event->hpos; 283 pos.y = event->vpos; 284 285 if (gfx_pix_inside_rect(&pos, &entry->rect)) { 286 if (!entry->pointer_inside) { 287 ui_window_set_ctl_cursor(entry->window, 288 ui_curs_ibeam); 289 entry->pointer_inside = true; 290 } 291 } else { 292 if (entry->pointer_inside) { 293 ui_window_set_ctl_cursor(entry->window, 294 ui_curs_arrow); 295 entry->pointer_inside = false; 296 } 297 } 298 } 299 277 300 return ui_unclaimed; 278 301 }
Note:
See TracChangeset
for help on using the changeset viewer.