home *** CD-ROM | disk | FTP | other *** search
-
- // low-level.h.dataload
-
- // Dreamscape - C++ class library for RISC OS
- // Copyright (c) 1996 Mark Seaborn <mseaborn@argonet.co.uk>
- //
- // This library is free software; you can redistribute it and/or
- // modify it under the terms of the GNU Library General Public
- // License as published by the Free Software Foundation; either
- // version 2 of the License, or (at your option) any later version.
- // See the Dreamscape documentation for more information.
-
- #ifndef dreamscape_dataload_H
- #define dreamscape_dataload_H
-
- #include "bool.h"
-
- #include "loader.h"
- #include "coords.h"
- #include "wimpmsg.h"
-
- class istream;
- typedef struct wimp_t_ *wimp_t;
- typedef struct wimp_w_ *wimp_w;
-
- class DataLoadProtocol {
- static class Initialise {
- public:
- Initialise();
- } init;
- friend Initialise;
-
- class Info;
- class Client;
- static struct Node {
- Client *h;
- unsigned priority;
- Node *next;
- } *handlers;
- static bool (*temp_data_save_handler)(const wimp_message *message);
-
- static bool message_data_load(const wimp_message *message, void *handle);
- static bool message_data_save(const wimp_message *message, void *handle);
- static bool message_ram_fetch(const wimp_message *message, void *handle);
- static bool message_ram_transmit(const wimp_message *message,
- void *handle);
- static char *buffer;
- static int buffer_size, received, bounce_code, bounce_icon;
- static wimp_w bounce_window;
- static ScrCoords bounce_pos;
- static Filetype bounce_type;
-
- static void fill_in_info(Info &info, const wimp_message *message);
-
- public:
- class Info {
- public:
- Filetype type;
- int size;
- wimp_w window;
- int icon;
- ScrCoords pos;
-
- unsigned shift: 1;
- unsigned control: 1;
- unsigned alt: 1;
- };
- class Client {
- public:
- virtual void *accept_data(const Info &info) = 0;
- virtual void *accept_file(const Info &info) = 0;
- virtual void load_data(const Info &info, istream &stream,
- void *handle) = 0;
- virtual void load_file(const Info &info, const char *filename,
- void *handle) = 0;
- };
-
- static void register_client(Client *handler, unsigned priority);
- static void register_temp_data_save_handler(bool (*function)(const
- wimp_message *message))
- { temp_data_save_handler = function; }
-
- // Priorities:
- // Clipboard paster (exclusive) 0x010
- // Gadgets (high) 0x100
- // Window/iconbar icon 0x200
- // File opener (low) 0x300
-
- private:
- static struct TempFileInfo {
- wimp_t task;
- wimp_w window;
-
- Info info;
- Client *client;
- void *handle;
- } *temp_file;
- };
-
- #endif
-