home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / v / vista / Examples / !Dbox / h / dbox
Encoding:
Text File  |  1996-01-25  |  3.7 KB  |  138 lines

  1. // **************************************************************************
  2. //                     Copyright 1996 David Allison
  3. //
  4. //             VV    VV    IIIIII     SSSSS     TTTTTT       AA
  5. //             VV    VV      II      SS           TT       AA  AA
  6. //             VV    VV      II        SSSS       TT      AA    AA
  7. //              VV  VV       II           SS      TT      AAAAAAAA
  8. //                VV       IIIIII     SSSS        TT      AA    AA
  9. //
  10. //                    MULTI-THREADED C++ WIMP CLASS LIBRARY
  11. //                                for RISC OS
  12. // **************************************************************************
  13. //
  14. //             P U B L I C    D O M A I N    L I C E N C E
  15. //             -------------------------------------------
  16. //
  17. //     This library is copyright. You may not sell the library for
  18. //     profit, but you may sell products which use it providing
  19. //     those products are presented as executable code and are not
  20. //     libraries themselves.  The library is supplied without any
  21. //     warranty and the copyright owner cannot be held responsible for
  22. //     damage resulting from failure of any part of this library.
  23. //
  24. //          See the User Manual for details of the licence.
  25. //
  26. // *************************************************************************
  27.  
  28.  
  29. //
  30. // Example of a Dialogue Box
  31. //
  32.  
  33. #ifndef __dbox_h
  34. #define __dbox_h
  35.  
  36. #include "Vista:vista.h"
  37. #include <stdio.h>
  38.  
  39. class MainWindow ;             // declaration
  40.  
  41.  
  42. class ExampleBox : public DialogueBox
  43.    {
  44.    friend class MainWindow ;
  45.    enum icon_numbers              // the numbers for the icons
  46.       {
  47.       PORT_NONE = 2,
  48.       PORT_SERIAL = 5,
  49.       PORT_PARALLEL = 3,
  50.       PORT_NET = 4,
  51.       VOICE_DISPLAY = 6,
  52.       VOICE_MENU = 7,
  53.       VOLUME_DOWN = 14,
  54.       VOLUME_UP = 13,
  55.       VOLUME_BACKGROUND = 10,
  56.       VOLUME_VALUE = 12,
  57.       FONTCACHE_UP = 18,
  58.       FONTCACHE_DOWN = 16,
  59.       FONTCACHE_VALUE = 17,
  60.       HSCROLL = 20,
  61.       VSCROLL = 21,
  62.       SCREENMODE = 23,
  63.       OK = 27,
  64.       CANCEL = 24
  65.       } ;
  66.    public:
  67.       ExampleBox (Task *task) ;
  68.       ~ExampleBox() ;
  69.    private:
  70. //
  71. // These are the attributes
  72. //
  73.       bool ports[4] ;
  74.       char voice[32] ;
  75.       int volume ;
  76.       int font_cache ;
  77.       bool hscroll ;
  78.       bool vscroll ;
  79.       int screen_mode ;
  80.  
  81. //
  82. // some tools for the composite icons
  83. //
  84.  
  85.      Slider *volume_control ;
  86.      Popup *voice_control ;
  87.      Adjuster *font_cache_control ;
  88.  
  89.    } ;
  90.  
  91. //
  92. // The main window class.  Contains a button which, when clicked, displays the
  93. // dialogue box.  It also contains a display field which is used to display
  94. // the values of the attributes when the dialogue box is closed.
  95. //
  96.  
  97.  
  98. class MainWindow : public Window
  99.    {
  100.    enum icon_numbers
  101.       {
  102.       SHOWBOX = 1,
  103.       DISPLAY = 2
  104.       } ;
  105.    public:
  106.       MainWindow (Task *t) ;                 // constructor
  107.       ~MainWindow() ;                        // destructor
  108.       void click(int x, int y, int button, int icon) ;   // I want clicks
  109.  
  110.    private:
  111.       Icon *display ;         // display field
  112.    } ;
  113.  
  114.  
  115. //
  116. // This class is the task itself.  The icon bar has a menu with 2 items.  The task responds
  117. // to clicks on the icon bar (click() function) and menu hits (menu() function).  Private
  118. // data includes the main window object.
  119. //
  120.  
  121.  
  122. class DBox : public Task
  123.    {
  124.    enum menu_items
  125.       {
  126.       INFO,                          // program info
  127.       QUIT                           // quit application
  128.       } ;
  129.    public:
  130.       DBox() ;
  131.       void click(int x, int y, int button, int icon) ;   // I want iconbar clicks
  132.       void menu (MenuItem items[]) ;                     // iconbar menu hit
  133.    private:
  134.       Window *mainwin ;                                  // the main window
  135.    } ;
  136.  
  137. #endif
  138.