home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WOPTIMA.HPP < prev    next >
C/C++ Source or Header  |  1997-01-25  |  5KB  |  162 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 WOptimaToolbarEventList {
  80.     WEventID            event;
  81.     WEventHandler       handler;
  82.     WToolbarItemHandle  item;
  83. };
  84.  
  85. class WCMCLASS WOptimaToolbarData : public WObject {
  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( WOptimaToolbarEventList events[], WObject * object, WToolbar * tb  );
  123.         ~WOptimaToolbarData();
  124.         WBool BuildToolbar( const WResourceID & id,
  125.                 WModuleHandle module=_ApplicationModule );
  126.  
  127.         WToolbarItemHandle GetHandle( WUInt index );
  128.  
  129.     protected:
  130.         WBool BuildToolbar( WResourceToolbar & toolbarResource,
  131.                 WModuleHandle moduleHandle );
  132.         WBool ToolbarEventHandler( WObject *, WToolbarEventData * event );
  133.  
  134.     private:
  135.         WObject *                       _object;
  136.         WOptimaToolbarEventList *       _events;
  137.         WToolbar *                      _toolbar;
  138.  
  139.         WBitmap **                      _images;
  140.         WInt                            _imagesSize;
  141.         WToolbarItemInfoArray           _items;
  142. };
  143.  
  144. extern class WOptimaCreateGlobal * TheFirstWOptimaCreateGlobal;
  145.  
  146. class WCMCLASS WOptimaCreateGlobal {
  147.     public:
  148.         WOptimaCreateGlobal( WObject * (*create)( WBool ),
  149.                             void (*destroy)( WObject * ),
  150.                             WOptimaCreateGlobal ** first );
  151.  
  152.         static void CreateGlobals( WOptimaCreateGlobal ** first );
  153.         static void DestroyGlobals( WOptimaCreateGlobal ** first );
  154.  
  155.     private:
  156.         WObject *       (*_createFN)( WBool doCreate );
  157.         void            (*_destroyFN)( WObject * item );
  158.  
  159.         WOptimaCreateGlobal *           _next;
  160. };
  161. #endif
  162.