Graphics-VTK

 view release on metacpan or  search on metacpan

Tk/pTk/mTk/vtkTcl/vtkTkImageWindowWidget.cxx  view on Meta::CPAN


#include <stdio.h>
#include <stdlib.h>

#include "vtkTkport.h"
#include "tkPort.h"
#include "tkInt.h"
#ifdef _WIN32
#include "tkWin.h"
#endif
#include "tkVMacro.h"

#include "vtkTkImageWindowWidget.h"

#ifdef _WIN32
#pragma warning ( disable : 4273 )
#else
#include "vtkXImageWindow.h"
#endif

#define VTK_ALL_EVENTS_MASK \
    KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|      \
    EnterWindowMask|LeaveWindowMask|PointerMotionMask|ExposureMask|     \
    VisibilityChangeMask|FocusChangeMask|PropertyChangeMask|ColormapChangeMask

#define VTK_MAX(a,b)    (((a)>(b))?(a):(b))
    
// These are the options that can be set when the widget is created
// or with the command configure.  The only new one is "-rw" which allows
// the uses to set their own ImageWindow window.
static Tk_ConfigSpec vtkTkImageWindowWidgetConfigSpecs[] = {
    {TK_CONFIG_PIXELS, "-height", "height", "Height",
     "400", Tk_Offset(struct vtkTkImageWindowWidget, Height), 0, NULL},
  
    {TK_CONFIG_PIXELS, "-width", "width", "Width",
     "400", Tk_Offset(struct vtkTkImageWindowWidget, Width), 0, NULL},
  
    {TK_CONFIG_LANGARG, "-iw", "iw", "IW",
     (char*)NULL, Tk_Offset(struct vtkTkImageWindowWidget, IW), 0, NULL},

    {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
     (char *) NULL, 0, 0, NULL}
};


// Foward prototypes
static void vtkTkImageWindowWidget_EventProc(ClientData clientData, 
                                             XEvent *eventPtr);
static int vtkTkImageWindowWidget_MakeImageWindow(struct vtkTkImageWindowWidget *self);
int vtkImageWindowCommand(ClientData cd, Tcl_Interp *interp,
				 int argc, Arg *args)
{ int i; return 1;} // Dummy definition, routine not needed for perltk

    
//----------------------------------------------------------------------------
// It's possible to change with this function or in a script some
// options like width, hieght or the ImageWindow widget.
int vtkTkImageWindowWidget_Configure(Tcl_Interp *interp, 
				     struct vtkTkImageWindowWidget *self,
				     int argc, Arg *args, int flags) 
{
  // Let Tk handle generic configure options.
  if (Tk_ConfigureWidget(interp, self->TkWin, 
			 vtkTkImageWindowWidgetConfigSpecs,
			 argc, args, (char *)self, flags) == TCL_ERROR) 
    {
    return(TCL_ERROR);
    }
  
  // Get the new  width and height of the widget
  Tk_GeometryRequest(self->TkWin, self->Width, self->Height);



( run in 1.662 second using v1.01-cache-2.11-cpan-39bf76dae61 )