Changeset fa01c05 in mainline for uspace/lib/ui/src/window.c
- Timestamp:
- 2020-11-03T18:46:35Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b71c0fc
- Parents:
- 4ac11ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/window.c
r4ac11ff rfa01c05 37 37 #include <errno.h> 38 38 #include <gfx/context.h> 39 #include <gfx/render.h> 39 40 #include <io/kbd_event.h> 40 41 #include <io/pos_event.h> … … 45 46 #include <ui/window.h> 46 47 #include "../private/dummygc.h" 48 #include "../private/resource.h" 47 49 #include "../private/ui.h" 48 50 #include "../private/wdecor.h" … … 205 207 } 206 208 209 errno_t ui_window_paint(ui_window_t *window) 210 { 211 return ui_window_send_paint(window); 212 } 213 207 214 /** Handle window close event. */ 208 215 static void dwnd_close_event(void *arg) … … 210 217 ui_window_t *window = (ui_window_t *) arg; 211 218 212 ui_window_ close(window);219 ui_window_send_close(window); 213 220 } 214 221 … … 223 230 } 224 231 225 ui_window_ focus(window);232 ui_window_send_focus(window); 226 233 } 227 234 … … 232 239 233 240 (void) window; 234 ui_window_ kbd(window, kbd_event);241 ui_window_send_kbd(window, kbd_event); 235 242 } 236 243 … … 245 252 246 253 ui_wdecor_pos_event(window->wdecor, event); 247 ui_window_ pos(window, event);254 ui_window_send_pos(window, event); 248 255 } 249 256 … … 258 265 } 259 266 260 ui_window_ unfocus(window);267 ui_window_send_unfocus(window); 261 268 } 262 269 … … 270 277 ui_window_t *window = (ui_window_t *) arg; 271 278 272 ui_window_ close(window);279 ui_window_send_close(window); 273 280 } 274 281 … … 290 297 * @param window Window 291 298 */ 292 void ui_window_ close(ui_window_t *window)299 void ui_window_send_close(ui_window_t *window) 293 300 { 294 301 if (window->cb != NULL && window->cb->close != NULL) … … 300 307 * @param window Window 301 308 */ 302 void ui_window_ focus(ui_window_t *window)309 void ui_window_send_focus(ui_window_t *window) 303 310 { 304 311 if (window->cb != NULL && window->cb->focus != NULL) … … 310 317 * @param window Window 311 318 */ 312 void ui_window_ kbd(ui_window_t *window, kbd_event_t *kbd)319 void ui_window_send_kbd(ui_window_t *window, kbd_event_t *kbd) 313 320 { 314 321 if (window->cb != NULL && window->cb->kbd != NULL) … … 316 323 } 317 324 325 /** Send window paint event. 326 * 327 * @param window Window 328 */ 329 errno_t ui_window_send_paint(ui_window_t *window) 330 { 331 if (window->cb != NULL && window->cb->paint != NULL) 332 return window->cb->paint(window, window->arg); 333 else 334 return ui_window_def_paint(window); 335 } 336 318 337 /** Send window position event. 319 338 * 320 339 * @param window Window 321 340 */ 322 void ui_window_ pos(ui_window_t *window, pos_event_t *pos)341 void ui_window_send_pos(ui_window_t *window, pos_event_t *pos) 323 342 { 324 343 if (window->cb != NULL && window->cb->pos != NULL) … … 330 349 * @param window Window 331 350 */ 332 void ui_window_ unfocus(ui_window_t *window)351 void ui_window_send_unfocus(ui_window_t *window) 333 352 { 334 353 if (window->cb != NULL && window->cb->unfocus != NULL) … … 336 355 } 337 356 357 /** Default window paint routine. 358 * 359 * @param window Window 360 * @return EOK on success or an error code 361 */ 362 errno_t ui_window_def_paint(ui_window_t *window) 363 { 364 gfx_rect_t app_rect; 365 errno_t rc; 366 367 rc = gfx_set_color(window->gc, window->res->wnd_face_color); 368 if (rc != EOK) 369 return rc; 370 371 ui_window_get_app_rect(window, &app_rect); 372 373 rc = gfx_fill_rect(window->gc, &app_rect); 374 if (rc != EOK) 375 return rc; 376 377 return EOK; 378 } 379 338 380 /** @} 339 381 */
Note:
See TracChangeset
for help on using the changeset viewer.