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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#undef __IUPDEF_H
#include "iup.h"
#include "iupcontrols.h"
static int dropcheck_cb(Ihandle *self, int lin, int col)
{
if (lin == 3 && col == 1)
return IUP_DEFAULT;
return IUP_IGNORE;
}
static Ihandle* create_matrix(void)
{
Ihandle* mat = IupMatrix(NULL);
IupSetAttribute(mat, "NUMCOL", "15");
IupSetAttribute(mat, "NUMLIN", "20");
// IupSetAttribute(mat, "NUMCOL", "2");
// IupSetAttribute(mat, "NUMLIN", "3");
IupSetAttribute(mat, "0:0", "Inflation");
IupSetAttribute(mat, "1:0", "Medicine\nPharma");
IupSetAttribute(mat, "2:0", "Food");
IupSetAttribute(mat, "3:0", "Energy");
IupSetAttribute(mat, "0:1", "January 2000");
IupSetAttribute(mat, "0:2", "February 2000");
IupSetAttribute(mat, "1:1", "5.6\n3.33");
IupSetAttribute(mat, "2:1", "2.2");
IupSetAttribute(mat, "3:1", "7.2");
IupSetAttribute(mat, "1:2", "4.5");
IupSetAttribute(mat, "2:2", "8.1");
IupSetAttribute(mat, "3:2", "3.4");
IupSetAttribute(mat, "3:3", "Font Test");
IupSetAttribute(mat, "WIDTH2", "90");
IupSetAttribute(mat, "HEIGHT2", "30");
IupSetAttribute(mat,"SORTSIGN2","DOWN");
// IupSetAttribute(mat, "WIDTHDEF", "34");
IupSetAttribute(mat,"MULTILINE", "YES");
IupSetAttribute(mat,"RESIZEMATRIX", "YES");
IupSetAttribute(mat,"USETITLESIZE", "YES");
//IupSetAttribute(mat,"SCROLLBAR", "NO");
//IupSetAttribute(mat, "BGCOLOR1:2", "255 92 255");
//IupSetAttribute(mat, "BGCOLOR2:*", "92 92 255");
//IupSetAttribute(mat, "BGCOLOR*:3", "255 92 92");
//IupSetAttribute(mat, "FGCOLOR1:2", "255 0 0");
//IupSetAttribute(mat, "FGCOLOR2:*", "0 128 0");
//IupSetAttribute(mat, "FGCOLOR*:3", "0 0 255");
//IupSetAttribute(mat, "FONT1:2", "Helvetica, 24");
//IupSetAttribute(mat, "FONT2:*", "Courier, 14");
//IupSetAttribute(mat, "FONT*:3", "Times, Bold 14");
//IupSetAttribute(mat, "ALIGNMENT2", "ARIGHT");
// IupSetAttribute(mat, "ACTIVE", "NO");
IupSetAttribute(mat,"MARKMODE","CELL");
// IupSetAttribute(mat,"MARKMODE","LIN");
// IupSetAttribute(mat,"MARKMULTIPLE","NO");
IupSetAttribute(mat,"MARKMULTIPLE","YES");
// IupSetAttribute(mat,"MARKAREA","NOT_CONTINUOUS");
IupSetAttribute(mat,"MARK2:2","YES");
IupSetAttribute(mat,"MARK2:3","YES");
IupSetAttribute(mat,"MARK3:3","YES");
// IupSetAttribute(mat,"MARKMODE","LINCOL");
//IupSetAttribute(mat, "NUMCOL_VISIBLE_LAST", "YES");
//IupSetAttribute(mat, "NUMLIN_VISIBLE_LAST", "YES");
IupSetAttribute(mat, "WIDTHDEF", "15");
IupSetAttribute(mat, "20:15", "The End");
IupSetAttribute(mat, "10:0", "Middle Line");
IupSetAttribute(mat, "15:0", "Middle Line");
IupSetAttribute(mat, "0:7", "Middle Column");
IupSetAttribute(mat, "0:11", "Middle Column");
IupSetAttribute(mat, "20:0", "Line Title Test");
IupSetAttribute(mat, "0:15", "Column Title Test");
IupSetAttribute(mat, "NUMCOL_VISIBLE", "6");
IupSetAttribute(mat, "NUMLIN_VISIBLE", "8");
IupSetCallback(mat, "DROPCHECK_CB", (Icallback)dropcheck_cb);
return mat;
}
void MatrixTest(void)
{
Ihandle* dlg, *box;
box = IupVbox(create_matrix(), NULL);
IupSetAttribute(box, "MARGIN", "10x10");
dlg = IupDialog(box);
IupSetAttribute(dlg, "TITLE", "IupMatrix Simple Test");
IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
}
#ifndef BIG_TEST
int main(int argc, char* argv[])
{
IupOpen(&argc, &argv);
IupControlsOpen();
MatrixTest();
IupMainLoop();
IupClose();
return EXIT_SUCCESS;
}
#endif
|