Changeset 7e38970d in mainline for uspace/lib/ui/private


Ignore:
Timestamp:
2020-12-07T00:08:37Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
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.
Message:

Merge branch 'jxsvoboda-gfx' into master

Location:
uspace/lib/ui/private
Files:
5 added
6 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/private/control.h

    r7a873f0 r7e38970d  
    11/*
    2  * Copyright (c) 2012 Petr Koupy
     2 * Copyright (c) 2020 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup softrend
     29/** @addtogroup libui
    3030 * @{
    3131 */
    3232/**
    33  * @file
     33 * @file UI control structure
     34 *
    3435 */
    3536
    36 #ifndef SOFTREND_RECTANGLE_H_
    37 #define SOFTREND_RECTANGLE_H_
     37#ifndef _UI_PRIVATE_CONTROL_H
     38#define _UI_PRIVATE_CONTROL_H
    3839
     40#include <gfx/coord.h>
    3941#include <stdbool.h>
    40 #include <types/common.h>
    4142
    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 */
     48struct 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};
    5058
    5159#endif
  • uspace/lib/ui/private/dummygc.h

    r7a873f0 r7e38970d  
    11/*
    2  * Copyright (c) 2011 Petr Koupy
     2 * Copyright (c) 2020 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libc
     29/** @addtogroup libui
    3030 * @{
    3131 */
    3232/**
    33  * @file
     33 * @file Dummy graphic context
     34 *
    3435 */
    3536
    36 #ifndef _LIBC_IO_MODE_H_
    37 #define _LIBC_IO_MODE_H_
     37#ifndef _UI_PRIVATE_DUMMYGC_H
     38#define _UI_PRIVATE_DUMMYGC_H
    3839
    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>
    4341
     42/** Dummy graphic context */
    4443typedef 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;
    4854
    49 typedef union {
    50         visual_t pixel_visual;
    51         char_attr_type_t field_visual;
    52 } cell_visual_t;
     55/** Dummy GC bitmap */
     56typedef struct {
     57        dummy_gc_t *dgc;
     58        gfx_bitmap_alloc_t alloc;
     59        bool myalloc;
     60} dummygc_bitmap_t;
    5361
    54 typedef struct {
    55         sysarg_t index;
    56         sysarg_t version;
     62/** Dummy GC ops */
     63extern gfx_context_ops_t dummygc_ops;
    5764
    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;
     65extern errno_t dummygc_create(dummy_gc_t **);
     66extern void dummygc_destroy(dummy_gc_t *);
     67extern gfx_context_t *dummygc_get_ctx(dummy_gc_t *);
    7168
    7269#endif
  • uspace/lib/ui/private/fixed.h

    r7a873f0 r7e38970d  
    11/*
    2  * Copyright (c) 2012 Petr Koupy
     2 * Copyright (c) 2020 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup draw
     29/** @addtogroup libui
    3030 * @{
    3131 */
    3232/**
    33  * @file
     33 * @file Fixed layout structure
     34 *
    3435 */
    3536
    36 #ifndef DRAW_PATH_H_
    37 #define DRAW_PATH_H_
     37#ifndef _UI_PRIVATE_FIXED_H
     38#define _UI_PRIVATE_FIXED_H
    3839
    3940#include <adt/list.h>
     41#include <gfx/coord.h>
     42#include <stdbool.h>
     43#include <types/ui/fixed.h>
    4044
    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 */
     49struct ui_fixed {
     50        /** Base control object */
     51        struct ui_control *control;
     52        /** Layout elements (ui_fixed_elem_t) */
     53        list_t elem;
     54};
    4555
     56/** Fixed layout element. */
    4657typedef 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;
    5265
    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);
     66extern ui_fixed_elem_t *ui_fixed_first(ui_fixed_t *f);
     67extern ui_fixed_elem_t *ui_fixed_next(ui_fixed_elem_t *);
    6568
    6669#endif
  • uspace/lib/ui/private/image.h

    r7a873f0 r7e38970d  
    11/*
    2  * Copyright (c) 2019 Jiri Svoboda
     2 * Copyright (c) 2020 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libguigfx
     29/** @addtogroup libui
    3030 * @{
    3131 */
    3232/**
    33  * @file GFX canvas backend structure
     33 * @file Image structure
    3434 *
    3535 */
    3636
    37 #ifndef _GUIGFX_PRIVATE_CANVAS_H
    38 #define _GUIGFX_PRIVATE_CANVAS_H
     37#ifndef _UI_PRIVATE_IMAGE_H
     38#define _UI_PRIVATE_IMAGE_H
    3939
    40 #include <canvas.h>
    41 #include <draw/surface.h>
    4240#include <gfx/bitmap.h>
    43 #include <gfx/context.h>
    4441#include <gfx/coord.h>
    45 #include <io/pixel.h>
    46 #include <memgfx/memgc.h>
    4742
    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 */
     47struct 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;
    5860};
    5961
  • uspace/lib/ui/private/ui.h

    r7a873f0 r7e38970d  
    11/*
    2  * Copyright (c) 2012 Petr Koupy
     2 * Copyright (c) 2020 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup gui
     29/** @addtogroup libui
    3030 * @{
    3131 */
    3232/**
    33  * @file
     33 * @file User interface
     34 *
    3435 */
    3536
    36 #ifndef GUI_MINIMAL_H_
    37 #define GUI_MINIMAL_H_
     37#ifndef _UI_PRIVATE_UI_H
     38#define _UI_PRIVATE_UI_H
    3839
     40#include <display.h>
    3941#include <stdbool.h>
    40 #include <io/pixel.h>
    4142
    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 */
     47struct 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};
    5455
    5556#endif
  • uspace/lib/ui/private/window.h

    r7a873f0 r7e38970d  
    11/*
    2  * Copyright (c) 2012 Petr Koupy
     2 * Copyright (c) 2020 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup draw
     29/** @addtogroup libui
    3030 * @{
    3131 */
    3232/**
    33  * @file
     33 * @file Window structure
     34 *
    3435 */
    3536
    36 #ifndef DRAW_DRAWCTX_H_
    37 #define DRAW_DRAWCTX_H_
     37#ifndef _UI_PRIVATE_WINDOW_H
     38#define _UI_PRIVATE_WINDOW_H
    3839
    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>
    4045
    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 */
     50struct 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;
    6375};
    6476
    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);
     77extern void ui_window_send_close(ui_window_t *);
     78extern void ui_window_send_focus(ui_window_t *);
     79extern void ui_window_send_kbd(ui_window_t *, kbd_event_t *);
     80extern errno_t ui_window_send_paint(ui_window_t *);
     81extern void ui_window_send_pos(ui_window_t *, pos_event_t *);
     82extern void ui_window_send_unfocus(ui_window_t *);
    8083
    8184#endif
Note: See TracChangeset for help on using the changeset viewer.