URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [insight/] [libgui/] [README] - Rev 1765
Compare with Previous | Blame | View Log
libgui - Handy GUI codeThis module has various pieces of code that are useful for a GUI. Forthe most part, they are Tcl/Tk-related.Open issues:- bitmaps and canvas code are duplicated in S-N; should look intosharing- tkTreeTable taken from S-N but modified; should use the sameversion in both places. Better yet, replace this widget withone that works betterHere's a brief runthrough:library/Directory of Tcl codeballoon.tclTcl code to implement balloon help (aka tooltips)Primary interface is the "balloon" command. See last function infile for details on usagebindings.tclProvides bind_widget_after_class proc; rearranges bindtags ina frequently-useful way.canvas.tclTcl procs relating to canvas widgetsset_scroll_region canvasSet the scroll region on CANVAS to include all items in thecanvas. Most easily used when bound to <Configure> on thecanvas.def.tclDefining words.defarray name ?value?Define a global array named NAME. VALUE, if present, is theinitial value. VALUE is in the format expected by "arrayset".defvar name ?value?Define a new global variable named NAME.gensym.tclProvides the proc "gensym", which generates new symbol names.gettext.tclDefines the stub proc "gettext", used for looking up text in alocalization database.hooks.tclProvides procs for handling hooks (lists of functions thatshould be run when something happens).lframe.tclProvides the Labelledframe widget -- a frame with a groove anda label.list.tclDefines useful list procs. Some of these are Tcl versions of Cfunctions in TclX.lvarpush listvar element ?index?Insert ELEMENT into list stored in LISTVAR (a variable).Element is inserted at INDEXth position. INDEX defaults to0.lvarpop listvar ?index?Remove INDEXth element from list stored in LISTVAR (avariable). Returns the removed element. INDEX defaults to0.lassign list argsAssign successive elements from LIST to variables named inARGS. If LIST is longer than ARGS, assign a list of remainingelements to last variable.lrmdups list argsRemove duplicates and sort list. ARGS, if specified, arearguments to lsortlremove list elementReturn list created by removing the first item `ELEMENT'mono.tclProcs for handling monochrome displays or colorblind usersprefs.tclApplication preference code. This will probably vanish at somepoint, once we figure out how we really want to do this. I justhad this code lying around, and it was useful to me, so I includedit.Defines a single interface, "preference", which has severalsubcommands:preference define name default docstring ?handler?Define a new preference. HANDLER, if specified, is a procto run whenever the preference's value changes.preference get nameReturn value of preference.preference documentation nameReturn doc string of preferencepreference varname nameReturn name of variable representing named preference. Thiscan be used eg as the -variable of a radiobutton.preference set name valueSet preference.preference get_commandsReturn text of commands which, when evalled, will restorethe current state of all defined preferences.sendpr.tclThe sendpr widget; a GUI for send-pr.topbind.tclCode for bindings on toplevels.bind_for_toplevel_only toplevel sequence scriptPut a binding on window TOPLEVEL for event SEQUENCE. When theevent is seen, SCRIPT will run. This proc adds a new bindtagto the toplevel to avoid the problems associated with puttingbindings directly on toplevels.ulset.tclAttempt to make setting the -underline option easier. This isparticular good when using gettext. Unfortunately the interfaceis hard to use; it should be changed.extract_label_info option labelExtract underline and label info from descriptor string LABEL.Any underline in LABEL is extracted, and the next character'sindex is used as the -underline value. There must be only oneunderline in LABEL. This proc returns a list of the form:OPTION NEWLABEL -underline INDEXEg: extract_label_info -text _File-> {-text File -underline 0}src/Directory of C code. This is all put into libide.a.paths.cUseful startup code that all applications should run.int ide_initialize (Tcl_Interp *interp, char *appname);This function:- Sets the global Tcl variable ide_application_name to APPNAME.- Searches the filesystem for the libide Tcl code, and setsup the auto_path appropriately. The IDE_LIBRARY environmentvariable can override the searching.- Sets up the auto_path to include the application's Tcl libraryas well (if possible). Applications should install their Tclcode in $(datadir)/APPNAME/- Runs the application's startup file - $(datadir)/APPNAME/APPNAME.tcl- Sets these entries in the global array Paths:Paths(bitmapdir) Location of libide bitmapsPaths(appdir) Location of application's scriptsThis function returns TCL_OK on success, and something else onerror.subcommand.cMakes it easy to write commands which are split into a number ofsubcommands (eg, like the Tcl "file" command).int create_command_with_subcommands (Tcl_interp *interp, char *name,struct subcommand_table *table)Create a new Tcl command name NAME. TABLE describes thesubcommands; see subcommand.h for details. Returns TCL_OK onsuccess, TCL_ERROR on failure.tkCanvEdge.c, tkCanvLayout.c, tkCanvLayout.h, tkCanvas.c, tkCanvas.hPatched versions (ugh) of the corresponding Tk files, and some newfiles. These files implement graph layout for canvases.
