Changeset b71c0fc in mainline for uspace/lib/ui/src/window.c
- Timestamp:
- 2020-11-07T16:07:22Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d55ab823
- Parents:
- fa01c05
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/window.c
rfa01c05 rb71c0fc 42 42 #include <mem.h> 43 43 #include <stdlib.h> 44 #include <ui/control.h> 44 45 #include <ui/resource.h> 45 46 #include <ui/wdecor.h> 46 47 #include <ui/window.h> 48 #include "../private/control.h" 47 49 #include "../private/dummygc.h" 48 50 #include "../private/resource.h" … … 170 172 return; 171 173 174 ui_control_destroy(window->control); 172 175 ui_wdecor_destroy(window->wdecor); 173 176 ui_resource_destroy(window->res); … … 177 180 } 178 181 182 /** Add control to window. 183 * 184 * Only one control can be added to a window. If more than one control 185 * is added, the results are undefined. 186 * 187 * @param fixed Fixed layout 188 * @param control Control 189 * @return EOK on success, ENOMEM if out of memory 190 */ 191 void ui_window_add(ui_window_t *window, ui_control_t *control) 192 { 193 assert(window->control == NULL); 194 195 window->control = control; 196 control->elemp = (void *) window; 197 } 198 199 /** Remove control from window. 200 * 201 * @param window Window 202 * @param control Control 203 */ 204 void ui_window_remove(ui_window_t *window, ui_control_t *control) 205 { 206 assert(window->control == control); 207 assert((ui_window_t *) control->elemp == window); 208 209 window->control = NULL; 210 control->elemp = NULL; 211 } 212 179 213 /** Set window callbacks. 180 214 * … … 343 377 if (window->cb != NULL && window->cb->pos != NULL) 344 378 window->cb->pos(window, window->arg, pos); 379 else 380 ui_window_def_pos(window, pos); 345 381 } 346 382 … … 375 411 return rc; 376 412 413 if (window->control != NULL) 414 return ui_control_paint(window->control); 415 377 416 return EOK; 378 417 } 379 418 419 /** Default window position event routine. 420 * 421 * @param window Window 422 * @return EOK on success or an error code 423 */ 424 void ui_window_def_pos(ui_window_t *window, pos_event_t *pos) 425 { 426 if (window->control != NULL) 427 ui_control_pos_event(window->control, pos); 428 } 429 380 430 /** @} 381 431 */
Note:
See TracChangeset
for help on using the changeset viewer.