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

button.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                   button.h  -  A clickable button with two states
00003                              -------------------
00004     begin                : Tue Jan 7 2003
00005     copyright            : (C) 2003 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, NeoWTK, button.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2002
00023  Reality Rift Studios. All Rights Reserved.
00024 
00025  ***************************************************************************/
00026 
00027 #ifndef __NEOWTKBUTTON_H
00028 #define __NEOWTKBUTTON_H
00029 
00030 
00031 #include "base.h"
00032 #include "object.h"
00033 
00034 #ifdef HAVE_NEOCHUNKIO
00035 #  include <neochunkio/complex.h>
00036 #  include "chunktype.h"
00037 #endif
00038 
00039 
00046 namespace NeoWTK
00047 {
00048 
00049 
00050 // External classes
00051 class BorderArea;
00052 
00053 
00054 // Forward declarations
00055 class ButtonChunk;
00056 
00057 
00063 class NEOWTK_API Button : public Object
00064 {
00065 #ifdef HAVE_NEOCHUNKIO
00066     friend class ButtonChunk;
00067 #endif
00068 
00069     public:
00070 
00075         enum STATE
00076         {
00078           UP                                          = 0,
00079 
00081           DOWN                                        = 1
00082         };
00083 
00084 
00085     protected:
00086 
00088         BorderArea                                   *m_pkState[2];
00089 
00091         STATE                                         m_eState;
00092 
00093 
00094     public:
00095 
00101                                                       Button( Object *pkParent, Button *pkObject = 0, bool bCreateAreas = true );
00102 
00105         virtual                                      ~Button();
00106 
00112         virtual const Coord                          &SetSize( const Coord &rkSize );
00113 
00120         virtual bool                                  Render( NeoEngine::Frustum *pkFrustum = 0, bool bForce = false );
00121 
00125         virtual BorderArea                           *GetStateObject( STATE eState );
00126 
00132         virtual unsigned int                          ProcessMsg( Msg *pkMsg );
00133 
00140         virtual Object                               *Duplicate( Object *pkParent = 0, Object *pkObject = 0 );
00141 };
00142 
00143 
00144 #ifdef HAVE_NEOCHUNKIO
00145 
00146 
00152 class NEOWTK_API ButtonChunk : public ObjectChunk
00153 {
00154     public:
00155 
00162                                                       ButtonChunk( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID = "" ) : ObjectChunk( usType, rstrType, rstrID ) {}
00163 
00167         virtual                                      ~ButtonChunk() {}
00168 
00175         virtual int                                   ParseData( unsigned int uiFlags, NeoEngine::FileManager *pkFileManager );
00176 
00184         static NeoChunkIO::Chunk                     *Allocator( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID ) { return new ButtonChunk( usType, rstrType, rstrID ); }
00185 };
00186 
00187 
00188 #endif 
00191 }; 
00194 #endif

Generated on Wed Jan 21 14:21:20 2004 for NeoWTK by doxygen 1.3.5