-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTableBox.H
More file actions
96 lines (80 loc) · 1.99 KB
/
TableBox.H
File metadata and controls
96 lines (80 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef _HBOX_H_
#define _HBOX_H_
#ifdef WIN32
#define uint unsigned int
#endif
#define NONE 0
#define EXPAND 2
#define FILL 4
#define TABLEBOX 1
#define VBOX 2
#define HBOX 3
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <FL/Fl.H>
#include <FL/Fl_Group.H>
struct TABLE_CELL {
Fl_Widget * o;
uint w, h;
bool x_expand, y_expand;
bool x_fill, y_fill;
uint x_span, y_span;
float x_align, y_align;
};
struct CELL_GAP {
uint w, h;
};
struct TABLE {
uint cols, rows;
std::vector < std::vector <TABLE_CELL> > cell;
CELL_GAP *gap;
};
class TableBox : public Fl_Group {
private:
int __type;
uint cur_row, cur_col;
TABLE * t;
public:
TableBox(int _x, int _y, int _w, int _h);
~TableBox();
void layout();
// get
int Type();
void Size(uint & _rows, uint & _cols);
uint Size();
uint Rows();
uint Cols();
CELL_GAP* Gap();
void Gap(uint & _w, uint & _h);
Fl_Widget* Widget(uint _row, uint _col);
TABLE_CELL* Cell(uint _row, uint _col);
// set
void Type(int _type);
void Size(uint _rows, uint _cols);
void Size(uint _len);
void Rows(uint _len);
void Cols(uint _len);
void AddCell(uint _len);
void Gap(CELL_GAP * _gap);
void Gap(uint _w, uint _h);
void Widget(Fl_Widget *_widget, uint cols, uint rows);
void Cell(TABLE_CELL *_cell, uint _row, uint _col);
void Attach(Fl_Widget *_widget,
uint _col, uint _row,
uint _w = 100, uint _h = 25,
uint _x_prop = FILL, uint _y_prop = NONE,
uint _x_span = 1, uint _y_span = 1,
float _x_align = 0.0f, float _y_align = 0.0f);
void Add(Fl_Widget * _widget,
uint _w = 100, uint _h = 25,
uint _x_prop = FILL, uint _y_prop = NONE,
uint _x_span = 1, uint _y_span = 1,
float _x_align = 0.0f, float _y_align = 0.0f);
void resize(int X,int Y,int W,int H) {
Fl_Group::resize(X,Y,W,H);
layout();
}
};
#endif