bitmapgriddropdown.h

Go to the documentation of this file.
00001 // $Id: coldrop.h 1052 2006-05-15 14:19:14Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 // coldrop.h - The Colour Drop-down list support class
00100 
00101 #ifndef BITMAPGRIDDROPDOWN_H
00102 #define BITMAPGRIDDROPDOWN_H
00103 
00104 #include "griddropdown.h"
00105 //#include "gbrush.h"
00106 //#include "pump.h"
00107 
00108 
00109 class LineAttrItem;
00110 class GRenderRegion;
00111 
00112 
00113 /*************************************************************************
00114 Class         : CBGDDItemInfo
00115 Base Class    : public CGridComboUserData
00116 Author        : Mikhail Tatarnikov
00117 Description   : Items base class for for CBitmapGridDropDown control.
00118 Pure Virtual  : DrawItem - the derived classes has to implement their own drawing.
00119 Known Issues  : None
00120 Usage Notes   : None
00121 Override Notes: None
00122 **************************************************************************/
00123 class CBGDDItemInfo : public CGridComboUserData
00124 {
00125 public:
00126     CBGDDItemInfo(String_256 strLabel = String_256());
00127     virtual ~CBGDDItemInfo();
00128 
00129     String_256 GetLabel();
00130 
00131     virtual void DrawItem(wxDC& dc, const wxRect& rect, INT32 iFlags) const = 0;
00132 
00133 protected:
00134     String_256 m_strLabel;
00135 };
00136 
00137 
00138 
00139 /*************************************************************************
00140 Class         : CBGDDWxBitmapItem
00141 Base Class    : public CBGDDItemInfo
00142 Author        : Mikhail Tatarnikov
00143 Description   : Item for displaying a wxBitmap.
00144 Pure Virtual  : None
00145 Known Issues  : None
00146 Usage Notes   : None
00147 Override Notes: None
00148 **************************************************************************/
00149 class CBGDDWxBitmapItem : public CBGDDItemInfo
00150 {
00151 public:
00152     CBGDDWxBitmapItem(wxBitmap* pBitmap, BOOL bAutodelete = TRUE,
00153                       String_256 strLabel = String_256(),
00154                       BOOL       bStretch = TRUE);
00155     virtual ~CBGDDWxBitmapItem();
00156 
00157     virtual void DrawItem(wxDC& dc, const wxRect& rect, INT32 iFlags) const;
00158 
00159 protected:
00160     wxBitmap* m_pBitmap;
00161     BOOL      m_bDelete;
00162     BOOL      m_bStretch;
00163 };
00164 
00165 
00166 
00167 /*************************************************************************
00168 Class         : CBGDDResourceItem
00169 Base Class    : public CBGDDWxBitmapItem
00170 Author        : Mikhail Tatarnikov
00171 Description   : Item for displaying a resource-stored bitmap.
00172 Pure Virtual  : None
00173 Known Issues  : None
00174 Usage Notes   : None
00175 Override Notes: None
00176 **************************************************************************/
00177 class CBGDDResourceItem : public CBGDDWxBitmapItem
00178 {
00179 public:
00180     CBGDDResourceItem(UINT32 uiBitmapResID,
00181                       String_256 strLabel = String_256(),
00182                       BOOL       bStretch = TRUE);
00183     virtual ~CBGDDResourceItem();
00184 };
00185 
00186 
00187 /*************************************************************************
00188 Class         : CBGDDCachedItem
00189 Base Class    : public CBGDDWxBitmapItem
00190 Author        : Mikhail Tatarnikov
00191 Description   : Item for displaying a resource-stored bitmap.
00192 Pure Virtual  : None
00193 Known Issues  : None
00194 Usage Notes   : None
00195 Override Notes: The derived classes should override either RenderItemToBitmap or
00196                 or GetWxBitmap method - whatever fits best.
00197 **************************************************************************/
00198 class CBGDDCachedItem : public CBGDDItemInfo
00199 {
00200 public:
00201     CBGDDCachedItem(String_256 strLabel = String_256());
00202     virtual ~CBGDDCachedItem();
00203 
00204     virtual void DrawItem(wxDC& dc, const wxRect& rect, INT32 iFlags) const;
00205 
00206 protected:
00207     // Get the representation of the item (of the Kernel Bitmap)
00208     virtual wxBitmap* RenderItemToBitmap(wxSize szBitmap) const;
00209     virtual void      RenderItemToGRenderRegion(GRenderRegion* pRenderRegion, DocRect drcItem) const;
00210 
00211 private:
00212     wxBitmap*   GetWxBitmap(wxSize szBitmap) const;
00213     static BOOL DoesCacheItemSizeMatch(const pair<wxSize, wxBitmap*>* poItem, wxSize szBitmap);
00214 
00215 private:
00216     typedef std::vector<pair<wxSize, wxBitmap*>*> TDCacheCollection;
00217     mutable TDCacheCollection m_colCache;
00218 };
00219 
00220 
00221 
00222 /*************************************************************************
00223 Class         : CBGDDKernelBitmapItem
00224 Base Class    : public CBGDDCachedItem
00225 Author        : Mikhail Tatarnikov
00226 Description   : Item for displaying a KernelBitmap.
00227 Pure Virtual  : None
00228 Known Issues  : None
00229 Usage Notes   : None
00230 Override Notes: None
00231 **************************************************************************/
00232 class CBGDDKernelBitmapItem : public CBGDDCachedItem
00233 {
00234 public:
00235     CBGDDKernelBitmapItem(KernelBitmap* pKernelBitmap, BOOL bAutodelete = TRUE,
00236                           String_256 strLabel = String_256(),
00237                           BOOL       bStretch = TRUE);
00238     virtual ~CBGDDKernelBitmapItem();
00239 
00240 protected:
00241     virtual wxBitmap* RenderItemToBitmap(wxSize szBitmap) const;
00242 
00243 protected:
00244     KernelBitmap* m_pKernelBitmap;
00245     BOOL          m_bDeleteKernelBitmap;
00246     BOOL          m_bStretch;
00247 };
00248 
00249 
00250 
00251 
00252 
00253 
00254 /*************************************************************************
00255 Class         : CBGDDStrokeItem
00256 Base Class    : public CBGDDCachedItem
00257 Author        : Mikhail Tatarnikov
00258 Description   : Item for displaying a stroke.
00259 Pure Virtual  : None
00260 Known Issues  : None
00261 Usage Notes   : None
00262 Override Notes: None
00263 **************************************************************************/
00264 class CBGDDStrokeItem : public CBGDDCachedItem
00265 {
00266 public:
00267     CBGDDStrokeItem(LineAttrItem* plaiStroke, BOOL bAutodelete = TRUE, String_256 strLabel = String_256());
00268     virtual ~CBGDDStrokeItem();
00269 
00270 protected:
00271     virtual void RenderItemToGRenderRegion(GRenderRegion* pRenderRegion, DocRect drcItem) const;
00272 
00273 protected:
00274     LineAttrItem* m_plaiStroke;
00275     BOOL          m_bDelete;
00276 };
00277 
00278 
00279 
00280 
00281 
00282 /*************************************************************************
00283 Class         : CBGDDBrushItem
00284 Base Class    : public CBGDDCachedItem
00285 Author        : Mikhail Tatarnikov
00286 Description   : Item for displaying a brush.
00287 Pure Virtual  : None
00288 Known Issues  : None
00289 Usage Notes   : None
00290 Override Notes: None
00291 **************************************************************************/
00292 class CBGDDBrushItem : public CBGDDCachedItem
00293 {
00294 public:
00295     CBGDDBrushItem(AttrBrushType* pabtBrush, BOOL bAutodelete = TRUE, String_256 strLabel = String_256());
00296     virtual ~CBGDDBrushItem();
00297 
00298 protected:
00299     virtual void RenderItemToGRenderRegion(GRenderRegion* pRenderRegion, DocRect drcItem) const;
00300 
00301 protected:
00302     AttrBrushType* m_pabtBrush;
00303     BOOL           m_bDelete;
00304 };
00305 
00306 
00307 
00308 
00309 
00310 
00311 
00312 
00313 
00314 
00315 
00316 
00317 /*************************************************************************
00318 Class         : CBitmapGridDropDown
00319 Base Class    : public CGridDropDown
00320 Author        : Mikhail Tatarnikov
00321 Description   : Control class for wxGridCombo control that stores and displays
00322                 items as images.
00323 Pure Virtual  : None
00324 Known Issues  : None
00325 Usage Notes   : None
00326 Override Notes: None
00327 **************************************************************************/
00328 class CBitmapGridDropDown : public CGridDropDown
00329 {
00330 friend class DialogManager;
00331 
00332 
00333 public:
00334     CBitmapGridDropDown();
00335     virtual ~CBitmapGridDropDown();
00336 
00337     void AddItem(UINT32 uiBitmapResID, String_256 strLabel = String_256(), BOOL bStretch = TRUE);
00338     void AddItem(wxBitmap* pBitmap, BOOL bDelete = TRUE, String_256 strLabel = String_256(), BOOL bStretch = TRUE);
00339     void AddItem(KernelBitmap* pBitmap, BOOL bDelete = TRUE, String_256 strLabel = String_256(), BOOL bStretch = TRUE);
00340     void AddItem(LineAttrItem* plaiStroke, BOOL bDelete = TRUE, String_256 strLabel = String_256());
00341     void AddItem(AttrBrushType* pabtBrush, BOOL bDelete = TRUE, String_256 strLabel = String_256());
00342 
00343     void SetUnselectedItem(UINT32 uiBitmapResID, String_256 strLabel = String_256());
00344     void SetUnselectedItem(wxBitmap* pBitmap, String_256 strLabel = String_256());
00345 
00346     void SelectByLabel(String_256 strLabel);
00347 
00348 protected:
00349     CBGDDItemInfo* GetItemData(INT32 iItem);
00350 
00351     virtual void DrawItemCore(wxDC& dc, const wxRect& rect, INT32 iItem, INT32 iFlags);
00352 
00353     wxBitmap*     PreviewBrush(AttrBrushType* pabtBrush);
00354     KernelBitmap* PreviewStroke(LineAttrItem* plaiStroke);
00355 
00356 protected:
00357     CBGDDItemInfo* m_poUnselectedItem;
00358 };
00359 
00360 
00361 
00362 
00363 
00364 #endif  // BITMAPGRIDDROPDOWN_H
00365 

Generated on Sat Nov 10 03:48:07 2007 for Camelot by  doxygen 1.4.4