[q-lang-cvs] qcalc calclib.q,1.44,1.45 qcalc.q,1.192,1.193
Brought to you by:
agraef
From: Albert G. <ag...@us...> - 2007-11-28 06:11:59
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10282 Modified Files: calclib.q qcalc.q Log Message: added pixmap GUI element Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.192 retrieving revision 1.193 diff -C2 -d -r1.192 -r1.193 *** qcalc.q 28 Nov 2007 04:38:42 -0000 1.192 --- qcalc.q 28 Nov 2007 06:11:55 -0000 1.193 *************** *** 2782,2785 **** --- 2782,2804 ---- = qt X "setText" S; + pixmap_gui (I,J) () S:String + = qt X "setBackgroundMode" (qt_val "Qt" "PaletteBase") || + qt X "setPixmap" PM || + qt TABLE "setCellWidget" (I,J,X) || IT + if not is_nil IT and then not is_nil X + where PM = + if null S then NULLPM + else qt_new "QPixmap" S, + X:QtObject = qt_object "QLabel" TABLE + "MyPixmap" (I,J) [] [] [], + IT:QtObject = make_table_item (I,J,X) + (qt_val "QTableItem" "Never"); + + pixmap_gui (I,J) X:QtObject S:String + = qt X "setPixmap" PM + where PM = + if null S then NULLPM + else qt_new "QPixmap" S; + /* Text<->value conversion routines for spinboxes. */ *************** *** 2819,2824 **** gui_set_slider); "MyLabel", (label_gui, ! gui_get_label,gui_getc_label, gui_set_label); "MyPushButton", (pushbutton_gui, gui_get_pushbutton,gui_getc_pushbutton, --- 2838,2846 ---- gui_set_slider); "MyLabel", (label_gui, ! gui_get_nop,gui_getc_nop, gui_set_label); + "MyPixmap", (pixmap_gui, + gui_get_nop,gui_getc_nop, + gui_set_pixmap); "MyPushButton", (pushbutton_gui, gui_get_pushbutton,gui_getc_pushbutton, *************** *** 2841,2848 **** gui_class X = C where (C|_) = qt_mob_data X; ! = "MyCheckBox" if class_name X = "QCheckTableItem"; = if qt X "isEditable" () then "MyComboEdit" else "MyComboBox" ! if class_name X = "QComboTableItem"; gui_gettype X = F where C:String = gui_class X, (F|_) = GUI_TYPES!C; --- 2863,2871 ---- gui_class X = C where (C|_) = qt_mob_data X; ! where C:String = class_name X: ! = "MyCheckBox" if C = "QCheckTableItem"; = if qt X "isEditable" () then "MyComboEdit" else "MyComboBox" ! if C = "QComboTableItem"; gui_gettype X = F where C:String = gui_class X, (F|_) = GUI_TYPES!C; *************** *** 2851,2854 **** --- 2874,2881 ---- /* Get the value of a GUI element. */ + gui_hasval X = neq GV gui_get_nop + where C:String = gui_class X, (_,GV,_,_) = GUI_TYPES!C; + = false otherwise; + gui_getval X = GV X where C:String = gui_class X, (_,GV,_,_) = GUI_TYPES!C; // = printf "unknown GUI element %s\n" (class_name X) || 0; *************** *** 2878,2884 **** = qt X "value" (); - gui_get_label X - = qt X "text" (); - /* Get the value in string form. */ --- 2905,2908 ---- *************** *** 2913,2919 **** = str $ qt X "value" (); - gui_getc_label X - = qt X "text" (); - /* Set the value of a GUI element from a string. */ --- 2937,2940 ---- *************** *** 2981,2984 **** --- 3002,3012 ---- if checkstr 'Y where 'Y = valq S; + gui_set_pixmap X S + = qt X "setPixmap" PM + where PM = + if null Y then NULLPM + else qt_new "QPixmap" Y + if checkstr 'Y where 'Y = valq S; + // Convert a spinbox value; use the special value text and the text->value // converter if available. *************** *** 3034,3038 **** submit_val (I,J) Y if checkval Y ! where Y = gui_getval X; gui_clear X (I,J) --- 3062,3067 ---- submit_val (I,J) Y if checkval Y ! where Y = gui_getval X ! if gui_hasval X; gui_clear X (I,J) *************** *** 3714,3717 **** --- 3743,3752 ---- (I1,J1) = val K1, S1:String = val S1, IT:QtObject = make_gui label_gui (I1,J1) S1; + = results_loop T0 (insert U ((I1,J1),IT)) [(I,J)|V] + where [(K1,S1)] = regex "" + "^\\+\\+\\+ Pixmap: (\\([0-9]+,[0-9]+\\)) (.*)$" S + (reg 1,reg 2), + (I1,J1) = val K1, S1:String = val S1, + IT:QtObject = make_gui pixmap_gui (I1,J1) S1; // anything else just gets passed to the digest function, and we try again = local (digest S) || results_loop T0 U [(I,J)|V]; Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** calclib.q 28 Nov 2007 04:25:36 -0000 1.44 --- calclib.q 28 Nov 2007 06:11:55 -0000 1.45 *************** *** 40,50 **** /* Definition of GUI elements in table cells. Currently supported are (rich) ! text labels, checkboxes, comboboxes (both non-editable and editable), ! spinboxes, horizontal and vertical sliders, push buttons and toggle ! buttons. You can find examples for all of these in the guiexamples.qcalc ! spreadsheet included in the QCalc distribution. */ ! public label ARGS, checkbox ARGS, combobox ARGS, comboedit ARGS, spinbox ARGS, ! hslider ARGS, vslider ARGS, pushbutton ARGS, togglebutton ARGS; /* The action button is a special push button which has an associated Q --- 40,50 ---- /* Definition of GUI elements in table cells. Currently supported are (rich) ! text labels, pixmaps, checkboxes, comboboxes (both non-editable and ! editable), spinboxes, horizontal and vertical sliders, push buttons and ! toggle buttons. You can find examples for all of these in the ! guiexamples.qcalc spreadsheet included in the QCalc distribution. */ ! public label ARGS, pixmap ARGS, checkbox ARGS, combobox ARGS, comboedit ARGS, ! spinbox ARGS, hslider ARGS, vslider ARGS, pushbutton ARGS, togglebutton ARGS; /* The action button is a special push button which has an associated Q *************** *** 178,181 **** --- 178,185 ---- where (I,J) = get YYKEY; + pixmap S:String = printf "\f+++ Pixmap: %s %s\n" (str (I,J),str S) || + flush || yyset (I,J) S || S + where (I,J) = get YYKEY; + checkbox S:String = checkbox (S,false); |