Changeset 7e38970d in mainline for uspace/lib/ui/include
- 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/include
- Files:
-
- 16 added
- 7 moved
-
types/ui/control.h (added)
-
types/ui/cursor.h (moved) (moved from uspace/lib/draw/include/draw/gfx.h ) (3 diffs)
-
types/ui/entry.h (moved) (moved from uspace/lib/guigfx/include/types/guigfx/canvas.h ) (2 diffs)
-
types/ui/event.h (added)
-
types/ui/fixed.h (added)
-
types/ui/image.h (added)
-
types/ui/label.h (added)
-
types/ui/pbutton.h (added)
-
types/ui/resource.h (added)
-
types/ui/ui.h (moved) (moved from uspace/lib/softrend/filter.h ) (2 diffs)
-
types/ui/wdecor.h (moved) (moved from uspace/lib/draw/include/draw/surface.h ) (2 diffs)
-
types/ui/window.h (added)
-
ui/control.h (added)
-
ui/entry.h (moved) (moved from uspace/lib/gui/canvas.h ) (2 diffs)
-
ui/fixed.h (added)
-
ui/image.h (added)
-
ui/label.h (moved) (moved from uspace/lib/gui/label.h ) (2 diffs)
-
ui/paint.h (added)
-
ui/pbutton.h (moved) (moved from uspace/lib/draw/include/draw/source.h ) (2 diffs)
-
ui/resource.h (added)
-
ui/ui.h (added)
-
ui/wdecor.h (added)
-
ui/window.h (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/include/types/ui/cursor.h
r7a873f0 r7e38970d 1 1 /* 2 * Copyright (c) 2008 Martin Decky 3 * Copyright (c) 2012 Petr Koupy 2 * Copyright (c) 2020 Jiri Svoboda 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup draw29 /** @addtogroup libui 31 30 * @{ 32 31 */ … … 34 33 */ 35 34 36 #ifndef GFX_H_37 #define GFX_H_35 #ifndef _LIBUI_TYPES_CURSOR_H_ 36 #define _LIBUI_TYPES_CURSOR_H_ 38 37 39 #include <stdint.h> 40 #include <stdbool.h> 41 #include <stddef.h> 42 #include <uchar.h> 38 /** Stock cursor types */ 39 typedef enum { 40 /** Standard arrow */ 41 ui_curs_arrow, 42 /** Double arrow pointing up and down */ 43 ui_curs_size_ud, 44 /** Double arrow pointing left and right */ 45 ui_curs_size_lr, 46 /** Double arrow pointing up-left and down-right */ 47 ui_curs_size_uldr, 48 /** Double arrow pointing up-right nad down-left */ 49 ui_curs_size_urdl 50 } ui_stock_cursor_t; 43 51 44 #define CURSOR_WIDTH 11 45 #define CURSOR_HEIGHT 18 46 47 #define FONT_GLYPHS 2899 48 #define FONT_WIDTH 8 49 #define FONT_SCANLINES 16 50 #define FONT_ASCENDER 12 51 52 extern uint8_t cursor_texture[]; 53 extern uint8_t cursor_mask[]; 54 55 extern uint16_t fb_font_glyph(const char32_t, bool *); 56 extern uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES]; 52 enum { 53 /** Number of stock cursor types */ 54 ui_curs_limit = ui_curs_size_urdl + 1 55 }; 57 56 58 57 #endif -
uspace/lib/ui/include/types/ui/entry.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 backend33 * @file Text entry 34 34 */ 35 35 36 #ifndef _ GUIGFX_TYPES_CANVAS_H37 #define _ GUIGFX_TYPES_CANVAS_H36 #ifndef _UI_TYPES_ENTRY_H 37 #define _UI_TYPES_ENTRY_H 38 38 39 struct canvas_gc;40 typedef struct canvas_gc canvas_gc_t;39 struct ui_entry; 40 typedef struct ui_entry ui_entry_t; 41 41 42 42 #endif -
uspace/lib/ui/include/types/ui/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 softrend29 /** @addtogroup libui 30 30 * @{ 31 31 */ 32 32 /** 33 * @file 33 * @file User interface 34 34 */ 35 35 36 #ifndef SOFTREND_FILTER_H_37 #define SOFTREND_FILTER_H_36 #ifndef _UI_TYPES_UI_H 37 #define _UI_TYPES_UI_H 38 38 39 #include < io/pixelmap.h>39 #include <gfx/coord.h> 40 40 41 typedef pixel_t (*filter_t)(pixelmap_t *, double, double, pixelmap_extend_t); 41 struct ui; 42 typedef struct ui ui_t; 42 43 43 extern pixel_t filter_nearest(pixelmap_t *, double, double, pixelmap_extend_t); 44 extern pixel_t filter_bilinear(pixelmap_t *, double, double, pixelmap_extend_t); 45 extern pixel_t filter_bicubic(pixelmap_t *, double, double, pixelmap_extend_t); 44 /** Use the default display service (argument to ui_create() */ 45 #define UI_DISPLAY_DEFAULT NULL 46 46 47 47 #endif -
uspace/lib/ui/include/types/ui/wdecor.h
r7a873f0 r7e38970d 1 1 /* 2 * Copyright (c) 2011 Martin Decky 3 * Copyright (c) 2012 Petr Koupy 2 * Copyright (c) 2020 Jiri Svoboda 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup draw29 /** @addtogroup libui 31 30 * @{ 32 31 */ 33 32 /** 34 * @file 33 * @file Window decoration 35 34 */ 36 35 37 #ifndef DRAW_SURFACE_H_38 #define DRAW_SURFACE_H_36 #ifndef _UI_TYPES_WDECOR_H 37 #define _UI_TYPES_WDECOR_H 39 38 40 #include < stdbool.h>41 #include < io/pixelmap.h>39 #include <gfx/coord.h> 40 #include <types/ui/cursor.h> 42 41 43 struct surface;44 typedef struct surface surface_t;42 struct ui_wdecor; 43 typedef struct ui_wdecor ui_wdecor_t; 45 44 46 typedef sysarg_t surface_coord_t; 45 /** Window decoration style */ 46 typedef enum { 47 /** No style bits */ 48 ui_wds_none = 0x0, 49 /** Window has a frame */ 50 ui_wds_frame = 0x1, 51 /** Window has a title bar */ 52 ui_wds_titlebar = 0x2, 53 /** Window has a close button */ 54 ui_wds_close_btn = 0x4, 55 /** Window is resizable */ 56 ui_wds_resizable = 0x8, 57 /** Window is decorated (default decoration) */ 58 ui_wds_decorated = ui_wds_frame | ui_wds_titlebar | ui_wds_close_btn 59 } ui_wdecor_style_t; 47 60 61 /** Window resize type */ 48 62 typedef enum { 49 SURFACE_FLAG_NONE = 0, 50 SURFACE_FLAG_SHARED = 1 51 } surface_flags_t; 63 ui_wr_none = 0, 52 64 53 extern surface_t *surface_create(surface_coord_t, surface_coord_t, pixel_t *, surface_flags_t); 54 extern void surface_destroy(surface_t *); 65 ui_wr_top = 0x1, 66 ui_wr_left = 0x2, 67 ui_wr_bottom = 0x4, 68 ui_wr_right = 0x8, 55 69 56 extern bool surface_is_shared(surface_t *); 57 extern pixel_t *surface_direct_access(surface_t *); 58 extern pixelmap_t *surface_pixmap_access(surface_t *); 59 extern void surface_get_resolution(surface_t *, surface_coord_t *, surface_coord_t *); 60 extern void surface_get_damaged_region(surface_t *, surface_coord_t *, surface_coord_t *, 61 surface_coord_t *, surface_coord_t *); 62 extern void surface_add_damaged_region(surface_t *, surface_coord_t, surface_coord_t, 63 surface_coord_t, surface_coord_t); 64 extern void surface_reset_damaged_region(surface_t *); 70 ui_wr_top_left = ui_wr_top | ui_wr_left, 71 ui_wr_bottom_left = ui_wr_bottom | ui_wr_left, 72 ui_wr_bottom_right = ui_wr_bottom | ui_wr_right, 73 ui_wr_top_right = ui_wr_top | ui_wr_right 74 } ui_wdecor_rsztype_t; 65 75 66 extern void surface_put_pixel(surface_t *, surface_coord_t, surface_coord_t, pixel_t); 67 extern pixel_t surface_get_pixel(surface_t *, surface_coord_t, surface_coord_t); 76 /** Window decoration callbacks */ 77 typedef struct ui_wdecor_cb { 78 void (*close)(ui_wdecor_t *, void *); 79 void (*move)(ui_wdecor_t *, void *, gfx_coord2_t *); 80 void (*resize)(ui_wdecor_t *, void *, ui_wdecor_rsztype_t, 81 gfx_coord2_t *); 82 void (*set_cursor)(ui_wdecor_t *, void *, ui_stock_cursor_t); 83 } ui_wdecor_cb_t; 68 84 69 85 #endif -
uspace/lib/ui/include/ui/entry.h
r7a873f0 r7e38970d 1 1 /* 2 * Copyright (c) 20 13 Martin Decky2 * 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 Text entry 34 34 */ 35 35 36 #ifndef GUI_CANVAS_H_37 #define GUI_CANVAS_H_36 #ifndef _UI_ENTRY_H 37 #define _UI_ENTRY_H 38 38 39 #include <stdbool.h> 40 #include <io/pixel.h> 41 #include <draw/surface.h> 42 #include "widget.h" 43 #include "connection.h" 39 #include <errno.h> 40 #include <gfx/coord.h> 41 #include <gfx/text.h> 42 #include <types/ui/control.h> 43 #include <types/ui/entry.h> 44 #include <types/ui/resource.h> 44 45 45 typedef struct { 46 widget_t widget; 47 sysarg_t width; 48 sysarg_t height; 49 surface_t *surface; 50 signal_t keyboard_event; 51 signal_t position_event; 52 } canvas_t; 53 54 extern bool init_canvas(canvas_t *, widget_t *, const void *, sysarg_t, 55 sysarg_t, surface_t *); 56 extern canvas_t *create_canvas(widget_t *, const void *, sysarg_t, sysarg_t, 57 surface_t *); 58 extern bool update_canvas(canvas_t *, surface_t *); 59 extern void deinit_canvas(canvas_t *); 46 extern errno_t ui_entry_create(ui_resource_t *, const char *, 47 ui_entry_t **); 48 extern void ui_entry_destroy(ui_entry_t *); 49 extern ui_control_t *ui_entry_ctl(ui_entry_t *); 50 extern void ui_entry_set_rect(ui_entry_t *, gfx_rect_t *); 51 extern void ui_entry_set_halign(ui_entry_t *, gfx_halign_t); 52 extern errno_t ui_entry_set_text(ui_entry_t *, const char *); 53 extern errno_t ui_entry_paint(ui_entry_t *); 60 54 61 55 #endif -
uspace/lib/ui/include/ui/label.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 Label 34 34 */ 35 35 36 #ifndef GUI_LABEL_H_37 #define GUI_LABEL_H_36 #ifndef _UI_LABEL_H 37 #define _UI_LABEL_H 38 38 39 #include <stdint.h> 40 #include <io/pixel.h> 39 #include <errno.h> 40 #include <gfx/coord.h> 41 #include <gfx/text.h> 42 #include <types/ui/control.h> 43 #include <types/ui/label.h> 44 #include <types/ui/resource.h> 41 45 42 #include <draw/source.h> 43 #include <draw/font.h> 44 45 #include "connection.h" 46 #include "widget.h" 47 48 typedef struct label { 49 widget_t widget; 50 source_t background; 51 source_t text; 52 char *caption; 53 font_t *font; 54 slot_t rewrite; 55 } label_t; 56 57 extern bool init_label(label_t *, widget_t *, const void *, const char *, 58 uint16_t, pixel_t, pixel_t); 59 extern label_t *create_label(widget_t *, const void *, const char *, uint16_t, 60 pixel_t, pixel_t); 61 extern void deinit_label(label_t *); 46 extern errno_t ui_label_create(ui_resource_t *, const char *, 47 ui_label_t **); 48 extern void ui_label_destroy(ui_label_t *); 49 extern ui_control_t *ui_label_ctl(ui_label_t *); 50 extern void ui_label_set_rect(ui_label_t *, gfx_rect_t *); 51 extern void ui_label_set_halign(ui_label_t *, gfx_halign_t); 52 extern errno_t ui_label_set_text(ui_label_t *, const char *); 53 extern errno_t ui_label_paint(ui_label_t *); 62 54 63 55 #endif -
uspace/lib/ui/include/ui/pbutton.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 Push button 34 34 */ 35 35 36 #ifndef DRAW_SOURCE_H_37 #define DRAW_SOURCE_H_36 #ifndef _UI_PBUTTON_H 37 #define _UI_PBUTTON_H 38 38 39 #include <errno.h> 40 #include <gfx/coord.h> 41 #include <io/pos_event.h> 42 #include <types/ui/control.h> 43 #include <types/ui/event.h> 44 #include <types/ui/pbutton.h> 45 #include <types/ui/resource.h> 39 46 #include <stdbool.h> 40 47 41 #include <transform.h> 42 #include <filter.h> 43 #include <io/pixelmap.h> 44 45 #include "surface.h" 46 47 typedef struct source { 48 transform_t transform; 49 filter_t filter; 50 51 pixel_t color; 52 surface_t *texture; 53 pixelmap_extend_t texture_extend; 54 55 pixel_t alpha; 56 surface_t *mask; 57 pixelmap_extend_t mask_extend; 58 } source_t; 59 60 extern void source_init(source_t *); 61 62 extern void source_set_transform(source_t *, transform_t); 63 extern void source_reset_transform(source_t *); 64 65 extern void source_set_filter(source_t *, filter_t); 66 67 extern void source_set_color(source_t *, pixel_t); 68 extern void source_set_texture(source_t *, surface_t *, pixelmap_extend_t); 69 70 extern void source_set_alpha(source_t *, pixel_t); 71 extern void source_set_mask(source_t *, surface_t *, pixelmap_extend_t); 72 73 extern bool source_is_fast(source_t *); 74 extern pixel_t *source_direct_access(source_t *, double, double); 75 extern pixel_t source_determine_pixel(source_t *, double, double); 48 extern errno_t ui_pbutton_create(ui_resource_t *, const char *, 49 ui_pbutton_t **); 50 extern void ui_pbutton_destroy(ui_pbutton_t *); 51 extern ui_control_t *ui_pbutton_ctl(ui_pbutton_t *); 52 extern void ui_pbutton_set_cb(ui_pbutton_t *, ui_pbutton_cb_t *, void *); 53 extern void ui_pbutton_set_rect(ui_pbutton_t *, gfx_rect_t *); 54 extern void ui_pbutton_set_default(ui_pbutton_t *, bool); 55 extern errno_t ui_pbutton_paint(ui_pbutton_t *); 56 extern void ui_pbutton_press(ui_pbutton_t *); 57 extern void ui_pbutton_release(ui_pbutton_t *); 58 extern void ui_pbutton_enter(ui_pbutton_t *); 59 extern void ui_pbutton_leave(ui_pbutton_t *); 60 extern void ui_pbutton_clicked(ui_pbutton_t *); 61 extern ui_evclaim_t ui_pbutton_pos_event(ui_pbutton_t *, pos_event_t *); 76 62 77 63 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
