ui/win32/grid.h

changeset 815
7ddf5fb7ec2a
parent 814
bcb3c7d486f3
child 818
8185cd761897
equal deleted inserted replaced
814:bcb3c7d486f3 815:7ddf5fb7ec2a
30 30
31 #include "../ui/win32.h" 31 #include "../ui/win32.h"
32 #include <stdbool.h> 32 #include <stdbool.h>
33 #include <cx/array_list.h> 33 #include <cx/array_list.h>
34 34
35 #include "win32.h"
36
37 #define INSETS_ZERO (GridEdgeInsets){0}
38 typedef struct GridEdgeInsets {
39 short top;
40 short bottom;
41 short left;
42 short right;
43 } GridEdgeInsets;
44
35 typedef struct GridLayoutInfo { 45 typedef struct GridLayoutInfo {
36 short margin_left; 46 GridEdgeInsets margin;
37 short margin_right;
38 short margin_top;
39 short margin_bottom;
40 short colspan; 47 short colspan;
41 short rowspan; 48 short rowspan;
42 int preferred_width; 49 int preferred_width;
43 int preferred_height; 50 int preferred_height;
44 bool hexpand; 51 bool hexpand;
47 bool vfill; 54 bool vfill;
48 } GridLayoutInfo; 55 } GridLayoutInfo;
49 56
50 typedef struct GridElm { 57 typedef struct GridElm {
51 W32Widget *widget; 58 W32Widget *widget;
52 int posx;
53 int posy;
54 int width;
55 int height;
56 short gridx; 59 short gridx;
57 short gridy; 60 short gridy;
58 GridLayoutInfo layout; 61 GridLayoutInfo layout;
59 } GridElm; 62 } GridElm;
60 63
61 typedef struct UiGridLayout { 64 typedef struct UiGridLayout {
62 HWND hwnd; 65 HWND hwnd;
63 66
64 short padding_top; 67 GridEdgeInsets padding;
65 short padding_bottom;
66 short padding_left;
67 short padding_right;
68 short columnspacing; 68 short columnspacing;
69 short rowspacing; 69 short rowspacing;
70
71 int preferred_width;
72 int preferred_height;
70 73
71 /* 74 /*
72 * list element type: GridElm 75 * list element type: GridElm
73 */ 76 */
74 CxList *widgets; 77 CxList *widgets;
75 78
79 int max_column;
80 int max_row;
81
76 } UiGridLayout; 82 } UiGridLayout;
77 83
78 UiGridLayout* ui_grid_container(const CxAllocator *a, HWND control, short padding, short columnspacing, short rowspacing); 84 typedef struct GridDef {
85 int size;
86 int pos;
87 int preferred_size;
88 BOOLEAN expand;
89 } GridDef;
90
91 UiGridLayout* ui_grid_layout_create(const CxAllocator *a, HWND control, short columnspacing, short rowspacing);
79 92
80 void ui_grid_add_widget( 93 void ui_grid_add_widget(
81 UiGridLayout *grid, 94 UiGridLayout *grid,
82 short x, 95 short x,
83 short y, 96 short y,
84 W32Widget *widget, 97 W32Widget *widget,
85 GridLayoutInfo *layout); 98 GridLayoutInfo *layout);
86 99
87 void ui_grid_layout(UiGridLayout *grid); 100 void ui_grid_layout(UiGridLayout *grid, int width, int height);
88 101
89 #endif //GRID_H 102 #endif //GRID_H

mercurial