home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mesaaiok.zip / source / AddIn.h < prev    next >
C/C++ Source or Header  |  1995-12-01  |  4KB  |  95 lines

  1.  
  2. // This is the basic AddIn class.  It handles many of the aspects that
  3. // would need to be done on a more global scale such as registering
  4. // handlers and dealing with menus.  To use this, just create an object
  5. // with the constructors argument being the handle passed in the
  6. // AddInInit(void *) function.
  7.  
  8. #ifndef __ADDIN__
  9. #define __ADDIN__
  10.  
  11. class Range;
  12. class Address;
  13.  
  14. class AddIn {
  15.    public:
  16.  
  17.     // this is the connstructor.  Just pass in the handle given
  18.     // in the AddInInit() method.
  19.     // (*)  the model handle is actually the HMODULE for the dll
  20.     //      use this knowledge at your own discretion because it
  21.     //      may change in future versions.
  22.     AddIn(int mh) { mod_handle = mh;};
  23.  
  24.     // gets the handle for the module
  25.     int getHandle() { return mod_handle;};
  26.  
  27.     // These functions are used for dealing with the application level
  28.     // menu.  The getMenu() function just returns the HWND to the application
  29.     // menu.  If you use this, you have to make sure you don't overwrite any
  30.     // menu ID's (or duplicate them) and also add submenus yourself
  31.     HWND getMenu(); // get the HWND to the application window
  32.  
  33.     // This function takes a string arguement and adds the item to
  34.     // the AddIn submenu if it exists.  If it doesn't exist, it
  35.     // creates the submenu.  It also does all the checking to
  36.     // make sure the ID's don't exist, etc...  It returns the
  37.     // ID assigned to the item so you can use it in your command
  38.     // handler. (see registerMenuCallBackFunction(void *pfn))
  39.     int addMenuItem(char * str);   // returns the menu ID for the menu item
  40.  
  41.     // This gets the internal build number of the application.  Check this
  42.     // during init to make sure it supports features you intend to use.
  43.     // Also, versions prior to 116 were VERY broken, if working at all,
  44.     // so you may want to check for this.
  45.     int version();
  46.  
  47.     //returns the HWND of the application window
  48.     HWND getApplicationWindow();
  49.  
  50.     //returns the HWND of the current spreadsheet window
  51.     HWND getActiveWindow();
  52.  
  53.     // these functions are used to register functions
  54.     // that are called when certain actions or events
  55.     // occur.  Look in EXTADDIN.H for the parameter list
  56.     // for each function.
  57.     // (*) Right now, all functions are called with C-Set's
  58.     //      _Optlink linkage so only C-Set can be used to
  59.     //      use these functions.  This may change if/when
  60.     //      we change compilers or if we decide to use
  61.     //      _System linkage.  If that happens, the addin
  62.     //      will break until a re-compile of the addin.
  63.     void registerMenuCallBackFunction(void *pfn);
  64.     void registerPMCallBackFunction(void *pfn);
  65.     void registerDataEnteredFunction(void *pfn);
  66.     void registerAboutToCloseFunction(void * pfn);
  67.     void registerJustOpenedFunction(void * pfn);
  68.     void registerAboutToSaveFunction(void * pfn);
  69.     void registerDoubleClickFunction(void * pfn);
  70.  
  71.     // Returns the current address or range.  It's up to
  72.     // you to check the current model that these belong to.
  73.     Address getCurrentAddress();
  74.     Range getCurrentRange();
  75.  
  76.  
  77.     // This allows you to register a function to be used in the
  78.     // spreadsheet.
  79.     // (*) Right now, adding the stuff to the formula builder
  80.     //     is broken (the formula builder ignores it) so you don't need to
  81.     //     specify it, but you might want to specify it anyway so
  82.     //     if we add support for it, it works without any changes
  83.     //     on your part.
  84.     // (*) Function names always end in a (.  For example the name of
  85.     //     the SIN function is SIN(.  Don't forget the paren when
  86.     //     specifying the name or it wont work.
  87.     void registerFunction(char *func_name,char *fbName,char *fbPrototype, char *fbDescription,
  88.         char *fbExample, int *fbMembers, void * callBack);
  89.  
  90.    private:
  91.     int mod_handle;
  92. };
  93.  
  94. #endif
  95.