home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / dreamscape / source / Dreamscape / Headers / low-level / h / tboxobj < prev    next >
Encoding:
Text File  |  1996-07-17  |  1.8 KB  |  69 lines

  1.  
  2. // low-level.h.tboxobj
  3.  
  4. // Dreamscape - C++ class library for RISC OS
  5. // Copyright (c) 1996 Mark Seaborn <mseaborn@argonet.co.uk>
  6. //
  7. // This library is free software; you can redistribute it and/or
  8. // modify it under the terms of the GNU Library General Public
  9. // License as published by the Free Software Foundation; either
  10. // version 2 of the License, or (at your option) any later version.
  11. // See the Dreamscape documentation for more information.
  12.  
  13. #ifndef dreamscape_tboxobj_H
  14. #define dreamscape_tboxobj_H
  15.  
  16. #include "coords.h"
  17. #include "tboxevent.h"
  18.  
  19. typedef struct toolbox_o_ *toolbox_o;
  20. typedef unsigned toolbox_show_flags;
  21. typedef int toolbox_c;
  22. union toolbox_position;
  23.  
  24. class ToolboxObject {
  25.   static class Initialise {
  26.   public:
  27.     Initialise();
  28.   } init;
  29.   friend Initialise;
  30.  
  31.   static struct AutoCreated {
  32.     toolbox_o id;
  33.     void *handle;
  34.     void (*deleter)(void *handle);
  35.     AutoCreated *next;
  36.   } *auto_created;
  37.  
  38.   static struct Type {
  39.     unsigned id;
  40.     void *(*create)(toolbox_o object);
  41.     Type *next;
  42.   } *types;
  43.  
  44.   static void object_deleted(const toolbox_action *event,
  45.         const toolbox_block *ids);
  46.  
  47.   toolbox_o id;
  48. public:
  49.   ToolboxObject(toolbox_o object, void *handle,
  50.     void (*deleter)(void *object) = 0);
  51.   ToolboxObject(const char *name, void *handle);
  52.   virtual ~ToolboxObject();
  53.  
  54.   static void *get_object(toolbox_o object);
  55.   static void register_type(unsigned id, void *(*create)(toolbox_o object));
  56.  
  57.   operator toolbox_o() const { return id; }
  58.  
  59.   void show(toolbox_show_flags flags, ToolboxObject *parent = 0,
  60.     toolbox_c component = -1);
  61.   void show_topleft(toolbox_show_flags flags, const ScrCoords &pos,
  62.     ToolboxObject *parent = 0, toolbox_c component = -1);
  63.   void show_full(toolbox_show_flags flags, const toolbox_position *pos,
  64.     ToolboxObject *parent = 0, toolbox_c component = -1);
  65.   void hide();
  66. };
  67.  
  68. #endif
  69.