00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWSplashScreen.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 =========================================================================*/ 00014 // .NAME vtkKWSplashScreen - a splash dialog. 00015 // .SECTION Description 00016 // A class for displaying splash screen. 00017 00018 #ifndef __vtkKWSplashScreen_h 00019 #define __vtkKWSplashScreen_h 00020 00021 #include "vtkKWTopLevel.h" 00022 00023 class vtkKWCanvas; 00024 class vtkKWIcon; 00025 00026 class KWWidgets_EXPORT vtkKWSplashScreen : public vtkKWTopLevel 00027 { 00028 public: 00029 static vtkKWSplashScreen* New(); 00030 vtkTypeRevisionMacro(vtkKWSplashScreen, vtkKWTopLevel); 00031 void PrintSelf(ostream& os, vtkIndent indent); 00032 00033 // Description: 00034 // Set the text of the progress message 00035 void SetProgressMessage(const char *); 00036 00037 // Description: 00038 // Set/Get the offset of the progress message (negative value means 00039 // offset from the bottom of the splash, positive value from the top) 00040 virtual void SetProgressMessageVerticalOffset(int); 00041 vtkGetMacro(ProgressMessageVerticalOffset, int); 00042 00043 // Description: 00044 // Specifies an image to display in the splashscreen. 00045 // The SetImageToPredefinedIcon method accepts an index to one of the 00046 // predefined icon listed in vtkKWIcon. 00047 // The SetImageToPixels method sets the image using pixel data. It expects 00048 // a pointer to the pixels and the structure of the image, i.e. its width, 00049 // height and the pixel_size (how many bytes per pixel, say 3 for RGB, or 00050 // 1 for grayscale). If buffer_length = 0, it is computed automatically 00051 // from the previous parameters. If it is not, it will most likely indicate 00052 // that the buffer has been encoded using base64 and/or zlib. 00053 // If pixel_size > 3 (i.e. RGBA), the image is blend the with background 00054 // color of the widget. 00055 // The SetImageName method can be used to specify a pre-existing Tk image. 00056 virtual void SetImageToIcon(vtkKWIcon *icon); 00057 virtual void SetImageToPredefinedIcon(int icon_index); 00058 virtual void SetImageToPixels( 00059 const unsigned char *pixels, int width, int height, int pixel_size, 00060 unsigned long buffer_length = 0); 00061 00062 // Description: 00063 // Read an image and use it as the splash image. 00064 // Check vtkKWResourceUtilities::ReadImage for the list of supported 00065 // image format 00066 // Return 1 on success, 0 otherwise 00067 virtual int ReadImage(const char *filename); 00068 00069 // Description: 00070 // Set/Get the name of the splashscreen image, as a Tk image name. 00071 // This method is kept for backward compatibility only, as it exposes 00072 // our dependency to Tk internal data structures. Use ReadImage, 00073 // SetImageToIcon or SetImageToPixels instead. 00074 vtkGetStringMacro(ImageName); 00075 virtual void SetImageName(const char*); 00076 00077 // Description: 00078 // Update the "enable" state of the object and its internal parts. 00079 // Depending on different Ivars (this->Enabled, the application's 00080 // Limited Edition Mode, etc.), the "enable" state of the object is updated 00081 // and propagated to its internal parts/subwidgets. This will, for example, 00082 // enable/disable parts of the widget UI, enable/disable the visibility 00083 // of 3D widgets, etc. 00084 virtual void UpdateEnableState(); 00085 00086 // Description: 00087 // Display the toplevel. Hide it with the Withdraw() method. 00088 virtual void Display(); 00089 00090 // Description: 00091 // Callbacks. 00092 virtual void ButtonPressCallback(); 00093 00094 protected: 00095 vtkKWSplashScreen(); 00096 ~vtkKWSplashScreen(); 00097 00098 // Description: 00099 // Create the widget. 00100 virtual void CreateWidget(); 00101 00102 vtkKWCanvas *Canvas; 00103 char *ImageName; 00104 int ProgressMessageVerticalOffset; 00105 int Discard; 00106 00107 virtual void UpdateImageInCanvas(); 00108 virtual void UpdateCanvasSize(); 00109 virtual void UpdateProgressMessagePosition(); 00110 00111 // Description: 00112 // Get the width/height of the toplevel as requested 00113 // by the window manager. Not exposed in public since it is so Tk 00114 // related. Is is usually used to get the geometry of a window before 00115 // it is mapped to screen, as requested by the geometry manager. 00116 // Override to prevent the splashscreen from flickering at startup. 00117 // Return the size of the image itself, without explicitly calling 00118 // 'update' to let the geometry manager figure things out (= flicker) 00119 virtual int GetRequestedWidth(); 00120 virtual int GetRequestedHeight(); 00121 00122 private: 00123 vtkKWSplashScreen(const vtkKWSplashScreen&); // Not implemented 00124 void operator=(const vtkKWSplashScreen&); // Not implemented 00125 }; 00126 00127 00128 #endif 00129 00130 00131