debian/tmp/usr/include/KWWidgets/vtkKWIcon.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWIcon.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 vtkKWIcon - simple wrapper for icons
00015 // .SECTION Description
00016 // A simple icon wrapper. It can either be used with file KWIcons.h to 
00017 // provide a unified interface for internal icons or a wrapper for 
00018 // custom icons. The icons are defined with width, height, pixel_size, 
00019 // and array of unsigned char values.
00020 
00021 #ifndef __vtkKWIcon_h
00022 #define __vtkKWIcon_h
00023 
00024 #include "vtkObject.h"
00025 #include "vtkKWWidgets.h" // Needed for export symbols directives
00026 
00027 class vtkColorTransferFunction;
00028 class vtkImageData;
00029 
00030 class KWWidgets_EXPORT vtkKWIcon : public vtkObject
00031 {
00032 public:
00033   static vtkKWIcon* New();
00034   vtkTypeRevisionMacro(vtkKWIcon,vtkObject);
00035   void PrintSelf(ostream& os, vtkIndent indent);
00036   void DeepCopy(vtkKWIcon *p);
00037 
00038   //BTX
00039   // Description:
00040   // Predefined icons.
00041   enum { 
00042     IconAngleTool                 = 14,
00043     IconBiDimensionalTool         = 34,
00044     IconBoundingBox               = 13,
00045     IconBrowserBack               = 71,
00046     IconBrowserForward            = 72,
00047     IconBrowserUp                 = 70,
00048     IconBugMini                   = 200,
00049     IconCalculator                = 79,
00050     IconCamera                    = 19,
00051     IconCameraMini                = 175,
00052     IconCdRom                     = 75,
00053     IconColorAlphaSquares         = 216,
00054     IconColorBarAnnotation        = 12,
00055     IconColorSquares              = 18,
00056     IconColumns                   = 220,
00057     IconCompress                  = 211,
00058     IconConnection                = 1,
00059     IconContourSegment            = 33,
00060     IconContourTool               = 16,
00061     IconContrast                  = 212,
00062     IconCornerAnnotation          = 11,
00063     IconCropTool                  = 22,
00064     IconDistanceTool              = 15,
00065     IconDocument                  = 9,
00066     IconDocumentRGBColor          = 209,
00067     IconDocumentVolumeProperty    = 177,
00068     IconDocumentWindowLevel       = 176,
00069     IconEditContrast              = 225,
00070     IconEditVolumeProperties      = 226,
00071     IconEmpty16x16                = 6,
00072     IconEmpty1x1                  = 10,
00073     IconError                     = 2, 
00074     IconErrorMini                 = 3,
00075     IconErrorRedMini              = 4,
00076     IconExpand                    = 5,
00077     IconExpandLeftMini            = 180,
00078     IconExpandMini                = 23,
00079     IconExpandRightMini           = 178,
00080     IconExpandUpMini              = 179,
00081     IconEye                       = 17,
00082     IconFavorites                 = 67,
00083     IconFileDelete                = 73,
00084     IconFileOpen                  = 8,
00085     IconFloppy                    = 7,
00086     IconFloppyDrive               = 77,
00087     IconFolder                    = 20,
00088     IconFolder32                  = 65,
00089     IconFolderNew                 = 74,
00090     IconFolderOpen                = 21,
00091     IconFolderXP                  = 66,
00092     IconGrayscaleSquares          = 218,
00093     IconGridLinear                = 40,
00094     IconGridLog                   = 41,
00095     IconHSVDiagram                = 207,
00096     IconHardDrive                 = 76,
00097     IconHeaderAnnotation          = 50,
00098     IconHelpBubble                = 60,
00099     IconInfoMini                  = 61,
00100     IconInterpolationBilinear     = 215,
00101     IconInterpolationNearest      = 217,
00102     IconLock                      = 62,
00103     IconMagGlass                  = 63,
00104     IconMinus                     = 64,
00105     IconMove                      = 80,
00106     IconMoveH                     = 81,
00107     IconMoveV                     = 82,
00108     IconNetDrive                  = 78,
00109     IconNoIcon                    = 0,
00110     IconObliqueProbe              = 133,
00111     IconOrientationCubeAnnotation = 83,
00112     IconPanHand                   = 84,
00113     IconParallelProjection        = 213,
00114     IconPerspectiveProjection     = 214,
00115     IconPlus                      = 100,
00116     IconPointFinger               = 90,
00117     IconPresetAdd                 = 94,
00118     IconPresetApply               = 95,
00119     IconPresetDelete              = 96,
00120     IconPresetEmail               = 97,
00121     IconPresetFilter              = 237,
00122     IconPresetLoad                = 210,
00123     IconPresetLocate              = 98,
00124     IconPresetNext                = 173,
00125     IconPresetPrevious            = 174,
00126     IconPresetUpdate              = 99,
00127     IconQuestion                  = 101,
00128     IconReload                    = 102,
00129     IconResetCamera               = 222,
00130     IconResetContrast             = 223,
00131     IconRotate                    = 105,
00132     IconRows                      = 219,
00133     IconScaleBarAnnotation        = 106,
00134     IconSeedTool                  = 107,
00135     IconShrink                    = 103,
00136     IconSideAnnotation            = 110,
00137     IconSmallCounterBlue1         = 227,
00138     IconSmallCounterBlue2         = 228,
00139     IconSmallCounterBlue3         = 229,
00140     IconSmallCounterBlue4         = 230,
00141     IconSmallCounterBlue5         = 231,
00142     IconSmallCounterBlue6         = 232,
00143     IconSmallCounterBlue7         = 233,
00144     IconSmallCounterBlue8         = 234,
00145     IconSmallCounterBlue9         = 235,
00146     IconSmallCounterBlue9Plus     = 236,
00147     IconSpinDown                  = 111,
00148     IconSpinLeft                  = 112,
00149     IconSpinRight                 = 113,
00150     IconSpinUp                    = 114,
00151     IconStandardView              = 224,
00152     IconStopwatch                 = 104,
00153     IconTestTube                  = 190, 
00154     IconTime                      = 208,
00155     IconTransportBeginning        = 120,
00156     IconTransportEnd              = 121,
00157     IconTransportFastForward      = 122,
00158     IconTransportFastForwardToKey = 123,
00159     IconTransportLoop             = 124,
00160     IconTransportPause            = 125,
00161     IconTransportPlay             = 126,
00162     IconTransportPlayBackward     = 201,
00163     IconTransportPlayToKey        = 127,
00164     IconTransportRewind           = 128,
00165     IconTransportRewindToKey      = 129,
00166     IconTransportStop             = 130,
00167     IconTrashcan                  = 131,
00168     IconTreeClose                 = 150,
00169     IconTreeOpen                  = 151,
00170     IconWarning                   = 170,
00171     IconWarningMini               = 171,
00172     IconWindowLevel               = 172,
00173 
00174     IconNuvola16x16ActionsColorPicker        = 1022,
00175     IconNuvola16x16ActionsConfigure          = 1000,
00176     IconNuvola16x16ActionsDecrypted          = 1001,
00177     IconNuvola16x16ActionsEditCopy           = 1023,
00178     IconNuvola16x16ActionsEditCut            = 1024,
00179     IconNuvola16x16ActionsEditPaste          = 1025,
00180     IconNuvola16x16ActionsEncrypted          = 1019,
00181     IconNuvola16x16ActionsExit               = 1002,
00182     IconNuvola16x16ActionsFileClose          = 1003,
00183     IconNuvola16x16ActionsFileOpen           = 1004,
00184     IconNuvola16x16ActionsFilePrint          = 1005,
00185     IconNuvola16x16ActionsFileSave           = 1006,
00186     IconNuvola16x16ActionsHelp               = 1007,
00187     IconNuvola16x16ActionsHistory            = 1026,
00188     IconNuvola16x16ActionsKAlarm             = 1027,
00189     IconNuvola16x16ActionsLedBlue            = 1031,
00190     IconNuvola16x16ActionsLedGreen           = 1032,
00191     IconNuvola16x16ActionsLedLightBlue       = 1033,
00192     IconNuvola16x16ActionsLedLightGreen      = 1034,
00193     IconNuvola16x16ActionsLedOrange          = 1035,
00194     IconNuvola16x16ActionsLedPurple          = 1036,
00195     IconNuvola16x16ActionsLedRed             = 1037,
00196     IconNuvola16x16ActionsLedYellow          = 1038,
00197     IconNuvola16x16ActionsMailGeneric        = 1008,
00198     IconNuvola16x16ActionsMessage            = 1009,
00199     IconNuvola16x16ActionsMessageBoxCritical = 1010,
00200     IconNuvola16x16ActionsMessageBoxInfo     = 1011,
00201     IconNuvola16x16ActionsMessageBoxWarning  = 1012,
00202     IconNuvola16x16ActionsNo                 = 1013,
00203     IconNuvola16x16ActionsRotate             = 1014,
00204     IconNuvola16x16ActionsStop               = 1015,
00205     IconNuvola16x16ActionsThumbnail          = 1016,
00206     IconNuvola16x16ActionsViewBottom         = 1018,
00207     IconNuvola16x16ActionsViewFullScreen     = 1020,
00208     IconNuvola16x16ActionsViewLeftRight      = 1028,
00209     IconNuvola16x16ActionsViewMag            = 1017,
00210     IconNuvola16x16ActionsViewRight          = 1021,
00211     IconNuvola16x16ActionsViewTopBottom      = 1029,
00212     IconNuvola16x16ActionsWindowNew          = 1030,
00213     IconNuvola16x16AppsArk                   = 1300,
00214     IconNuvola16x16AppsBug                   = 1301,
00215     IconNuvola16x16AppsEmail                 = 1302,
00216     IconNuvola16x16AppsError                 = 1303,
00217     IconNuvola16x16AppsKeyboard              = 1304,
00218     IconNuvola16x16AppsKTimer                = 1305,
00219     IconNuvola16x16DevicesCamera             = 1600,
00220     IconNuvola16x16FilesystemsFolderInbox    = 1903,
00221     IconNuvola16x16FilesystemsFolderOutbox   = 1904,
00222     IconNuvola16x16FilesystemsTrashcanEmpty  = 1901,
00223     IconNuvola16x16FilesystemsTrashcanFull   = 1902,
00224 
00225     IconNuvola22x22ActionsHelp               = 3000,
00226     IconNuvola22x22ActionsMessageBoxInfo     = 3001,
00227     IconNuvola22x22ActionsMisc               = 3002,
00228     IconNuvola22x22ActionsWizard             = 3003,
00229     IconNuvola22x22AppsDesigner              = 3300,
00230     IconNuvola22x22DevicesCamera             = 3600,
00231     IconNuvola22x22FilesystemsFolderBlue     = 3900,
00232 
00233     IconNuvola48x48ActionsMessageBoxCritical = 5001,
00234     IconNuvola48x48ActionsMessageBoxInfo     = 5002,
00235     IconNuvola48x48ActionsMessageBoxWarning  = 5003,
00236     IconNuvola48x48ActionsHistory            = 5000,
00237     IconNuvola48x48AppsDownloadManager       = 5300,
00238     IconNuvola48x48DevicesMouse              = 5600,
00239     IconNuvola48x48FilesystemsFolderBlue     = 5900,
00240 
00241     IconCrystalProject16x16Actions14LayerDeletelayer = 10000,
00242     IconCrystalProject16x16Actions14LayerNovisible   = 10001,
00243     IconCrystalProject16x16Actions14LayerVisible     = 10002,
00244     IconCrystalProject16x16ActionsJabberOnline       = 10003,
00245     IconCrystalProject16x16ActionsRotate             = 10004,
00246     IconCrystalProject16x16AppsCookie                = 10300,
00247 
00248     IconSilkAccept                = 20044,
00249     IconSilkAdd                   = 20045,
00250     IconSilkApplicationXpTerminal = 20000,
00251     IconSilkArrowRefresh          = 20001,
00252     IconSilkAttach                = 20002,
00253     IconSilkBinClosed             = 20003,
00254     IconSilkBug                   = 20004,
00255     IconSilkBulletToggleMinus     = 20056,
00256     IconSilkBulletTogglePlus      = 20057, //
00257     IconSilkCamera                = 20005,
00258     IconSilkCancel                = 20046,
00259     IconSilkChartCurve            = 20006,
00260     IconSilkChartLine             = 20007,
00261     IconSilkChartOrganisation     = 20008,
00262     IconSilkChartPie              = 20009,
00263     IconSilkClock                 = 20010,
00264     IconSilkCog                   = 20011,
00265     IconSilkColorSwatch           = 20012,
00266     IconSilkColorWheel            = 20013,
00267     IconSilkCompress              = 20014,
00268     IconSilkCross                 = 20047,
00269     IconSilkCut                   = 20048,
00270     IconSilkDate                  = 20015,
00271     IconSilkDelete                = 20049,
00272     IconSilkDisk                  = 20016,
00273     IconSilkDoorIn                = 20017,
00274     IconSilkDoorOut               = 20018,
00275     IconSilkEmail                 = 20019,
00276     IconSilkExclamation           = 20020,
00277     IconSilkEye                   = 20021,
00278     IconSilkFilm                  = 20022,
00279     IconSilkHelp                  = 20023,
00280     IconSilkHourglass             = 20024,
00281     IconSilkInformation           = 20025,
00282     IconSilkKey                   = 20026,
00283     IconSilkLink                  = 20027,
00284     IconSilkLock                  = 20028,
00285     IconSilkMagnifier             = 20029,
00286     IconSilkPaintCan              = 20031,
00287     IconSilkPaintbrush            = 20030,
00288     IconSilkPastePlain            = 20050,
00289     IconSilkPill                  = 20032,
00290     IconSilkPlugin                = 20033,
00291     IconSilkStar                  = 20034,
00292     IconSilkStop                  = 20035,
00293     IconSilkTelephone             = 20051,
00294     IconSilkTextAllCaps           = 20052,
00295     IconSilkTextBold              = 20053,
00296     IconSilkTextItalic            = 20054,
00297     IconSilkTextUnderline         = 20055,
00298     IconSilkThumbDown             = 20036,
00299     IconSilkThumbUp               = 20037,
00300     IconSilkTick                  = 20038,
00301     IconSilkTime                  = 20039,
00302     IconSilkWrench                = 20040,
00303     IconSilkZoom                  = 20041,
00304     IconSilkZoomIn                = 20042,
00305     IconSilkZoomOut               = 20043,
00306 
00307     LastIcon
00308   };
00309   //ETX
00310 
00311   // Description:
00312   // Set the icon image based on a predefined icon.
00313   virtual void SetImage(int predefined_icon_index);
00314 
00315   // Description:
00316   // Set the icon image based on an existing vtkKWIcon.
00317   virtual void SetImage(vtkKWIcon*);
00318 
00319   // Description:
00320   // Set the icon image based on an existing vtkImageData.
00321   // A XZ, YZ slice will be permuted into a XY slice automatically.
00322   virtual void SetImage(vtkImageData*);
00323 
00324   // Description:
00325   // Set the icon image from pixel data, eventually zlib and base64.
00326   // If 'buffer_length' is 0, compute it automatically by multiplying
00327   // 'pixel_size', 'width' and 'height' together.
00328   // If ImageOptionFlipVertical is set in 'option', flip the image vertically
00329   //BTX
00330   enum 
00331   { 
00332     ImageOptionFlipVertical = 1
00333   };
00334   //ETX
00335   void SetImage(const unsigned char* data, 
00336                 int width, int height, 
00337                 int pixel_size, 
00338                 unsigned long buffer_length = 0,
00339                 int options = 0);
00340 
00341   // Description:
00342   // Set the icon image to a color transfer function gradient, or a 2-colors
00343   // gradients, or a single color. Borders can be added automatically.
00344   // Return 1 on success, 0 otherwise
00345   //BTX
00346   enum 
00347   { 
00348     ImageOptionDrawBorder = 1,
00349     ImageOptionDrawDoubleBorder = 2,
00350     ImageOptionDrawVertically = 4
00351   };
00352   //ETX
00353   virtual int SetImageToGradient(vtkColorTransferFunction *ctf, 
00354                                   int width, int height,
00355                                   int options = 0);
00356   virtual int SetImageToRGBGradient(double r1, double g1, double b1, 
00357                                      double r2, double g2, double b2, 
00358                                      int width, int height,
00359                                      int options = 0);
00360   virtual int SetImageToSolidRGBColor(double r, double g, double b, 
00361                                        int width, int height,
00362                                        int options = 0);
00363 
00364   // Description:
00365   // Get the raw image data.
00366   virtual const unsigned char* GetData();
00367 
00368   // Description:
00369   // Get the width of the image.
00370   vtkGetMacro(Width, int);
00371 
00372   // Description:
00373   // Get the height of the image.
00374   vtkGetMacro(Height, int);
00375   
00376   // Description:
00377   // Get the pixel size of the image.
00378   vtkGetMacro(PixelSize, int);
00379 
00380   // Description:
00381   // Fade the icon by a factor.
00382   // If the icon has an alpha channel, this multiplies each element in
00383   // the alpha channel by 'factor'.
00384   virtual void Fade(double factor);
00385 
00386   // Description:
00387   // Change the hue to a new hue.
00388   virtual void SetHue(double hue);
00389 
00390   // Description:
00391   // Flatten the image against a color.
00392   // If the icon has an alpha channel, this blends the image against
00393   // a 'r', 'g', 'b' background and discards the alpha channel.
00394   virtual void Flatten(double r, double g, double b);
00395   virtual void Flatten(double rgb[3])
00396     { this->Flatten(rgb[0], rgb[1], rgb[2]); };
00397 
00398   // Description:
00399   // Compose an icon on top of this instance.
00400   // Supports only same size RGBA against same size RGBA at the moment.
00401   // Return 1 on success, 0 otherwise
00402   virtual int Compose(vtkKWIcon *icon);
00403   virtual int Compose(int icon_index);
00404 
00405   // Description:
00406   // Trip the top or right portion of an icon (i.e. look for any fully 
00407   // transparent area and shift the icon to the top or right).
00408   // Supports only RGBA at the moment.
00409   // Return 1 on success, 0 otherwise
00410   virtual int TrimTop();
00411   virtual int TrimRight();
00412 
00413   // Description:
00414   // Resize the canvas. The new canvas can be made larger, or smaller
00415   // (thus cropping the current image). The position indicates where the
00416   // original image should be placed in the new canvas.
00417   // Supports pixel size 3 or 4, will create an output with pixel size = 4.
00418   // Return 1 on success, 0 otherwise
00419   //BTX
00420   enum 
00421   { 
00422     PositionInCanvasCenter    = 0,
00423     PositionInCanvasNorthWest = 9,
00424     PositionInCanvasNorth     = 1,
00425     PositionInCanvasNorthEast = 3,
00426     PositionInCanvasEast      = 2,
00427     PositionInCanvasSouthEast = 6,
00428     PositionInCanvasSouth     = 4,
00429     PositionInCanvasSouthWest = 12,
00430     PositionInCanvasWest      = 8
00431   };
00432   //ETX
00433   virtual int ResizeCanvas(
00434     int resized_width, int resized_height, int position);
00435 
00436   // Description:
00437   // Resample the icon to a new size.
00438   // If the new 'width' is 0, it will be computed from the new 'height' by
00439   // keeping the aspect ratio of the icon (and vice-versa if height is 0).
00440   // Return 1 on success, 0 otherwise
00441   virtual int ResampleCanvas(int resampled_width, int resampled_height);
00442 
00443   // Description:
00444   // Fit (and resample) the icon to a new size. The aspect ratio of the
00445   // icon is kept so that the new icon is not larger in any dimension than
00446   // the new size.
00447   // Return 1 on success, 0 otherwise
00448   virtual int FitCanvas(int fit_width, int fit_height);
00449 
00450 protected:
00451   vtkKWIcon();
00452   ~vtkKWIcon();
00453 
00454   // Description:
00455   // Set icon to the custom data.
00456   void SetData(const unsigned char* data, 
00457                int width, int height, 
00458                int pixel_size,
00459                int options = 0);
00460 
00461   unsigned char* Data;
00462   int Width;
00463   int Height;
00464   int PixelSize;
00465 
00466 private:
00467   vtkKWIcon(const vtkKWIcon&); // Not implemented
00468   void operator=(const vtkKWIcon&); // Not implemented
00469 };
00470 
00471 #endif
00472 
00473 
00474