1 /********************************************************************************
2 *                                                                               *
3 *                       B i t m a p   F r a m e   W i d g e t                   *
4 *                                                                               *
5 *********************************************************************************
6 * Copyright (C) 2001,2005 by H. J. Daniel III. All Rights Reserved.             *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or                 *
9 * modify it under the terms of the GNU Lesser General Public                    *
10 * License as published by the Free Software Foundation; either                  *
11 * version 2.1 of the License, or (at your option) any later version.            *
12 *                                                                               *
13 * This library is distributed in the hope that it will be useful,               *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
16 * Lesser General Public License for more details.                               *
17 *                                                                               *
18 * You should have received a copy of the GNU Lesser General Public              *
19 * License along with this library; if not, write to the Free Software           *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
21 *********************************************************************************
22 * $Id: FXBitmapFrame.h,v 1.5 2005/01/16 16:06:06 fox Exp $                      *
23 ********************************************************************************/
24 #ifndef FXBITMAPFRAME_H
25 #define FXBITMAPFRAME_H
26 
27 #ifndef FXFRAME_H
28 #include "FXFrame.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /**
35 * The bitmap frame is a simple frame widget displaying an monochrome bitmap
36 * image; the bitmap is not owned by the bitmap frame so it must be explicitly
37 * deleted elsewhere.
38 */
39 class FXAPI FXBitmapFrame : public FXFrame {
40   FXDECLARE(FXBitmapFrame)
41 protected:
42   FXBitmap *bitmap;     // The bitmap being displayed
43   FXColor   onColor;    // Color for on pixels
44   FXColor   offColor;   // Color for off pixels
45 protected:
46   FXBitmapFrame();
47 private:
48   FXBitmapFrame(const FXBitmapFrame&);
49   FXBitmapFrame &operator=(const FXBitmapFrame&);
50 public:
51   long onPaint(FXObject*,FXSelector,void* ptr);
52 public:
53 
54   /// Construct image frame and pass it an image
55   FXBitmapFrame(FXComposite* p,FXBitmap *bmp,FXuint opts=FRAME_SUNKEN|FRAME_THICK,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=0,FXint pr=0,FXint pt=0,FXint pb=0);
56 
57   /// Create window
58   virtual void create();
59 
60   /// Get default width
61   virtual FXint getDefaultWidth();
62 
63   /// Get default height
64   virtual FXint getDefaultHeight();
65 
66   /// Change the image being displayed
67   void setBitmap(FXBitmap* bmp);
68 
69   /// Return the current image
getBitmap()70   FXBitmap* getBitmap() const { return bitmap; }
71 
72   /// Set on color
73   void setOnColor(FXColor clr);
74 
75   /// Get on color
getOnColor()76   FXColor getOnColor() const { return onColor; }
77 
78   /// Set off color
79   void setOffColor(FXColor clr);
80 
81   /// Get off color
getOffColor()82   FXColor getOffColor() const { return offColor; }
83 
84   /// Set the current justification mode.
85   void setJustify(FXuint mode);
86 
87   /// Get the current justification mode.
88   FXuint getJustify() const;
89 
90   /// Save to stream
91   virtual void save(FXStream& store) const;
92 
93   /// Load from stream
94   virtual void load(FXStream& store);
95 
96   /// Destroy the widget, but do not destroy the image
97   virtual ~FXBitmapFrame();
98   };
99 
100 }
101 
102 
103 #endif
104