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

  1. /*
  2.  * File:     objects.h
  3.  * Purpose:  Object graphics library demo for wxWindows.
  4.  *           Defines a canvas which repaints its own graphics objects.
  5.  *
  6.  *                       wxWindows 1.40
  7.  * Copyright (c) 1993 Artificial Intelligence Applications Institute,
  8.  *                   The University of Edinburgh
  9.  *
  10.  *                     Author: Julian Smart
  11.  *                        Date: 18-4-93
  12.  *
  13.  * Permission to use, copy, modify, and distribute this software and its
  14.  * documentation for any purpose is hereby granted without fee, provided
  15.  * that the above copyright notice, author statement and this permission
  16.  * notice appear in all copies of this software and related documentation.
  17.  *
  18.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS,
  19.  * IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
  20.  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  21.  *
  22.  * IN NO EVENT SHALL THE ARTIFICIAL INTELLIGENCE APPLICATIONS INSTITUTE OR THE
  23.  * UNIVERSITY OF EDINBURGH BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR
  24.  * CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM
  25.  * LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF
  26.  * DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
  27.  * THE USE OR PERFORMANCE OF THIS SOFTWARE.
  28.  *
  29.  */
  30.  
  31. // Define a new application
  32. class MyApp: public wxApp
  33. {
  34.   public:
  35.     wxFrame *OnInit(void);
  36. };
  37.  
  38. // Define a new frame
  39. class MyFrame: public wxFrame
  40. {
  41.   public:
  42.     ObjectCanvas *canvas;
  43.     MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
  44.     Bool OnClose(void);
  45.     void OnMenuCommand(int id);
  46. };
  47.  
  48. class MyLine: public LineObject
  49. {
  50.  public:
  51.   MyLine(void);
  52.   void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
  53. };
  54.  
  55. class MyRectangle: public RectangleObject
  56. {
  57.  public:
  58.   char *label;
  59.  
  60.   MyRectangle(float width, float height);
  61.   void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
  62.  
  63.   // N.B. You could override the OnDraw function to supply additional
  64.   // graphic elements; call RectangleObject::OnDraw first though.
  65. };
  66.  
  67. class MyEllipse: public EllipseObject
  68. {
  69.  public:
  70.   char *label;
  71.  
  72.   MyEllipse(float width, float height);
  73.   void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
  74. };
  75.  
  76. // Callbacks
  77. void GenericOk(wxButton& but, wxEvent& event);
  78.  
  79. #define OBJECTS_QUIT         1
  80. #define OBJECTS_ABOUT        2
  81. #define OBJECTS_ELLIPSE      3
  82. #define OBJECTS_RECTANGLE    4
  83. #define OBJECTS_DELETE       5
  84. #define OBJECTS_CONNECT      6
  85. #define OBJECTS_EDIT_TEXT    7
  86.  
  87.