home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / code / wxwin140 / samples / ipc / server.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-19  |  2.3 KB  |  79 lines

  1. /*
  2.  * File:     server.h
  3.  * Purpose:  Server demo for wxWindows class library
  4.  *
  5.  *                       wxWindows 1.40
  6.  * Copyright (c) 1993 Artificial Intelligence Applications Institute,
  7.  *                   The University of Edinburgh
  8.  *
  9.  *                     Author: Julian Smart
  10.  *                        Date: 19-4-93
  11.  *
  12.  * Permission to use, copy, modify, and distribute this software and its
  13.  * documentation for any purpose is hereby granted without fee, provided
  14.  * that the above copyright notice, author statement and this permission
  15.  * notice appear in all copies of this software and related documentation.
  16.  *
  17.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS,
  18.  * IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
  19.  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  20.  *
  21.  * IN NO EVENT SHALL THE ARTIFICIAL INTELLIGENCE APPLICATIONS INSTITUTE OR THE
  22.  * UNIVERSITY OF EDINBURGH BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR
  23.  * CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM
  24.  * LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF
  25.  * DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
  26.  * THE USE OR PERFORMANCE OF THIS SOFTWARE.
  27.  */
  28.  
  29. // Define a new application
  30. class MyApp: public wxApp
  31. {
  32.   public:
  33.     wxFrame *OnInit(void);
  34. };
  35.  
  36. // Define a new frame
  37. class MyFrame: public wxFrame
  38. {
  39.   public:
  40.     wxPanel *panel;
  41.  
  42.     MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
  43.     Bool OnClose(void);
  44.     void OnMenuCommand(int id);
  45. };
  46.  
  47. // IPC stuff
  48.  
  49. class IPCDialogBox;
  50. class MyConnection: public wxConnection
  51. {
  52.  public:
  53.   IPCDialogBox *dialog;
  54.   MyConnection(char *buf, int size);
  55.   ~MyConnection(void);
  56.   Bool OnExecute(char *topic, char *data, int size, int format);
  57.   char *OnRequest(char *topic, char *item, int *size, int format);
  58.   Bool OnPoke(char *topic, char *item, char *data, int size, int format);
  59. };
  60.  
  61. class MyServer: public wxServer
  62. {
  63.  public:
  64.   wxConnection *OnAcceptConnection(char *topic);
  65. };
  66.  
  67. class IPCDialogBox: public wxDialogBox
  68. {
  69.  public:
  70.  MyConnection *connection;
  71.  IPCDialogBox(wxFrame *Parent, char *Title, Bool Modal, 
  72.                          int x, int y, int width, int height, MyConnection *the_connection);
  73. };
  74.  
  75. // Callbacks
  76. void list_proc(wxListBox& listbox, wxEvent& event);
  77.  
  78. #define SERVER_QUIT  1
  79.