Back to index

plt-scheme  4.2.1
Canvas.h
Go to the documentation of this file.
00001 /*                                                      -*- C++ -*-
00002  *
00003  * Purpose: canvas panel item
00004  *
00005  * Authors: Markus Holzem and Julian Smart
00006  *
00007  * Copyright: (C) 2004-2009 PLT Scheme Inc.
00008  * Copyright: (C) 1995, AIAI, University of Edinburgh (Julian)
00009  * Copyright: (C) 1995, GNU (Markus)
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00024  * 02110-1301 USA.
00025  */
00026 
00027 #ifndef Canvas_h
00028 #define Canvas_h
00029 
00030 #ifdef __GNUG__
00031 #pragma interface
00032 #endif
00033 
00034 class wxColourMap;
00035 class wxCommandEvent;
00036 class wxCursor;
00037 class wxKeyEvent;
00038 class wxMouseEvent;
00039 class wxPanel;
00040 class wxFrame;
00041 class wxGLConfig;
00042 
00043 class wxCanvas : public wxItem {
00044 public:
00045     wxCanvas(wxWindow *parent,
00046            int x=-1, int y=-1, int width=-1, int height=-1,
00047            int style=0, char *name="canvas", wxGLConfig *gl = NULL);
00048     ~wxCanvas(void);
00049 
00050     Bool Create(wxPanel *parent,
00051               int x=-1, int y=-1, int width=-1, int height=-1,
00052               int style=0, char *name="canvas", wxGLConfig *gl = NULL);
00053 
00054     virtual void GetRefreshSize(int *w, int *h);
00055 
00056     void GetScrollUnitsPerPage(int *x, int *y)
00057        { *x = h_units; *y = v_units; };
00058     void GetVirtualSize(int *x, int *y);
00059     void Scroll(int x_pos, int y_pos);
00060     void ScrollPercent(double x_pos, double y_pos);
00061     virtual void SetScrollbars(int h_pixels, int v_pixels, int x_len, int y_len,
00062                             int x_page, int y_page, int x_pos=0, int y_pos=0,
00063                             Bool setVirtualSize = TRUE);
00064     void SetBackgroundToGray(void);
00065     void ViewStart(int *x, int *y);
00066     void WarpPointer(int x, int y);
00067     // overriden callback methods
00068     virtual void OnChar(wxKeyEvent *event);
00069     virtual void Paint(void);
00070 
00071     virtual void SetCanvasBackground(wxColor *c);
00072     wxColor *GetCanvasBackground();
00073 
00074     virtual void ChangeToGray(Bool gray);
00075 
00076     virtual void Layout(void);
00077 
00078     virtual Bool  WantsFocus(void);
00079 
00080 private:
00081     int       h_size, h_units, h_units_per_page,
00082        v_size, v_units, v_units_per_page;
00083 
00084     wxColour *bgcol;
00085 };
00086 
00087 #endif // Canvas_h