home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WOPTIMA.HPP < prev    next >
C/C++ Source or Header  |  1996-09-11  |  6KB  |  183 lines

  1. //
  2. // woptima.hpp -- Private functions.
  3. //
  4.  
  5. #ifndef _WOPTIMA_HPP_INCLUDED
  6. #define _WOPTIMA_HPP_INCLUDED
  7.  
  8. #ifndef _WDEF_HPP_INCLUDED
  9. #include "wdef.hpp"
  10. #endif
  11.  
  12. #ifndef _WTOOLBAR_HPP_INCLUDED
  13. #include "wtoolbar.hpp"
  14. #endif
  15.  
  16. #ifndef _WDIALOG_HPP_INCLUDED
  17. #include "wdialog.hpp"
  18. #endif
  19.  
  20. #ifndef _WPROPSHT_HPP_INCLUDED
  21. #include "wpropsht.hpp"
  22. #endif
  23.  
  24. struct __OptimaRTControl {
  25.     WUInt       size;
  26.     WLong       controlID;
  27.     WRect       r;
  28.     WStyle      style;
  29.     WStyle      ex_style;
  30.     char        text[];
  31. };
  32.  
  33. class WWindow;
  34. class WModule;
  35. class WFont;
  36. class WTransaction;
  37. class WQuery;
  38. class WDataSource;
  39.  
  40. #ifndef _WIN16
  41. #undef GetObject
  42. #if defined( _UNICODE )
  43.     #define GetObject GetObjectW
  44. #else
  45.     #define GetObject GetObjectA
  46. #endif
  47. #endif
  48.  
  49. class WCMCLASS WOptima {
  50.  
  51.     public:
  52.  
  53.         static WBool CreateControl( WWindow * parent,
  54.                                     const WResourceID & parentID,
  55.                                     WWindow * control, long controlID,
  56.                                     WFont * font = NULL,
  57.                                     WModuleHandle module=_ApplicationModule );
  58.  
  59.  
  60.         static void ConnectTransaction( WForm * parent,
  61.                                         WTransaction * trans,
  62.                                         const WChar * name, WBool connect );
  63.  
  64.         static void CreateQuery( WForm * parent, WQuery * query,
  65.                                  const WChar * trans_name,
  66.                                  const WChar * query_name );
  67.  
  68.         static void AutoOpenQuery( WForm * parent, WQuery * query );
  69.  
  70.         static WDataSource *GetDataSource( WForm * parent, const WChar * dsource_name );
  71.  
  72.         static WObject *GetObject( WForm *parent, const WChar * object_name );
  73.  
  74.         static void SetFormIcon( WForm * form, WBool mainForm,
  75.                                  const WResourceID & id,
  76.                                  WModuleHandle module=_ApplicationModule );
  77. };
  78.  
  79. struct WCMCLASS WOptimaStaticToolbarData {
  80.     WEventHandler               clickHandler;
  81.     WEventHandler               doubleClickHandler;
  82. };
  83.  
  84.  
  85. class WCMCLASS WOptimaToolbarData {
  86.     private:
  87.         struct WResourceToolbarItem {
  88.             WToolbarItemStyle           style;
  89.             WInt                        bitmapIndex;
  90.             WInt                        stringIndex;
  91.             WBool                       enabled;
  92.             WBool                       checked;
  93.             WBool                       pressed;
  94.             WBool                       indeterminate;
  95.             WBool                       hidden;
  96.             WBool                       lineBreak;
  97.             WBool                       inToolbar;
  98.             WInt                        textLength;
  99.             WInt                        toolTipTextLength;
  100.         };
  101.  
  102.         struct WResourceCustomImage {
  103.             WInt                resourceID;
  104.             WInt                numBitmaps;
  105.             WInt                isIcon;
  106.         };
  107.  
  108.         struct WResourceToolbar {
  109.             WBool                               usesStandardBitmaps;
  110.             WBool                               usesViewBitmaps;
  111.             WBool                               usesLargeBitmaps;
  112.             WInt                                bitmapSizeWidth;
  113.             WInt                                bitmapSizeHeight;
  114.             WInt                                buttonSizeWidth;
  115.             WInt                                buttonSizeHeight;
  116.             WInt                                numItems;
  117.             WToolbarItemInfoArray *             items;
  118.             WInt                                numCustomImages;
  119.             const WResourceCustomImage *        images;
  120.         };
  121.     public:
  122.         WOptimaToolbarData( WOptimaStaticToolbarData s[], int size );
  123.         ~WOptimaToolbarData();
  124.         WBool BuildToolbar( WToolbar * toolbar,
  125.                 const WResourceID & id,
  126.                 WModuleHandle module=_ApplicationModule );
  127.         WBool DispatchToolbarEvent( WToolbar * toolbar,
  128.                 WObject * handlerOwner,
  129.                 WEventID eventID,
  130.                 WToolbarEventData * event );
  131.     protected:
  132.         WBool BuildToolbar( WToolbar * toolbar,
  133.                 WResourceToolbar & toolbarResource,
  134.                 WModuleHandle moduleHandle );
  135.     private:
  136.         WOptimaStaticToolbarData *      sTable;
  137.         WBitmap **              images;
  138.         WInt                    imagesSize;
  139.         WInt                    size;
  140. };
  141.  
  142. typedef WPropertySheetItem * WCMDEF (*WOptimaMakePSI)();
  143.  
  144. struct WCMCLASS WOptimaStaticPropertySheetData {
  145.     WOptimaMakePSI      maker;
  146.     const WChar *       resourceID;
  147.     const WChar *       text;
  148. };
  149.  
  150. class WCMCLASS WOptimaPropertySheetData {
  151.     public:
  152.         WOptimaPropertySheetData( WOptimaStaticPropertySheetData s[],
  153.                 WInt size );
  154.         ~WOptimaPropertySheetData();
  155.         virtual WBool           BuildPropertySheet( WPropertySheet *,
  156.                                         WBool hasHelp );
  157.         WPropertySheetItem *    FindPropertySheetItem( const WChar * ) const;
  158.     private:
  159.         WPropertySheetInfo *            _propertySheets;
  160.         WOptimaStaticPropertySheetData *_staticData;
  161.         WInt                            _numPropertySheets;
  162. };
  163.  
  164. extern class WOptimaCreateGlobal * TheFirstWOptimaCreateGlobal;
  165.  
  166. class WCMCLASS WOptimaCreateGlobal {
  167.     public:
  168.         WOptimaCreateGlobal( WObject * (*create)( WBool ),
  169.                             void (*destroy)( WObject * ),
  170.                             WOptimaCreateGlobal ** first );
  171.  
  172.         static void CreateGlobals( WOptimaCreateGlobal ** first );
  173.         static void DestroyGlobals( WOptimaCreateGlobal ** first );
  174.  
  175.     private:
  176.         WObject *       (*_createFN)( WBool doCreate );
  177.         void            (*_destroyFN)( WObject * item );
  178.  
  179.         WOptimaCreateGlobal *           _next;
  180. };
  181.  
  182. #endif
  183.