Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXDrawable.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                           D r a w a b l e   A r e a                           *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,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: FXDrawable.h,v 1.31 2009/01/06 13:07:23 fox Exp $                        *
00022 ********************************************************************************/
00023 #ifndef FXDRAWABLE_H
00024 #define FXDRAWABLE_H
00025 
00026 #ifndef FXID_H
00027 #include "FXId.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 class FXVisual;
00034 
00035 
00036 /**
00037 * Drawable is an abstract base class for any surface that can be
00038 * drawn upon, such as a FXWindow, or FXImage.
00039 */
00040 class FXAPI FXDrawable : public FXId {
00041   FXDECLARE_ABSTRACT(FXDrawable)
00042   friend class FXDC;
00043   friend class FXDCWindow;
00044   friend class FXGLContext;
00045 protected:
00046   FXVisual *visual;     // Visual for this window
00047   FXint     width;      // Width
00048   FXint     height;     // Height
00049   FXID      rsc;        // Resource
00050 protected:
00051   FXDrawable();
00052   FXDrawable(FXApp* a,FXint w,FXint h);
00053 private:
00054   FXDrawable(const FXDrawable&);
00055   FXDrawable &operator=(const FXDrawable&);
00056 #ifdef WIN32
00057   virtual FXID GetDC() const { return NULL; }
00058   virtual int ReleaseDC(FXID) const { return 0; }
00059 #endif
00060 public:
00061 
00062   /// Get the visual
00063   FXVisual* getVisual() const { return visual; }
00064 
00065   /// Width of drawable
00066   FXint getWidth() const { return width; }
00067 
00068   /// Height of drawable
00069   FXint getHeight() const { return height; }
00070 
00071   /// Get resource handle
00072   FXID res() const { return rsc; }
00073 
00074   /// Change visual
00075   void setVisual(FXVisual* vis);
00076 
00077   /// Resize drawable to the specified width and height
00078   virtual void resize(FXint w,FXint h);
00079 
00080   /// Save object to stream
00081   virtual void save(FXStream& store) const;
00082 
00083   /// Load object from stream
00084   virtual void load(FXStream& store);
00085 
00086   /// Cleanup
00087   virtual ~FXDrawable();
00088   };
00089 
00090 }
00091 
00092 #endif

Copyright © 1997-2009 Jeroen van der Zijp