summaryrefslogtreecommitdiff
path: root/iup/test/matrix_cbmode.c
diff options
context:
space:
mode:
Diffstat (limited to 'iup/test/matrix_cbmode.c')
-rwxr-xr-xiup/test/matrix_cbmode.c66
1 files changed, 55 insertions, 11 deletions
diff --git a/iup/test/matrix_cbmode.c b/iup/test/matrix_cbmode.c
index 0d0e17c..99ac21f 100755
--- a/iup/test/matrix_cbmode.c
+++ b/iup/test/matrix_cbmode.c
@@ -5,33 +5,60 @@
#include "iup.h"
#include "iupcontrols.h"
-static char data[3][3][50] =
+//static char data[3][3][50] =
+//{
+// {"1:1", "1:2", "1:3"},
+// {"2:1", "2:2", "2:3"},
+// {"3:1", "3:2", "3:3"},
+//};
+
+
+static int dropcheck_cb(Ihandle *self, int lin, int col)
{
- {"1:1", "1:2", "1:3"},
- {"2:1", "2:2", "2:3"},
- {"3:1", "3:2", "3:3"},
-};
+ if (lin == 3 && col == 1)
+ return IUP_DEFAULT;
+ return IUP_IGNORE;
+}
+static int drop(Ihandle *self, Ihandle *drop, int lin, int col)
+{
+ printf("drop_cb(%d, %d)\n", lin, col);
+ if(lin == 3 && col == 1)
+ {
+ IupSetAttribute(drop, "1", "A - Test of Very Big String for Dropdown!");
+ IupSetAttribute(drop, "2", "B");
+ IupSetAttribute(drop, "3", "C");
+ IupSetAttribute(drop, "4", "XXX");
+ IupSetAttribute(drop, "5", "5");
+ IupSetAttribute(drop, "6", "6");
+ IupSetAttribute(drop, "7", "7");
+ IupSetAttribute(drop, "8", NULL);
+ return IUP_DEFAULT;
+ }
+ return IUP_IGNORE;
+}
static char* value_cb(Ihandle *self, int lin, int col)
{
if (lin == 0 || col == 0)
return "Title";
- return data[lin-1][col-1];
+ return "cell";
+// return data[lin-1][col-1];
}
static int value_edit_cb(Ihandle *self, int lin, int col, char* newvalue)
{
- strcpy(data[lin-1][col-1], newvalue);
+// strcpy(data[lin-1][col-1], newvalue);
return IUP_DEFAULT;
}
static Ihandle* create_matrix(void)
{
Ihandle* mat = IupMatrix(NULL);
+ int lin, col;
- IupSetAttribute(mat, "NUMCOL", "3");
- IupSetAttribute(mat, "NUMLIN", "3");
+ IupSetAttribute(mat, "NUMCOL", "20");
+ IupSetAttribute(mat, "NUMLIN", "5000");
IupSetAttribute(mat, "NUMCOL_VISIBLE", "3");
IupSetAttribute(mat, "NUMLIN_VISIBLE", "3");
@@ -40,19 +67,36 @@ static Ihandle* create_matrix(void)
// IupSetAttribute(mat, "HEIGHT2", "30");
// IupSetAttribute(mat, "WIDTHDEF", "34");
// IupSetAttribute(mat,"RESIZEMATRIX", "YES");
- IupSetAttribute(mat,"SCROLLBAR", "NO");
+ IupSetAttribute(mat,"SCROLLBAR", "YES");
IupSetCallback(mat,"VALUE_CB",(Icallback)value_cb);
- IupSetCallback(mat,"VALUE_EDIT_CB",(Icallback)value_edit_cb);
+// IupSetCallback(mat,"VALUE_EDIT_CB",(Icallback)value_edit_cb);
+// IupSetCallback(mat, "DROPCHECK_CB", (Icallback)dropcheck_cb);
+// IupSetCallback(mat,"DROP_CB",(Icallback)drop);
// IupSetAttribute(mat, "HEIGHT0", "10");
// IupSetAttribute(mat, "WIDTH0", "90");
// IupSetAttribute(mat,"MARKMODE","LIN");
// IupSetAttribute(mat,"MARKMULTIPLE","NO");
+ IupSetAttribute(mat,"MARKMODE","CELL");
+ IupSetAttribute(mat,"MARKMULTIPLE","YES");
+ IupSetAttribute(mat,"USETITLESIZE","YES");
//IupSetAttribute(mat, "NUMCOL_VISIBLE_LAST", "YES");
//IupSetAttribute(mat, "NUMLIN_VISIBLE_LAST", "YES");
// IupSetAttribute(mat, "WIDTHDEF", "15");
+// IupSetAttribute(mat,"FRAMEVERTCOLOR1:2","BGCOLOR");
+// IupSetAttribute(mat,"FRAMEHORIZCOLOR2:1","BGCOLOR");
+
+ for (lin = 0; lin < 3000; lin++)
+ {
+ for (col = 0; col < 20; col++)
+ {
+ IupMatSetAttribute(mat,"BGCOLOR", lin, col, "192 192 192");
+ IupMatSetAttribute(mat,"FGCOLOR", lin, col, "1 1 1");
+ }
+ }
+
return mat;
}