Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

GUI/Widgets/vtkKWTkUtilities.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWTkUtilities.h,v $
00004 
00005   Copyright (c) Kitware, Inc.
00006   All rights reserved.
00007   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00020 #ifndef __vtkKWTkUtilities_h
00021 #define __vtkKWTkUtilities_h
00022 
00023 #include "vtkObject.h"
00024 #include "vtkKWWidgets.h" // Needed for export symbols directives
00025 
00026 // This has to be here because on HP varargs are included in 
00027 // tcl.h and they have different prototypes for va_start so
00028 // the build fails. Defining HAS_STDARG prevents that.
00029 
00030 #if defined(__hpux) && !defined(HAS_STDARG)
00031 #define HAS_STDARG
00032 #endif
00033 
00034 #include <stdarg.h> // Needed for "va_list" argument of EstimateFormatLength.
00035 
00036 class vtkKWWidget;
00037 class vtkKWCoreWidget;
00038 class vtkKWApplication;
00039 class vtkKWIcon;
00040 struct Tcl_Interp;
00041 
00042 class KWWIDGETS_EXPORT vtkKWTkUtilities : public vtkObject
00043 {
00044 public:
00045   static vtkKWTkUtilities* New();
00046   vtkTypeRevisionMacro(vtkKWTkUtilities,vtkObject);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048 
00050 
00051   static const char* GetTclNameFromPointer(
00052     Tcl_Interp *interp, vtkObject *obj);
00053   static const char* GetTclNameFromPointer(
00054     vtkKWApplication *app, vtkObject *obj);
00056     
00058 
00066   static const char* EvaluateString(
00067     Tcl_Interp *interp, const char *format, ...);
00068   static const char* EvaluateString(
00069     vtkKWApplication *app, const char *format, ...);
00070   //ETX
00071   static const char* EvaluateStringFromArgs(
00072     Tcl_Interp *interp, const char *format, 
00073     va_list var_args1, va_list var_args2);
00074   static const char* EvaluateStringFromArgs(
00075     vtkKWApplication *app, const char *format, 
00076     va_list var_args1, va_list var_args2);
00077   static const char* EvaluateSimpleString(
00078     Tcl_Interp *interp, const char *str);
00079   static const char* EvaluateSimpleString(
00080     vtkKWApplication *app, const char *str);
00082 
00084 
00088   static void GetRGBColor(Tcl_Interp *interp,
00089                           const char *widget, 
00090                           const char *color, 
00091                           double *r, double *g, double *b);
00092   static void GetRGBColor(vtkKWWidget *widget, 
00093                           const char *color, 
00094                           double *r, double *g, double *b);
00096 
00098 
00101   static void GetOptionColor(Tcl_Interp *interp,
00102                              const char *widget, 
00103                              const char *option, 
00104                              double *r, double *g, double *b);
00105   static void GetOptionColor(vtkKWWidget *widget,
00106                              const char *option, 
00107                              double *r, double *g, double *b);
00108   static double* GetOptionColor(vtkKWWidget *widget,
00109                                 const char *option);
00111   
00113 
00116   static void SetOptionColor(Tcl_Interp *interp,
00117                              const char *widget, 
00118                              const char *option, 
00119                              double r, double g, double b);
00120   static void SetOptionColor(vtkKWWidget *widget,
00121                              const char *option, 
00122                              double r, double g, double b);
00124   
00126 
00129   static int QueryUserForColor(Tcl_Interp *interp,
00130                                const char *dialog_parent,
00131                                const char *dialog_title,
00132                                double in_r, double in_g, double in_b,
00133                                double *out_r, double *out_g, double *out_b);
00134   static int QueryUserForColor(vtkKWApplication *app,
00135                                const char *dialog_parent,
00136                                const char *dialog_title,
00137                                double in_r, double in_g, double in_b,
00138                                double *out_r, double *out_g, double *out_b);
00140 
00142 
00147   static int GetGeometry(Tcl_Interp *interp,
00148                          const char *widget, 
00149                          int *width, int *height, int *x, int *y);
00150   static int GetGeometry(vtkKWWidget *widget,
00151                          int *width, int *height, int *x, int *y);
00153 
00155 
00159   static int ContainsCoordinates(Tcl_Interp *interp,
00160                                  const char *widget, 
00161                                  int x, int y);
00162   static int ContainsCoordinates(vtkKWWidget *widget,
00163                                  int x, int y);
00165   
00167 
00176   enum 
00177   { 
00178     UpdatePhotoOptionFlipVertical = 1
00179   };
00180   //ETX
00181   static int UpdatePhoto(Tcl_Interp *interp,
00182                          const char *photo_name,
00183                          const unsigned char *pixels, 
00184                          int width, int height,
00185                          int pixel_size,
00186                          unsigned long buffer_length = 0,
00187                          int update_options = 0);
00188   static int UpdatePhoto(vtkKWApplication *app,
00189                          const char *photo_name,
00190                          const unsigned char *pixels, 
00191                          int width, int height,
00192                          int pixel_size,
00193                          unsigned long buffer_length = 0,
00194                          int update_options = 0);
00196 
00198 
00200   static int UpdatePhotoFromIcon(vtkKWApplication *app,
00201                                  const char *photo_name,
00202                                  vtkKWIcon *icon,
00203                                  int update_options = 0);
00204   static int UpdatePhotoFromPredefinedIcon(vtkKWApplication *app,
00205                                            const char *photo_name,
00206                                            int icon_index,
00207                                            int update_options = 0);
00209 
00211 
00223   static int UpdateOrLoadPhoto(Tcl_Interp *interp,
00224                                const char *photo_name,
00225                                const char *file_name,
00226                                const char *directory,
00227                                const unsigned char *pixels, 
00228                                int width, int height,
00229                                int pixel_size,
00230                                unsigned long buffer_length = 0);
00231   static int UpdateOrLoadPhoto(vtkKWApplication *app,
00232                                const char *photo_name,
00233                                const char *file_name,
00234                                const char *directory,
00235                                const unsigned char *pixels, 
00236                                int width, int height,
00237                                int pixel_size,
00238                                unsigned long buffer_length = 0);
00240 
00242 
00248   static void SetImageOptionToPixels(
00249     vtkKWCoreWidget *widget,
00250     const unsigned char *pixels, 
00251     int width, int height, 
00252     int pixel_size = 4,
00253     unsigned long buffer_length = 0,
00254     const char *image_option = 0);
00256 
00258 
00261   static int FindPhoto(Tcl_Interp *interp, const char *photo_name);
00262   static int FindPhoto(vtkKWApplication *app, const char *photo_name);
00264 
00266 
00272   static int GetPhotoHeight(Tcl_Interp *interp, const char *photo_name);
00273   static int GetPhotoHeight(vtkKWApplication *app, const char *photo_name);
00274   static int GetPhotoHeight(vtkKWWidget *widget);
00276 
00278 
00282   static int GetPhotoWidth(Tcl_Interp *interp, const char *photo_name);
00283   static int GetPhotoWidth(vtkKWApplication *app, const char *photo_name);
00285 
00287 
00291   static int ChangeFontWeightToBold(
00292     Tcl_Interp *interp, const char *font, char *new_font);
00293   static int ChangeFontWeightToNormal(
00294     Tcl_Interp *interp, const char *font, char *new_font);
00296 
00298 
00301   static int ChangeFontWeightToBold(Tcl_Interp *interp, const char *widget);
00302   static int ChangeFontWeightToBold(vtkKWWidget *widget);
00303   static int ChangeFontWeightToNormal(Tcl_Interp *interp, const char *widget);
00304   static int ChangeFontWeightToNormal(vtkKWWidget *widget);
00306 
00308 
00312   static int ChangeFontSlantToItalic(
00313     Tcl_Interp *interp, const char *font, char *new_font);
00314   static int ChangeFontSlantToRoman(
00315     Tcl_Interp *interp, const char *font, char *new_font);
00317 
00319 
00322   static int ChangeFontSlantToItalic(Tcl_Interp *interp, const char *widget);
00323   static int ChangeFontSlantToItalic(vtkKWWidget *widget);
00324   static int ChangeFontSlantToRoman(Tcl_Interp *interp, const char *widget);
00325   static int ChangeFontSlantToRoman(vtkKWWidget *widget);
00327 
00329 
00333   static int GetGridSize(Tcl_Interp *interp,
00334                          const char *widget,
00335                          int *nb_of_cols,
00336                          int *nb_of_rows);
00337   static int GetGridSize(vtkKWWidget *widget,
00338                          int *nb_of_cols,
00339                          int *nb_of_rows);
00341 
00343 
00347   static int GetWidgetPositionInGrid(Tcl_Interp *interp,
00348                                      const char *widget,
00349                                      int *col,
00350                                      int *row);
00351   static int GetWidgetPositionInGrid(vtkKWWidget *widget,
00352                                      int *col,
00353                                      int *row);
00355 
00357 
00363   static int GetSlavesBoundingBoxInPack(Tcl_Interp *interp,
00364                                         const char *widget,
00365                                         int *width,
00366                                         int *height);
00367   static int GetSlavesBoundingBoxInPack(vtkKWWidget *widget,
00368                                         int *width,
00369                                         int *height);
00371 
00373 
00379   static int GetSlaveHorizontalPositionInPack(Tcl_Interp *interp,
00380                                               const char *widget,
00381                                               const char *slave,
00382                                               int *x);
00383   static int GetSlaveHorizontalPositionInPack(vtkKWWidget *widget,
00384                                               vtkKWWidget *slave,
00385                                               int *x);
00387 
00389 
00392   static int GetWidgetPaddingInPack(Tcl_Interp *interp,
00393                                     const char *widget,
00394                                     int *ipadx,
00395                                     int *ipady,
00396                                     int *padx,
00397                                     int *pady);
00399 
00401 
00406   static int GetMasterInPack(Tcl_Interp *interp,
00407                              const char *widget,
00408                              ostream &in);
00409   static int GetMasterInPack(vtkKWWidget *widget,
00410                              ostream &in);
00412 
00414 
00419   static int GetGridColumnWidths(Tcl_Interp *interp,
00420                                  const char *widget,
00421                                  int *nb_of_cols,
00422                                  int **col_widths,
00423                                  int allocate = 0);
00425 
00427 
00432   static int SynchroniseGridsColumnMinimumSize(Tcl_Interp *interp,
00433                                                int nb_of_widgets,
00434                                                const char **widgets,
00435                                                const float *factors = 0,
00436                                                const int *weights = 0);
00438 
00440 
00446   static int SynchroniseLabelsMaximumWidth(Tcl_Interp *interp,
00447                                            int nb_of_widgets,
00448                                            const char **widgets,
00449                                            const char *options = 0);
00450   static int SynchroniseLabelsMaximumWidth(vtkKWApplication *app,
00451                                            int nb_of_widgets,
00452                                            const char **widgets,
00453                                            const char *options = 0);
00455 
00457 
00462   static int GetSlavesInPack(Tcl_Interp *interp,
00463                              const char *widget,
00464                              char ***slaves);
00465   static int GetSlavesInPack(vtkKWWidget *widget,
00466                              char ***slaves);
00468 
00470 
00476   static int GetPreviousAndNextSlaveInPack(Tcl_Interp *interp,
00477                                            const char *widget,
00478                                            const char *slave,
00479                                            ostream &previous_slave,
00480                                            ostream &next_slave);
00481   static int GetPreviousAndNextSlaveInPack(vtkKWWidget *widget,
00482                                            vtkKWWidget *slave,
00483                                            ostream &previous_slave,
00484                                            ostream &next_slave);
00485   // Description:
00486   // Take screendump of the widget given by 'widget' (say, .foo.bar) and store
00487   // it into a png file given by 'fname'.
00488   // A convenience method is provided to query a vtkKWWidget directly.
00489   // Return 1 on success, 0 otherwise.
00490   static int TakeScreenDump(Tcl_Interp *interp,
00491                             const char *wname, 
00492                             const char *fname, 
00493                             int top = 0, int bottom = 0, 
00494                             int left = 0, int right = 0);
00495   static int TakeScreenDump(vtkKWWidget *widget,
00496                             const char *fname, 
00497                             int top = 0, int bottom = 0, 
00498                             int left = 0, int right = 0);
00500 
00502 
00504   static int SetTopLevelMouseCursor(Tcl_Interp *interp,
00505                                     const char *widget,
00506                                     const char *cursor);
00507   static int SetTopLevelMouseCursor(vtkKWWidget *widget,
00508                                     const char *cursor);
00510 
00512 
00513   static int IsTopLevel(Tcl_Interp *interp,
00514                         const char *widget);
00515   static int IsTopLevel(vtkKWWidget *widget);
00517 
00518 protected:
00519   vtkKWTkUtilities() {};
00520   ~vtkKWTkUtilities() {};
00521 
00522   //BTX  
00523   //ETX
00524 
00525   static int ChangeFontWeight(Tcl_Interp *interp, const char *widget, int);
00526   static int ChangeFontWeight(Tcl_Interp *interp, 
00527                               const char *font, char *new_font, int);
00528   static int ChangeFontSlant(Tcl_Interp *interp, const char *widget, int);
00529   static int ChangeFontSlant(Tcl_Interp *interp, 
00530                              const char *font, char *new_font, int);
00531 
00532   static const char* EvaluateStringFromArgsInternal(
00533     Tcl_Interp *interp, vtkObject *obj, const char *format, 
00534     va_list var_args1, va_list var_args2);
00535   static const char* EvaluateSimpleStringInternal(
00536     Tcl_Interp *interp, vtkObject *obj, const char *str);
00537 
00538 private:
00539   vtkKWTkUtilities(const vtkKWTkUtilities&); // Not implemented
00540   void operator=(const vtkKWTkUtilities&); // Not implemented
00541 };
00542 
00543 #endif
00544 

Generated on Tue May 30 12:31:44 2006 for ParaView by doxygen 1.3.5