From d577d991b97ae2b5ee1af23641bcffc3f83af5b2 Mon Sep 17 00:00:00 2001 From: Pixel Date: Wed, 4 Nov 2009 11:56:41 -0800 Subject: Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux. --- iup/test/matrix_cbmode.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 iup/test/matrix_cbmode.c (limited to 'iup/test/matrix_cbmode.c') diff --git a/iup/test/matrix_cbmode.c b/iup/test/matrix_cbmode.c new file mode 100755 index 0000000..0d0e17c --- /dev/null +++ b/iup/test/matrix_cbmode.c @@ -0,0 +1,85 @@ +#include +#include +#include + +#include "iup.h" +#include "iupcontrols.h" + +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 char* value_cb(Ihandle *self, int lin, int col) +{ + if (lin == 0 || col == 0) + return "Title"; + 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); + return IUP_DEFAULT; +} + +static Ihandle* create_matrix(void) +{ + Ihandle* mat = IupMatrix(NULL); + + IupSetAttribute(mat, "NUMCOL", "3"); + IupSetAttribute(mat, "NUMLIN", "3"); + + IupSetAttribute(mat, "NUMCOL_VISIBLE", "3"); + IupSetAttribute(mat, "NUMLIN_VISIBLE", "3"); + +// IupSetAttribute(mat, "WIDTH2", "90"); +// IupSetAttribute(mat, "HEIGHT2", "30"); +// IupSetAttribute(mat, "WIDTHDEF", "34"); +// IupSetAttribute(mat,"RESIZEMATRIX", "YES"); + IupSetAttribute(mat,"SCROLLBAR", "NO"); + IupSetCallback(mat,"VALUE_CB",(Icallback)value_cb); + IupSetCallback(mat,"VALUE_EDIT_CB",(Icallback)value_edit_cb); + +// IupSetAttribute(mat, "HEIGHT0", "10"); +// IupSetAttribute(mat, "WIDTH0", "90"); +// IupSetAttribute(mat,"MARKMODE","LIN"); +// IupSetAttribute(mat,"MARKMULTIPLE","NO"); + + //IupSetAttribute(mat, "NUMCOL_VISIBLE_LAST", "YES"); + //IupSetAttribute(mat, "NUMLIN_VISIBLE_LAST", "YES"); +// IupSetAttribute(mat, "WIDTHDEF", "15"); + + return mat; +} + +void MatrixCbModeTest(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(); + + MatrixCbModeTest(); + + IupMainLoop(); + + IupClose(); + + return EXIT_SUCCESS; +} +#endif -- cgit v1.2.3