include/liqcanvas.h

00001 /* liqbase
00002  * Copyright (C) 2008 Gary Birkett
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License version 2
00006  * as published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00016  */
00017 
00018 /*
00019  *
00020  * Header for canvas control.  most of these functions are in flux, they are required but depreciated.
00021  *
00022  */
00023 
00024 
00025 
00026 #ifndef LIQCANVAS_H
00027 #define LIQCANVAS_H
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 
00034 #include "liqfont.h"
00035 #include "liqimage.h"
00036 #include "liqcliprect.h"
00037 
00038 typedef struct
00039 {
00040         int pixelwidth;
00041         int pixelheight;
00042 
00043         int fullscreen;
00044         float scalew;
00045         float scaleh;
00046         int dpix;
00047         int dpiy;
00048         int keepalivealarmtime;
00049         //liqfont *font;
00050         liqimage *surface;              // these are now dynamically allocated and altered depending upon the x11 overlay actions
00051         liqcliprect *cr;                // there might be times when these are NULL.  always read and try to check..
00052                                                         // they are removed, cleared and reset by a resize/rotation operation
00053                                                         // technically we should also have the same operation altering the pixelwidthheight variables
00054 
00055         void *customx11display; // this should be null if created by myself
00056         void *customx11window;
00057 
00058         void *actualx11display; // this will always be live within an x11 framework
00059         void *actualx11window;
00060         
00061         void *x11info;
00062         
00063         unsigned int expansion[16];
00064         
00065 } liqcanvas;
00066 
00067 //#######################################################
00068 
00069 // optional custom event wrappers
00070 
00071 typedef struct
00072 {
00073         unsigned int type;
00074         unsigned long ticks;
00075         unsigned int state;
00076         unsigned int button;
00077         unsigned int x;                                 // events are scaled to canvas pixels
00078         unsigned int y;
00079         unsigned int pressure;
00080 }
00081         LIQEVENT_MOUSE;
00082 
00083 typedef struct
00084 {
00085         unsigned int type;
00086         unsigned long ticks;
00087         unsigned int state;
00088         unsigned int keycode;                           // KeySym
00089         char keystring[16];                                     // not exactly sure if it will ever be needed
00090         //unsigned int keyascii;
00091 }
00092         LIQEVENT_KEY;
00093 
00094 //LIQEVENT_STATE_WAKEUP
00095 typedef union
00096 {
00097         struct                                                  // evtype 0,3,4
00098         {
00099                 unsigned int type;
00100                 unsigned long ticks;
00101                 unsigned int state;
00102         };
00103         LIQEVENT_MOUSE mouse;                   // evtype 1
00104         LIQEVENT_KEY key;                               // evtype 2
00105 }
00106         LIQEVENT;
00107 
00108 #define LIQEVENT_TYPE_NONE       -1
00109 #define LIQEVENT_TYPE_UNKNOWN    0
00110 #define LIQEVENT_TYPE_MOUSE      1
00111 #define LIQEVENT_TYPE_KEY        2
00112 #define LIQEVENT_TYPE_EXPOSE     3
00113 #define LIQEVENT_TYPE_REFRESHED  4
00114 #define LIQEVENT_TYPE_DIRTYFLAGSET 5
00115 
00116 #define LIQEVENT_TYPE_RESIZE     6
00117 
00118 //#define LIQEVENT_TYPE_BUTTON     4
00119 //#define LIQEVENT_STATE_KEEPALIVE 8
00120 
00121 #define LIQEVENT_STATE_NONE      -1
00122 #define LIQEVENT_STATE_UNKNOWN   0
00123 #define LIQEVENT_STATE_PRESS     1
00124 #define LIQEVENT_STATE_RELEASE   2
00125 #define LIQEVENT_STATE_MOVE      4
00126 
00127 
00128 
00129 
00130 
00131 #define HILDON_APPVIEW_HEIGHT          420
00132 #define HILDON_APPVIEW_WIDTH           720
00133 
00134 
00135 //todo: make this a class instance, we might end up having multiple canvases..
00136 extern liqcanvas canvas;
00137 
00138 int           liqcanvas_isopen();
00139 
00140 //#######################################################
00141 // allocate using your own custom window
00142 // i expect this to fail with multiple instances
00143 // todo: this canvas was the first code i wrote and its ingrained in the system and needs cleaning out
00144 int           liqcanvas_init_usecustomwindow(   int pixelwidth,int pixelheight,void *customx11display,void *customx11window);
00145 
00146 
00147 int           liqcanvas_init(                   int pixelwidth,int pixelheight,int fullscreen);
00148 int           liqcanvas_eventcount();
00149 int           liqcanvas_nextevent(              LIQEVENT *ptrevent,int *dirtyflagptr);
00150 int           liqcanvas_refreshdisplay();
00151 
00152 int           liqcanvas_close();
00153 
00154 void          liqcanvas_clear(          unsigned char grey);
00155 liqcliprect * liqcanvas_getcliprect();          // draw everything using this, dont touch these functions below
00156 liqimage *    liqcanvas_getsurface();
00157 
00158 
00159 int           liqcanvas_minimize();
00160 int           liqcanvas_getwidth();
00161 int           liqcanvas_getheight();
00162 int           liqcanvas_getdpix();
00163 int           liqcanvas_getdpiy();
00164 float         liqcanvas_getscalew();
00165 float         liqcanvas_getscaleh();
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 
00182 #ifdef __cplusplus
00183 }
00184 #endif
00185 
00186 
00187 #endif

Generated on Sat May 23 23:03:13 2009 for libliqbase by  doxygen 1.5.1