~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina5/tina-tools/tinatool/wdgts/tcl/wdgtsTcl_tw_button.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**********
  2  * 
  3  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  4  * University of Manchester, UK.  All rights reserved.
  5  * 
  6  * Redistribution and use in source and binary forms, with or without modification, 
  7  * are permitted provided that the following conditions are met:
  8  * 
  9  *   . Redistributions of source code must retain the above copyright notice, 
 10  *     this list of conditions and the following disclaimer.
 11  *    
 12  *   . Redistributions in binary form must reproduce the above copyright notice,
 13  *     this list of conditions and the following disclaimer in the documentation 
 14  *     and/or other materials provided with the distribution.
 15  * 
 16  *   . Neither the name of the University of Manchester nor the names of its
 17  *     contributors may be used to endorse or promote products derived from this 
 18  *     software without specific prior written permission.
 19  * 
 20  * 
 21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 31  * POSSIBILITY OF SUCH DAMAGE.
 32  *
 33  **********
 34  * 
 35  * Program :    TINA
 36  * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/wdgts/tcl/wdgtsTcl_tw_button.c,v $
 37  * Date    :  $Date: 2007/02/15 01:55:50 $
 38  * Version :  $Revision: 1.4 $
 39  * CVS Id  :  $Id: wdgtsTcl_tw_button.c,v 1.4 2007/02/15 01:55:50 paul Exp $
 40  *
 41  * Author  : Legacy TINA
 42  *
 43  * Notes :
 44  *
 45  *********
 46 */
 47 
 48 #include "wdgtsTcl_tw_button.h"
 49 #include "wdgtsTcl_tw_command.h"
 50 
 51 #if HAVE_CONFIG_H
 52 #   include <config.h>
 53 #endif
 54 
 55 #include <stdio.h>
 56 #include<tcl.h>
 57 
 58 #include <tinatool/wdgts/tcl/wdgts_TclDef.h>
 59 #include <tinatool/wdgts/tcl/wdgtsTcl_tw_command.h>
 60 #include <tinatool/wdgts/tcl/wdgtsTcl_tw_tool.h>
 61 #include <tinatool/wdgts/tcl/wdgtsTcl_tcl_vars.h>
 62 #include <tinatool/wdgts/tcl/wdgtsTcl_tcl_util.h>
 63 
 64 static void button_call(Tw_callback * twc)
 65 {
 66         (*twc->func) (twc->data1);
 67 }
 68 
 69 
 70 static int ttcl_button_call(ClientData clientdata, Tcl_Interp *interp, 
 71                          int argc, char **argv)
 72 {
 73         Tw_callback  *twc = (Tw_callback *)clientdata;
 74 
 75         if (argc != 1)
 76         {
 77                 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
 78                                                                                  " Nothing ", (char *) NULL);
 79                 return TCL_ERROR;
 80         }
 81 
 82         button_call(twc);
 83 
 84   return TCL_OK;
 85 }
 86 
 87 
 88 static void button_cmnd(Tw_callback * twc)
 89 {
 90         (*twc->func) (twc->data1);
 91 }
 92 
 93 
 94 static void button_prnt(FILE * fp, Tw_callback * twc)
 95 {
 96         (void) fprintf(fp, "%s\n", twc->name);
 97 }
 98 
 99 
100 void tw_button(char *name, void (*func) ( /* ??? */ ), void *data)
101 {
102         Tcl_Interp      *interp;
103         Tw_callback *twc;
104         char        *fullname = tw_extend_fullname(tw_get_toolname(), name);
105         char        *tclname;
106 
107         if ((interp = ttcl_get_interp()) == NULL)
108                 return;
109         
110         twc = tw_callback_make(fullname, 0, button_call, button_cmnd,
111                                button_prnt, func, data, (void *)NULL);
112 
113         tclname = ttcl_mkshellname(fullname, TTCLBUTTON);
114   Tcl_CreateCommand(interp, tclname, ttcl_button_call, (ClientData)twc, 
115                         (Tcl_CmdDeleteProc *) NULL);
116 
117         rfree(tclname);
118 }
119 
120 
121 Panel_item tw_icon_button(char *name, int w, int h, short *image_bits,
122                                                                                                         void (*func) ( /* ??? */ ), int data)
123 {
124         return (0);
125 }
126 
127 
128 void tw_button_reset_image(Panel_item button, int w, int h,
129                                                                                                          short *image_bits)
130 {
131 }
132 
133 #ifdef INTERRUPT_BUTTON
134 
135 void tw_interrupt_button(void)
136 {
137 }
138 
139 void interrupt_button_data_get(Display ** display, Window * window)
140 {
141 }
142 #endif                                                                                                  /*INTERRUPT_BUTTON */
143 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.