Changeset 7e38970d in mainline for uspace/lib/ui/private
- Timestamp:
- 2020-12-07T00:08:37Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 25f26600
- Parents:
- 7a873f0 (diff), 8596474 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib/ui/private
- Files:
-
- 5 added
- 6 moved
-
control.h (moved) (moved from uspace/lib/softrend/rectangle.h ) (2 diffs)
-
dummygc.h (moved) (moved from uspace/lib/c/include/io/mode.h ) (2 diffs)
-
entry.h (added)
-
fixed.h (moved) (moved from uspace/lib/draw/include/draw/path.h ) (2 diffs)
-
image.h (moved) (moved from uspace/lib/guigfx/private/canvas.h ) (2 diffs)
-
label.h (added)
-
pbutton.h (added)
-
resource.h (added)
-
ui.h (moved) (moved from uspace/lib/gui/minimal.h ) (2 diffs)
-
wdecor.h (added)
-
window.h (moved) (moved from uspace/lib/draw/include/draw/drawctx.h ) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/private/control.h
r7a873f0 r7e38970d 1 1 /* 2 * Copyright (c) 20 12 Petr Koupy2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup softrend29 /** @addtogroup libui 30 30 * @{ 31 31 */ 32 32 /** 33 * @file 33 * @file UI control structure 34 * 34 35 */ 35 36 36 #ifndef SOFTREND_RECTANGLE_H_37 #define SOFTREND_RECTANGLE_H_37 #ifndef _UI_PRIVATE_CONTROL_H 38 #define _UI_PRIVATE_CONTROL_H 38 39 40 #include <gfx/coord.h> 39 41 #include <stdbool.h> 40 #include <types/common.h>41 42 42 extern bool rectangle_intersect( 43 sysarg_t, sysarg_t, sysarg_t, sysarg_t, 44 sysarg_t, sysarg_t, sysarg_t, sysarg_t, 45 sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *); 46 extern void rectangle_union( 47 sysarg_t, sysarg_t, sysarg_t, sysarg_t, 48 sysarg_t, sysarg_t, sysarg_t, sysarg_t, 49 sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *); 43 /** Actual structure of UI control. 44 * 45 * UI control is the abstract base class to all UI controls (e.g. push button, 46 * label). This is private to libui. 47 */ 48 struct ui_control { 49 /** Pointer to layout element structure this control is attached to 50 * or @c NULL if the control is not attached to a layout 51 */ 52 void *elemp; 53 /** Ops */ 54 struct ui_control_ops *ops; 55 /** Extended data */ 56 void *ext; 57 }; 50 58 51 59 #endif -
uspace/lib/ui/private/dummygc.h
r7a873f0 r7e38970d 1 1 /* 2 * Copyright (c) 20 11 Petr Koupy2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib c29 /** @addtogroup libui 30 30 * @{ 31 31 */ 32 32 /** 33 * @file 33 * @file Dummy graphic context 34 * 34 35 */ 35 36 36 #ifndef _ LIBC_IO_MODE_H_37 #define _ LIBC_IO_MODE_H_37 #ifndef _UI_PRIVATE_DUMMYGC_H 38 #define _UI_PRIVATE_DUMMYGC_H 38 39 39 #include <abi/fb/visuals.h> 40 #include <adt/list.h> 41 #include <io/pixel.h> 42 #include <io/charfield.h> 40 #include <gfx/context.h> 43 41 42 /** Dummy graphic context */ 44 43 typedef struct { 45 sysarg_t width; 46 sysarg_t height; 47 } aspect_ratio_t; 44 gfx_context_t *gc; 45 bool bm_created; 46 bool bm_destroyed; 47 gfx_bitmap_params_t bm_params; 48 void *bm_pixels; 49 gfx_rect_t bm_srect; 50 gfx_coord2_t bm_offs; 51 bool bm_rendered; 52 bool bm_got_alloc; 53 } dummy_gc_t; 48 54 49 typedef union { 50 visual_t pixel_visual; 51 char_attr_type_t field_visual; 52 } cell_visual_t; 55 /** Dummy GC bitmap */ 56 typedef struct { 57 dummy_gc_t *dgc; 58 gfx_bitmap_alloc_t alloc; 59 bool myalloc; 60 } dummygc_bitmap_t; 53 61 54 typedef struct { 55 sysarg_t index; 56 sysarg_t version; 62 /** Dummy GC ops */ 63 extern gfx_context_ops_t dummygc_ops; 57 64 58 sysarg_t refresh_rate; 59 aspect_ratio_t screen_aspect; 60 sysarg_t screen_width; 61 sysarg_t screen_height; 62 63 aspect_ratio_t cell_aspect; 64 cell_visual_t cell_visual; 65 } vslmode_t; 66 67 typedef struct { 68 link_t link; 69 vslmode_t mode; 70 } vslmode_list_element_t; 65 extern errno_t dummygc_create(dummy_gc_t **); 66 extern void dummygc_destroy(dummy_gc_t *); 67 extern gfx_context_t *dummygc_get_ctx(dummy_gc_t *); 71 68 72 69 #endif -
uspace/lib/ui/private/fixed.h
r7a873f0 r7e38970d 1 1 /* 2 * Copyright (c) 20 12 Petr Koupy2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup draw29 /** @addtogroup libui 30 30 * @{ 31 31 */ 32 32 /** 33 * @file 33 * @file Fixed layout structure 34 * 34 35 */ 35 36 36 #ifndef DRAW_PATH_H_37 #define DRAW_PATH_H_37 #ifndef _UI_PRIVATE_FIXED_H 38 #define _UI_PRIVATE_FIXED_H 38 39 39 40 #include <adt/list.h> 41 #include <gfx/coord.h> 42 #include <stdbool.h> 43 #include <types/ui/fixed.h> 40 44 41 typedef enum { 42 PATH_STEP_MOVETO, 43 PATH_STEP_LINETO 44 } path_step_type_t; 45 /** Actual structure of fixed layout. 46 * 47 * This is private to libui. 48 */ 49 struct ui_fixed { 50 /** Base control object */ 51 struct ui_control *control; 52 /** Layout elements (ui_fixed_elem_t) */ 53 list_t elem; 54 }; 45 55 56 /** Fixed layout element. */ 46 57 typedef struct { 47 link_t link; 48 path_step_type_t type; 49 double to_x; 50 double to_y; 51 } path_step_t; 58 /** Containing fixed layout */ 59 struct ui_fixed *fixed; 60 /** Link to @c fixed->elem list */ 61 link_t lelems; 62 /** Control */ 63 ui_control_t *control; 64 } ui_fixed_elem_t; 52 65 53 struct path; 54 typedef struct path path_t; 55 56 extern void path_init(path_t *); 57 extern void path_clear(path_t *); 58 59 extern void path_get_cursor(path_t *, double *, double *); 60 61 extern void path_move_to(path_t *, double, double); 62 extern void path_line_to(path_t *, double, double); 63 64 extern void path_rectangle(path_t *, double, double, double, double); 66 extern ui_fixed_elem_t *ui_fixed_first(ui_fixed_t *f); 67 extern ui_fixed_elem_t *ui_fixed_next(ui_fixed_elem_t *); 65 68 66 69 #endif -
uspace/lib/ui/private/image.h
r7a873f0 r7e38970d 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib guigfx29 /** @addtogroup libui 30 30 * @{ 31 31 */ 32 32 /** 33 * @file GFX canvas backendstructure33 * @file Image structure 34 34 * 35 35 */ 36 36 37 #ifndef _ GUIGFX_PRIVATE_CANVAS_H38 #define _ GUIGFX_PRIVATE_CANVAS_H37 #ifndef _UI_PRIVATE_IMAGE_H 38 #define _UI_PRIVATE_IMAGE_H 39 39 40 #include <canvas.h>41 #include <draw/surface.h>42 40 #include <gfx/bitmap.h> 43 #include <gfx/context.h>44 41 #include <gfx/coord.h> 45 #include <io/pixel.h>46 #include <memgfx/memgc.h>47 42 48 /** Actual structure of canvas GC. */ 49 struct canvas_gc { 50 /** Memory GC */ 51 mem_gc_t *mgc; 52 /** Base graphic context */ 53 gfx_context_t *gc; 54 /** Canvas */ 55 canvas_t *canvas; 56 /** Surface */ 57 surface_t *surface; 43 /** Actual structure of image. 44 * 45 * This is private to libui. 46 */ 47 struct ui_image { 48 /** Base control object */ 49 struct ui_control *control; 50 /** UI resource */ 51 struct ui_resource *res; 52 /** Image rectangle */ 53 gfx_rect_t rect; 54 /** Flags */ 55 ui_image_flags_t flags; 56 /** Bitmap */ 57 gfx_bitmap_t *bitmap; 58 /** Bitmap rectangle */ 59 gfx_rect_t brect; 58 60 }; 59 61 -
uspace/lib/ui/private/ui.h
r7a873f0 r7e38970d 1 1 /* 2 * Copyright (c) 20 12 Petr Koupy2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup gui29 /** @addtogroup libui 30 30 * @{ 31 31 */ 32 32 /** 33 * @file 33 * @file User interface 34 * 34 35 */ 35 36 36 #ifndef GUI_MINIMAL_H_37 #define GUI_MINIMAL_H_37 #ifndef _UI_PRIVATE_UI_H 38 #define _UI_PRIVATE_UI_H 38 39 40 #include <display.h> 39 41 #include <stdbool.h> 40 #include <io/pixel.h>41 42 42 #include "widget.h" 43 44 typedef struct minimal { 45 widget_t widget; 46 pixel_t pix_a; 47 pixel_t pix_b;48 } minimal_t;49 50 extern bool init_minimal(minimal_t *, widget_t *, const void *, pixel_t, 51 pixel_t); 52 extern minimal_t *create_minimal(widget_t *, const void *, pixel_t, pixel_t);53 extern void deinit_minimal(minimal_t *);43 /** Actual structure of user interface. 44 * 45 * This is private to libui. 46 */ 47 struct ui { 48 /** Display */ 49 display_t *display; 50 /** Output owned by UI, clean up when destroying UI */ 51 bool myoutput; 52 /** @c true if terminating */ 53 bool quit; 54 }; 54 55 55 56 #endif -
uspace/lib/ui/private/window.h
r7a873f0 r7e38970d 1 1 /* 2 * Copyright (c) 20 12 Petr Koupy2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup draw29 /** @addtogroup libui 30 30 * @{ 31 31 */ 32 32 /** 33 * @file 33 * @file Window structure 34 * 34 35 */ 35 36 36 #ifndef DRAW_DRAWCTX_H_37 #define DRAW_DRAWCTX_H_37 #ifndef _UI_PRIVATE_WINDOW_H 38 #define _UI_PRIVATE_WINDOW_H 38 39 39 #include <stdbool.h> 40 #include <errno.h> 41 #include <display.h> 42 #include <gfx/context.h> 43 #include <io/kbd_event.h> 44 #include <io/pos_event.h> 40 45 41 #include <compose.h> 42 43 #include "surface.h" 44 #include "source.h" 45 #include "path.h" 46 #include "font.h" 47 48 struct drawctx { 49 link_t link; 50 list_t list; 51 52 surface_t *surface; 53 compose_t compose; 54 surface_t *mask; 55 source_t *source; 56 font_t *font; 57 58 bool shall_clip; 59 sysarg_t clip_x; 60 sysarg_t clip_y; 61 sysarg_t clip_width; 62 sysarg_t clip_height; 46 /** Actual structure of window. 47 * 48 * This is private to libui. 49 */ 50 struct ui_window { 51 /** Containing user interface */ 52 struct ui *ui; 53 /** Callbacks */ 54 struct ui_window_cb *cb; 55 /** Callback argument */ 56 void *arg; 57 /** Display window */ 58 display_window_t *dwindow; 59 /** Window GC */ 60 gfx_context_t *gc; 61 /** Window rectangle */ 62 gfx_rect_t rect; 63 /** Application area bitmap */ 64 gfx_bitmap_t *app_bmp; 65 /** Application area GC */ 66 gfx_context_t *app_gc; 67 /** UI resource. Ideally this would be in ui_t. */ 68 struct ui_resource *res; 69 /** Window decoration */ 70 struct ui_wdecor *wdecor; 71 /** Top-level control in the application area */ 72 struct ui_control *control; 73 /** Current cursor */ 74 ui_stock_cursor_t cursor; 63 75 }; 64 76 65 extern void drawctx_init(drawctx_t *, surface_t *); 66 67 extern void drawctx_save(drawctx_t *); 68 extern void drawctx_restore(drawctx_t *); 69 70 extern void drawctx_set_compose(drawctx_t *, compose_t); 71 extern void drawctx_set_clip(drawctx_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t); 72 extern void drawctx_set_mask(drawctx_t *, surface_t *); 73 extern void drawctx_set_source(drawctx_t *, source_t *); 74 extern void drawctx_set_font(drawctx_t *, font_t *); 75 76 extern void drawctx_transfer(drawctx_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t); 77 extern void drawctx_stroke(drawctx_t *, path_t *); 78 extern void drawctx_fill(drawctx_t *, path_t *); 79 extern void drawctx_print(drawctx_t *, const char *, sysarg_t, sysarg_t); 77 extern void ui_window_send_close(ui_window_t *); 78 extern void ui_window_send_focus(ui_window_t *); 79 extern void ui_window_send_kbd(ui_window_t *, kbd_event_t *); 80 extern errno_t ui_window_send_paint(ui_window_t *); 81 extern void ui_window_send_pos(ui_window_t *, pos_event_t *); 82 extern void ui_window_send_unfocus(ui_window_t *); 80 83 81 84 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
