![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * B i t m a p V i e w W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2000,2009 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published by * 00010 * the Free Software Foundation; either version 3 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with this program. If not, see <http://www.gnu.org/licenses/> * 00020 ********************************************************************************* 00021 * $Id: FXBitmapView.h,v 1.13 2009/01/06 13:07:22 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FXBITMAPVIEW_H 00024 #define FXBITMAPVIEW_H 00025 00026 #ifndef FXSCROLLAREA_H 00027 #include "FXScrollArea.h" 00028 #endif 00029 00030 namespace FX { 00031 00032 00033 class FXBitmap; 00034 00035 /// Bitmap alignment styles 00036 enum { 00037 BITMAPVIEW_NORMAL = 0, /// Normal mode is centered 00038 BITMAPVIEW_CENTER_X = 0, /// Centered horizontally 00039 BITMAPVIEW_LEFT = 0x00100000, /// Left-aligned 00040 BITMAPVIEW_RIGHT = 0x00200000, /// Right-aligned 00041 BITMAPVIEW_CENTER_Y = 0, /// Centered vertically 00042 BITMAPVIEW_TOP = 0x00400000, /// Top-aligned 00043 BITMAPVIEW_BOTTOM = 0x00800000 /// Bottom-aligned 00044 }; 00045 00046 /** 00047 * The Bitmap View widget display a scrollable view of a monochrome bitmap image; 00048 * the bitmap is not owned by the bitmap frame so it must be explicitly deleted 00049 * elsewhere. Thus, a single bitmap image can be displayed inside multiple bitmap 00050 * view widgets. 00051 */ 00052 class FXAPI FXBitmapView : public FXScrollArea { 00053 FXDECLARE(FXBitmapView) 00054 protected: 00055 FXBitmap *bitmap; // Image to view 00056 FXColor onColor; // Color for on pixels 00057 FXColor offColor; // Color for off pixels 00058 FXint grabx; // Grab point x 00059 FXint graby; // Grab point y 00060 protected: 00061 FXBitmapView(); 00062 private: 00063 FXBitmapView(const FXBitmapView&); 00064 FXBitmapView &operator=(const FXBitmapView&); 00065 public: 00066 long onPaint(FXObject*,FXSelector,void*); 00067 long onMotion(FXObject*,FXSelector,void*); 00068 long onRightBtnPress(FXObject*,FXSelector,void*); 00069 long onRightBtnRelease(FXObject*,FXSelector,void*); 00070 public: 00071 enum { 00072 ID_XYZ=FXScrollArea::ID_LAST, 00073 ID_LAST 00074 }; 00075 public: 00076 00077 /// Construct a scroll window 00078 FXBitmapView(FXComposite* p,FXBitmap* bmp=NULL,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00079 00080 /// Create server-side resources 00081 virtual void create(); 00082 00083 /// Detach server-side resources 00084 virtual void detach(); 00085 00086 /// Perform layout immediately 00087 virtual void layout(); 00088 00089 /// Image view widget can receive focus 00090 virtual FXbool canFocus() const; 00091 00092 /// Return the width of the contents 00093 virtual FXint getContentWidth(); 00094 00095 /// Return the height of the contents 00096 virtual FXint getContentHeight(); 00097 00098 /// Change image 00099 void setBitmap(FXBitmap* bmp); 00100 00101 /// Return image 00102 FXBitmap* getBitmap() const { return bitmap; } 00103 00104 /// Set on color 00105 void setOnColor(FXColor clr); 00106 00107 /// Get on color 00108 FXColor getOnColor() const { return onColor; } 00109 00110 /// Set off color 00111 void setOffColor(FXColor clr); 00112 00113 /// Get off color 00114 FXColor getOffColor() const { return offColor; } 00115 00116 /// Set the current alignment. 00117 void setAlignment(FXuint mode); 00118 00119 /// Get the current alignment. 00120 FXuint getAlignment() const; 00121 00122 /// Save list to a stream 00123 virtual void save(FXStream& store) const; 00124 00125 /// Load list from a stream 00126 virtual void load(FXStream& store); 00127 00128 /// Destroy 00129 virtual ~FXBitmapView(); 00130 }; 00131 00132 } 00133 00134 #endif
![]() |