1 /********************************************************************************
2 *                                                                               *
3 *                           D r a w a b l e   A r e a                           *
4 *                                                                               *
5 *********************************************************************************
6 * Copyright (C) 1997,2006 by Jeroen van der Zijp.   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: FXDrawable.h 3297 2015-12-14 20:30:04Z arthurcnorman $                        *
23 ********************************************************************************/
24 #ifndef FXDRAWABLE_H
25 #define FXDRAWABLE_H
26 
27 #ifndef FXID_H
28 #include "FXId.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXVisual;
35 
36 
37 /**
38 * Drawable is an abstract base class for any surface that can be
39 * drawn upon, such as a FXWindow, or FXImage.
40 */
41 class FXAPI FXDrawable : public FXId {
42   FXDECLARE_ABSTRACT(FXDrawable)
43   friend class FXDC;
44   friend class FXDCWindow;
45 protected:
46   FXVisual     *visual;                 // Visual for this window
47   FXint         width;                  // Width
48   FXint         height;                 // Height
49 protected:
50   FXDrawable();
51   FXDrawable(FXApp* a,FXint w,FXint h);
52 private:
53   FXDrawable(const FXDrawable&);
54   FXDrawable &operator=(const FXDrawable&);
55 #ifdef WIN32
GetDC()56   virtual FXID GetDC() const { return NULL; }
ReleaseDC(FXID)57   virtual int ReleaseDC(FXID) const { return 0; }
58 #endif
59 public:
60 
61   /// Width of drawable
getWidth()62   FXint getWidth() const { return width; }
63 
64   /// Height of drawable
getHeight()65   FXint getHeight() const { return height; }
66 
67   /// Get the visual
getVisual()68   FXVisual* getVisual() const { return visual; }
69 
70   /// Change visual
71   void setVisual(FXVisual* vis);
72 
73   /// Resize drawable to the specified width and height
74   virtual void resize(FXint w,FXint h);
75 
76   /// Save object to stream
77   virtual void save(FXStream& store) const;
78 
79   /// Load object from stream
80   virtual void load(FXStream& store);
81 
82   /// Cleanup
83   virtual ~FXDrawable();
84   };
85 
86 }
87 
88 #endif
89