home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WPICTBOX.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  5KB  |  176 lines

  1. /*************************************************************************
  2.  *
  3.  * WPictureBox -- Wrapper for the Windows 95 Static PictureBox control.
  4.  *
  5.  *   Events:
  6.  *
  7.  *       DataAvailable --
  8.  *
  9.  *       DataClose --
  10.  *
  11.  *       DataOpen --
  12.  *
  13.  *       DataRequest --
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WPICTBOX_HPP_INCLUDED
  18. #define _WPICTBOX_HPP_INCLUDED
  19.  
  20. #ifndef _WNO_PRAGMA_PUSH
  21. #pragma pack(push,8);
  22. #pragma enum int;
  23. #endif
  24.  
  25. #ifndef _WSTATIC_HPP_INCLUDED
  26. #  include "wstatic.hpp"
  27. #endif
  28. #ifndef _WBITMAP_HPP_INCLUDED
  29. #  include "wbitmap.hpp"
  30. #endif
  31. #ifndef _WICON_HPP_INCLUDED
  32. #  include "wicon.hpp"
  33. #endif
  34. #ifndef _WMETAFIL_HPP_INCLUDED
  35. #  include "wmetafil.hpp"
  36. #endif
  37. #ifndef _WCURSOR_HPP_INCLUDED
  38. #  include "wcursor.hpp"
  39. #endif
  40. #ifndef _WDRAWITM_HPP_INCLUDED
  41. #  include "wdrawitm.hpp"
  42. #endif
  43. #ifndef _WDATATRG_HPP_INCLUDED
  44. #  include "wdatatrg.hpp"
  45. #endif
  46.  
  47. class WDataSource;
  48.  
  49. //
  50. // PictureBox styles
  51. //
  52.  
  53. #define WPBSDefault             ((WStyle)0x50000103L) // WS_VISIBLE|WS_CHILD|SS_NOTIFY|SS_ICON
  54.  
  55. class WCMCLASS WPictureBox : public WStatic {
  56.     WDeclareSubclass( WPictureBox, WStatic );
  57.  
  58.     public:
  59.     
  60.         /***************************************************************
  61.          * Constructors and Destructors
  62.          ***************************************************************/
  63.  
  64.         WPictureBox();
  65.     
  66.         ~WPictureBox();
  67.  
  68.         /***************************************************************
  69.          * Properties
  70.          ***************************************************************/
  71.  
  72.         // AutoSize
  73.  
  74.         virtual WBool SetAutoSize( WBool on );
  75.         virtual WBool GetAutoSize() const;
  76.  
  77.         // Bitmap -- The bitmap associated with the picture box. 
  78.  
  79.         WBool SetBitmap( const WBitmap & bitmap );
  80.         WBitmap GetBitmap() const;
  81.  
  82.         // Cursor -- The cursor associated with the picture box.
  83.  
  84.         WBool SetCursor( const WCursor & cursor );
  85.         WCursor GetCursor() const;
  86.  
  87.         // DataColumns
  88.  
  89.         WString GetDataColumns() const;
  90.         WBool   SetDataColumns( const WString & cols );
  91.  
  92.         // DataSource
  93.  
  94.         WDataSource *GetDataSource() const;
  95.         WBool        SetDataSource( WDataSource *source );
  96.  
  97.         // Icon -- The icon associated with the picture box.
  98.  
  99.         WBool SetIcon( const WIcon & icon );
  100.         WIcon GetIcon() const;
  101.  
  102.         // Metafile -- The metafile associated with the picture box.
  103.  
  104.         WBool SetMetafile( const WMetafile & metafile );
  105.         WMetafile GetMetafile() const;
  106.  
  107.         /***************************************************************
  108.          * Methods
  109.          ***************************************************************/
  110.  
  111.         // AutoSize
  112.         //
  113.         //      Invoked when autosizing needs to be done
  114.  
  115.         virtual WBool AutoSize();
  116.  
  117.         /***************************************************************
  118.          * Overrides
  119.          ***************************************************************/
  120.  
  121.         virtual WBool SetStyle( WStyle style, WBool clone );
  122.         virtual WBool SetStyle( WStyle style );
  123.  
  124.         virtual WStyle GetDefaultStyle() const;
  125.         virtual WStyle GetDefaultExtendedStyle() const;
  126.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  127.                                    void * data=NULL );
  128.         virtual WBool LoadWindow( WWindow * parent,
  129.                                   const WResourceID & id,
  130.                                   WModuleHandle module=_ApplicationModule );
  131.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  132.                                   const WChar *className,
  133.                                   const WChar *title, const WRect & r,
  134.                                   WStyle wstyle, WStyle exStyle,
  135.                                   void * data=NULL );
  136.  
  137.         /***************************************************************
  138.          * Event Handlers
  139.          ***************************************************************/
  140.  
  141.         WBool PaintEventHandler( WPictureBox * pictureBox,
  142.                                  WPaintEventData * event );
  143.         WBool QueryNewPaletteEventHandler( WPictureBox * pictureBox,
  144.                                            WEventData * event );
  145.         WBool DataOpenHandler( WPictureBox *, WDataOpenEventData *ev );
  146.         WBool DataCloseHandler( WPictureBox *, WDataCloseEventData *ev );
  147.         WBool DataAvailableHandler( WPictureBox *, WDataAvailableEventData *ev );
  148.         WBool DataRequestHandler( WPictureBox *, WDataRequestEventData *ev );
  149.  
  150.     protected:
  151.  
  152.         WBool AllocDTCell();
  153.  
  154.         /***************************************************************
  155.          * Data members
  156.          ***************************************************************/
  157.  
  158.     private:
  159.  
  160.         WIcon           _icon;
  161.         WBitmap         _bitmap;
  162.         WCursor         _cursor;
  163.         WMetafile *     _metafile;
  164.         WInt            _current;
  165.         WDataTargetCell *_dataTarget;
  166.         WBool           _autoSize;
  167.         WBool           _ignoreChange;
  168. };
  169.  
  170. #ifndef _WNO_PRAGMA_PUSH
  171. #pragma enum pop;
  172. #pragma pack(pop);
  173. #endif
  174.  
  175. #endif // _WPICTBOX_HPP_INCLUDED
  176.