home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / v / vista / Examples / !Threads / h / threads
Encoding:
Text File  |  1996-01-27  |  3.1 KB  |  108 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 __threads_h
  34. #define __threads_h
  35.  
  36. #include "Vista:vista.h"
  37. #include <stdio.h>
  38.  
  39.  
  40. class Tracker : public Window, public Thread
  41.    {
  42.    enum icon_numbers
  43.       {
  44.       POSITION = 0,
  45.       TIME = 26,
  46.       SELECT = 3,
  47.       MENU = 4,
  48.       ADJUST = 5,
  49.       SELSTAT = 22,
  50.       MENSTAT = 23,
  51.       ADJSTAT= 24,
  52.       SPEED = 7,
  53.       DIST = 18,
  54.       WINDOW = 10,
  55.       ICON = 12,
  56.       STOP = 8,
  57.       SPEEDOMETER_BACKGROUND = 16,
  58.       SPEEDOMETER_VALUE = 17
  59.       } ;
  60.    public:
  61.       Tracker (Task *t) ;                 // constructor
  62.       ~Tracker() ;                        // destructor
  63.       void run() ;                        // thread run function
  64.       void click(int x, int y, int button, int icon) ;   // I want clicks
  65.  
  66.    private:
  67.       bool running ;
  68.       int prev_x ;
  69.       int prev_y ;
  70.       int prev_time ;
  71.       Icon *coords_display ;
  72.       Icon *select_button ;
  73.       Icon *menu_button ;
  74.       Icon *adjust_button ;
  75.       Icon *select_display ;
  76.       Icon *menu_display ;
  77.       Icon *adjust_display ;
  78.       Icon *speed_display ;
  79.       Icon *dist_display ;
  80.       Icon *window_display ;
  81.       Icon *icon_display ;
  82.       Icon *time_display ;
  83.       Meter *speedometer ;
  84.    } ;
  85.  
  86.  
  87. //
  88. // This class is the task itself.  The icon bar has a menu with 2 items.  The task responds
  89. // to clicks on the icon bar (click() function) and menu hits (menu() function).  Private
  90. // data includes the main window object.
  91. //
  92.  
  93.  
  94. class Threads : public Task
  95.    {
  96.    enum menu_items
  97.       {
  98.       INFO,                          // program info
  99.       QUIT                           // quit application
  100.       } ;
  101.    public:
  102.       Threads() ;
  103.       void click(int x, int y, int button, int icon) ;   // I want iconbar clicks
  104.       void menu (MenuItem items[]) ;                     // iconbar menu hit
  105.    } ;
  106.  
  107. #endif
  108.