home *** CD-ROM | disk | FTP | other *** search
- // **************************************************************************
- // Copyright 1996 David Allison
- //
- // VV VV IIIIII SSSSS TTTTTT AA
- // VV VV II SS TT AA AA
- // VV VV II SSSS TT AA AA
- // VV VV II SS TT AAAAAAAA
- // VV IIIIII SSSS TT AA AA
- //
- // MULTI-THREADED C++ WIMP CLASS LIBRARY
- // for RISC OS
- // **************************************************************************
- //
- // P U B L I C D O M A I N L I C E N C E
- // -------------------------------------------
- //
- // This library is copyright. You may not sell the library for
- // profit, but you may sell products which use it providing
- // those products are presented as executable code and are not
- // libraries themselves. The library is supplied without any
- // warranty and the copyright owner cannot be held responsible for
- // damage resulting from failure of any part of this library.
- //
- // See the User Manual for details of the licence.
- //
- // *************************************************************************
-
-
- //
- // Example of a SaveBox
- //
-
- #ifndef __saveex_h
- #define __saveex_h
-
- #include "Vista:vista.h"
- #include <stdio.h>
-
- class MainWindow ; // declaration
-
- //
- // This class saves things in the MainWindow. it is a DataSave protocol class
- // and is therefore a Channel. It receives messages from the wimp appropriate
- // to the Channel
- //
-
-
- class Saver: public DataSave
- {
- public:
- Saver(Task *task, MainWindow *window) ; // constructor
- ~Saver() ; // destructor
- void receive (int action, int task, int my_ref, int your_ref, int data_length, void *data) ; // receive a message
- void save(int window, int icon, int x, int y, char *leaf) ; // save to a window and icon
- void save (char *path) ; // save given the whole path
- char *path() { return previous_path ; } // access func for path
- private:
- MainWindow *window ; // the window to save
- char previous_path[256] ; // previous path saved to
- } ;
-
-
-
- //
- // The MainWindow class. This class is the window opened by clicking on the
- // icon bar icon. It has a menu with only one item (Save). The class
- // simply displays a piece of text in an outline font.
- //
-
-
- class MainWindow : public Window
- {
- public:
- MainWindow (Task *t) ; // constructor
- ~MainWindow() ; // destructor
- void menu(MenuItem items[]) ; // menu click function
- void save(FILE *fp) ; // save function
- private:
- enum menu_items
- {
- SAVE
- } ;
- int font_handle ; // handle for outline font
- FontObject *text ; // The object displaying the text
- Saver *saver ; // saver for this window
- } ;
-
-
- //
- // This class is the task itself. The icon bar has a menu with 2 items. The task responds
- // to clicks on the icon bar (click() function) and menu hits (menu() function). Private
- // data includes the main window object.
- //
-
-
- class SaveEx : public Task
- {
- enum menu_items
- {
- INFO, // program info
- QUIT // quit application
- } ;
- public:
- SaveEx() ;
- void click(int x, int y, int button, int icon) ; // I want iconbar clicks
- void menu (MenuItem items[]) ; // iconbar menu hit
- private:
- Window *mainwin ; // the main window
- } ;
-
- #endif
-