18 #ifndef __vtkKWTkUtilities_h
19 #define __vtkKWTkUtilities_h
21 #include "vtkObject.h"
28 #if defined(__hpux) && !defined(HAS_STDARG)
38 class vtkRenderWindow;
46 void PrintSelf(ostream& os, vtkIndent indent);
50 static const char* GetTclNameFromPointer(
51 Tcl_Interp *interp, vtkObject *obj);
52 static const char* GetTclNameFromPointer(
66 static const char* EvaluateString(
67 Tcl_Interp *interp,
const char *format, ...);
68 static const char* EvaluateString(
71 static const char* EvaluateStringFromArgs(
72 Tcl_Interp *interp,
const char *format,
73 va_list var_args1, va_list var_args2);
74 static const char* EvaluateStringFromArgs(
76 va_list var_args1, va_list var_args2);
77 static const char* EvaluateSimpleString(
78 Tcl_Interp *interp,
const char *str);
79 static const char* EvaluateSimpleString(
85 static const char* EvaluateEncodedString(
87 const unsigned char *buffer,
89 unsigned long decoded_length);
100 static void CreateObjectMethodCommand(
102 char **command, vtkObject *
object,
const char *method);
103 static void CreateObjectMethodCommand(
105 char **command, vtkObject *
object,
const char *method);
112 static void GetRGBColor(Tcl_Interp *interp,
115 double *r,
double *g,
double *b);
118 double *r,
double *g,
double *b);
124 static void GetOptionColor(Tcl_Interp *interp,
127 double *r,
double *g,
double *b);
130 double *r,
double *g,
double *b);
139 static void GetDefaultOptionColor(Tcl_Interp *interp,
142 double *r,
double *g,
double *b);
143 static void GetDefaultOptionColor(
vtkKWWidget *widget,
145 double *r,
double *g,
double *b);
146 static double* GetDefaultOptionColor(
vtkKWWidget *widget,
153 static void SetOptionColor(Tcl_Interp *interp,
156 double r,
double g,
double b);
159 double r,
double g,
double b);
166 const char *dialog_title,
167 double in_r,
double in_g,
double in_b,
168 double *out_r,
double *out_g,
double *out_b);
176 static int GetGeometry(Tcl_Interp *interp,
178 int *width,
int *height,
int *x,
int *y);
180 int *width,
int *height,
int *x,
int *y);
191 static int ContainsCoordinates(Tcl_Interp *interp,
194 static int ContainsCoordinates(
vtkKWWidget *widget,
196 static vtkKWWidget* ContainsCoordinatesForSpecificType(
197 vtkKWWidget *widget,
int x,
int y,
const char *classname);
213 UpdatePhotoOptionFlipVertical = 1
216 static int UpdatePhoto(Tcl_Interp *interp,
217 const char *photo_name,
218 const unsigned char *pixels,
219 int width,
int height,
221 unsigned long buffer_length = 0,
222 int update_options = 0);
224 const char *photo_name,
225 const unsigned char *pixels,
226 int width,
int height,
228 unsigned long buffer_length = 0,
229 int update_options = 0);
235 const char *photo_name,
237 int update_options = 0);
239 const char *photo_name,
241 int update_options = 0);
257 static int UpdateOrLoadPhoto(Tcl_Interp *interp,
258 const char *photo_name,
259 const char *file_name,
260 const char *directory,
261 const unsigned char *pixels,
262 int width,
int height,
264 unsigned long buffer_length = 0);
266 const char *photo_name,
267 const char *file_name,
268 const char *directory,
269 const unsigned char *pixels,
270 int width,
int height,
272 unsigned long buffer_length = 0);
282 static void SetImageOptionToPixels(
284 const unsigned char *pixels,
285 int width,
int height,
287 unsigned long buffer_length = 0,
288 const char *image_option = 0);
294 static int FindPhoto(Tcl_Interp *interp,
const char *photo_name);
304 static int GetPhotoHeight(Tcl_Interp *interp,
const char *photo_name);
313 static int GetPhotoWidth(Tcl_Interp *interp,
const char *photo_name);
321 static int ChangeFontWeightToBold(
322 Tcl_Interp *interp,
const char *font,
char *new_font);
323 static int ChangeFontWeightToNormal(
324 Tcl_Interp *interp,
const char *font,
char *new_font);
330 static int ChangeFontWeightToBold(Tcl_Interp *interp,
const char *widget);
331 static int ChangeFontWeightToBold(
vtkKWWidget *widget);
332 static int ChangeFontWeightToNormal(Tcl_Interp *interp,
const char *widget);
333 static int ChangeFontWeightToNormal(
vtkKWWidget *widget);
340 static int ChangeFontSlantToItalic(
341 Tcl_Interp *interp,
const char *font,
char *new_font);
342 static int ChangeFontSlantToRoman(
343 Tcl_Interp *interp,
const char *font,
char *new_font);
349 static int ChangeFontSlantToItalic(Tcl_Interp *interp,
const char *widget);
350 static int ChangeFontSlantToItalic(
vtkKWWidget *widget);
351 static int ChangeFontSlantToRoman(Tcl_Interp *interp,
const char *widget);
352 static int ChangeFontSlantToRoman(
vtkKWWidget *widget);
359 static int ChangeFontSize(
360 Tcl_Interp *interp,
const char *font,
int new_size,
char *new_font);
366 static int ChangeFontSize(
367 Tcl_Interp *interp,
const char *widget,
int new_size);
368 static int ChangeFontSize(
vtkKWWidget *widget,
int new_size);
375 static int GetRealActualFont(
376 Tcl_Interp *interp,
const char *font,
char *real_font);
382 static int GetFontMeasure(
vtkKWWidget *widget,
const char *txt,
int *w);
389 static int GetGridSize(Tcl_Interp *interp,
403 static int GetWidgetPositionInGrid(Tcl_Interp *interp,
407 static int GetWidgetPositionInGrid(
vtkKWWidget *widget,
418 static int GetSlavesBoundingBoxInPack(Tcl_Interp *interp,
422 static int GetSlavesBoundingBoxInPack(
vtkKWWidget *widget,
434 static int GetSlaveHorizontalPositionInPack(Tcl_Interp *interp,
438 static int GetSlaveHorizontalPositionInPack(
vtkKWWidget *widget,
447 static int GetWidgetPaddingInPack(Tcl_Interp *interp,
461 static int GetMasterInPack(Tcl_Interp *interp,
473 static int GetGridColumnWidths(Tcl_Interp *interp,
485 static int SynchroniseGridsColumnMinimumSize(Tcl_Interp *interp,
487 const char **widgets,
488 const float *factors = 0,
489 const int *weights = 0);
499 static int SynchroniseLabelsMaximumWidth(Tcl_Interp *interp,
501 const char **widgets,
502 const char *options = 0);
505 const char **widgets,
506 const char *options = 0);
514 static int GetSlavesInPack(Tcl_Interp *interp,
527 static int GetPreviousAndNextSlaveInPack(Tcl_Interp *interp,
530 ostream &previous_slave,
531 ostream &next_slave);
532 static int GetPreviousAndNextSlaveInPack(
vtkKWWidget *widget,
534 ostream &previous_slave,
535 ostream &next_slave);
541 static int TakeScreenDump(Tcl_Interp *interp,
544 int top = 0,
int bottom = 0,
545 int left = 0,
int right = 0);
548 int top = 0,
int bottom = 0,
549 int left = 0,
int right = 0);
554 static int SetTopLevelMouseCursor(Tcl_Interp *interp,
557 static int SetTopLevelMouseCursor(
vtkKWWidget *widget,
562 static int IsTopLevel(Tcl_Interp *interp,
568 static void WithdrawTopLevel(Tcl_Interp *interp,
577 static const char *GetCurrentScript(Tcl_Interp *interp);
590 static const char* CreateTimerHandler(
593 vtkObject *
object,
const char *method);
594 static const char* CreateTimerHandler(
597 vtkObject *
object,
const char *method);
598 static const char* CreateIdleTimerHandler(
600 vtkObject *
object,
const char *method);
601 static const char* CreateIdleTimerHandler(
603 vtkObject *
object,
const char *method);
608 static void CancelTimerHandler(Tcl_Interp *interp,
const char *
id);
610 static void CancelAllTimerHandlers(Tcl_Interp *interp);
615 static void Bell(Tcl_Interp *interp);
622 static void ProcessPendingEvents(Tcl_Interp *interp);
629 static void ProcessIdleTasks(Tcl_Interp *interp);
637 static int CheckForPendingInteractionEvents(vtkRenderWindow *win);
642 static int GetMousePointerCoordinates(
643 Tcl_Interp *interp,
const char *widget,
int *x,
int *y);
644 static int GetMousePointerCoordinates(
650 static int GetWidgetCoordinates(
651 Tcl_Interp *interp,
const char *widget,
int *x,
int *y);
652 static int GetWidgetCoordinates(
659 static int GetWidgetRelativeCoordinates(
660 Tcl_Interp *interp,
const char *widget,
int *x,
int *y);
661 static int GetWidgetRelativeCoordinates(
673 static int GetWidgetSize(
674 Tcl_Interp *interp,
const char *widget,
int *w,
int *h);
675 static int GetWidgetSize(
683 static int GetWidgetRequestedSize(
684 Tcl_Interp *interp,
const char *widget,
int *w,
int *h);
685 static int GetWidgetRequestedSize(
690 static const char* GetWidgetClass(
691 Tcl_Interp *interp,
const char *widget);
692 static const char* GetWidgetClass(
698 static int GetScreenSize(
699 Tcl_Interp *interp,
const char *widget,
int *w,
int *h);
700 static int GetScreenSize(
708 static const char* GetWindowingSystem(Tcl_Interp *interp);
717 static int ChangeFontWeight(
718 Tcl_Interp *interp,
const char *widget,
int bold);
719 static int ChangeFontWeight(
720 Tcl_Interp *interp,
const char *font,
int bold,
char *new_font);
721 static int ChangeFontSlant(
722 Tcl_Interp *interp,
const char *widget,
int italic);
723 static int ChangeFontSlant(
724 Tcl_Interp *interp,
const char *font,
int italic,
char *new_font);
726 static const char* EvaluateStringFromArgsInternal(
727 Tcl_Interp *interp, vtkObject *obj,
const char *format,
728 va_list var_args1, va_list var_args2);
729 static const char* EvaluateSimpleStringInternal(
730 Tcl_Interp *interp, vtkObject *obj,
const char *str);