Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

widget.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile: widget.h,v $
00003                              -------------------
00004     cvs         : $Id: widget.h,v 1.1 2004/08/06 06:28:48 aquamaniac Exp $
00005     begin       : Mon Feb 09 2004
00006     copyright   : (C) 2004 by Martin Preuss
00007     email       : martin@libchipcard.de
00008 
00009  ***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library 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 GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00024  *   MA  02111-1307  USA                                                   *
00025  *                                                                         *
00026  ***************************************************************************/
00027 
00028 #ifndef GWEN_UI_WIDGET_H
00029 #define GWEN_UI_WIDGET_H
00030 
00031 #include <gwenhywfar/misc.h>
00032 #include <gwenhywfar/inherit.h>
00033 
00034 typedef struct GWEN_WIDGET GWEN_WIDGET;
00035 
00036 GWEN_LIST_FUNCTION_DEFS(GWEN_WIDGET, GWEN_Widget)
00037 GWEN_INHERIT_FUNCTION_DEFS(GWEN_WIDGET)
00038 
00039 typedef enum {
00040   GWEN_WidgetColour_Default=1,
00041   GWEN_WidgetColour_Message,
00042   GWEN_WidgetColour_Unselected,
00043   GWEN_WidgetColour_Selected,
00044   GWEN_WidgetColour_Chosen,
00045   GWEN_WidgetColour_Title,
00046   GWEN_WidgetColour_Button
00047 
00048 } GWEN_WIDGET_COLOUR;
00049 
00050 
00051 #include <gwenhywfar/ui/ui.h>
00052 #include <gwenhywfar/ui/event.h>
00053 
00054 
00055 #define GWEN_WIDGET_FLAGS_IGN_HELP   0x00000001
00056 #define GWEN_WIDGET_FLAGS_KEYPAD     0x00000002
00057 #define GWEN_WIDGET_FLAGS_SCROLL     0x00000004
00058 #define GWEN_WIDGET_FLAGS_ACTIVE     0x00000008
00059 #define GWEN_WIDGET_FLAGS_FOCUSABLE  0x00000010
00060 #define GWEN_WIDGET_FLAGS_BORDER     0x00000020
00061 #define GWEN_WIDGET_FLAGS_NEEDCURSOR 0x00000040
00062 #define GWEN_WIDGET_FLAGS_HCENTER    0x00000080
00063 #define GWEN_WIDGET_FLAGS_VCENTER    0x00000100
00064 #define GWEN_WIDGET_FLAGS_HIGHLIGHT  0x00000200
00065 #define GWEN_WIDGET_FLAGS_MODAL      0x00000400
00066 
00067 #define GWEN_WIDGET_FLAGS_WINDOWFLAGS 0xffff0000
00068 
00069 #define GWEN_WIDGET_FLAGS_DEFAULT (\
00070   GWEN_WIDGET_FLAGS_KEYPAD |\
00071   GWEN_WIDGET_FLAGS_ACTIVE |\
00072   GWEN_WIDGET_FLAGS_FOCUSABLE \
00073   )
00074 
00075 
00076 #define GWEN_WIDGET_STATE_HASFOCUS  0x00000001
00077 #define GWEN_WIDGET_STATE_SELECTED  0x00000002
00078 #define GWEN_WIDGET_STATE_ACTIVE    0x00000004
00079 #define GWEN_WIDGET_STATE_HIGHLIGHT 0x00000008
00080 #define GWEN_WIDGET_STATE_CLOSED    0x00000010
00081 
00082 
00083 #define GWEN_WIDGET_ATT_ESC_CHAR  0xff
00084 #define GWEN_WIDGET_ATT_NORMAL    0x00
00085 #define GWEN_WIDGET_ATT_STANDOUT  0x10
00086 #define GWEN_WIDGET_ATT_UNDERLINE 0x20
00087 #define GWEN_WIDGET_ATT_REVERSE   0x40
00088 #define GWEN_WIDGET_ATT_CHAR      0x80
00089 #define GWEN_WIDGET_COLOUR_MASK   0x0f
00090 
00091 #define GWEN_WIDGET_CHAR_ESC_CHAR 0xfe
00092 #define GWEN_WIDGET_CHAR_VLINE    0x01
00093 #define GWEN_WIDGET_CHAR_HLINE    0x02
00094 #define GWEN_WIDGET_CHAR_ULCORNER 0x03
00095 #define GWEN_WIDGET_CHAR_URCORNER 0x04
00096 #define GWEN_WIDGET_CHAR_LLCORNER 0x05
00097 #define GWEN_WIDGET_CHAR_LRCORNER 0x06
00098 #define GWEN_WIDGET_CHAR_LTEE     0x07
00099 #define GWEN_WIDGET_CHAR_RTEE     0x08
00100 #define GWEN_WIDGET_CHAR_TTEE     0x09
00101 #define GWEN_WIDGET_CHAR_BTEE     0x0a
00102 #define GWEN_WIDGET_CHAR_BLOCK    0x0b
00103 
00104 
00105 #define GWEN_WIDGET_CMD_CLOSE     0x80000001
00106 #define GWEN_WIDGET_CMD_QUIT      0x80000002
00107 #define GWEN_WIDGET_CMD_FINISHED  0x80000003
00108 
00109 
00110 typedef GWEN_UI_RESULT (*GWEN_WIDGET_EVENTHANDLER_FN)(GWEN_WIDGET *w,
00111                                                       GWEN_EVENT *e);
00112 
00113 typedef int (*GWEN_WIDGET_RUN_FN)(GWEN_WIDGET *w);
00114 
00115 
00116 GWEN_WIDGET *GWEN_Widget_new(GWEN_WIDGET *parent,
00117                              GWEN_TYPE_UINT32 flags,
00118                              const char *name,
00119                              const char *text,
00120                              int x, int y, int width, int height);
00121 
00122 void GWEN_Widget_free(GWEN_WIDGET *w);
00123 void GWEN_Widget_Attach(GWEN_WIDGET *w);
00124 
00125 
00126 GWEN_WIDGET *GWEN_Widget_GetParent(const GWEN_WIDGET *w);
00127 GWEN_WIDGET *GWEN_Widget_GetFirstChild(const GWEN_WIDGET *w);
00128 
00129 int GWEN_Widget_GetX(const GWEN_WIDGET *w);
00130 int GWEN_Widget_GetY(const GWEN_WIDGET *w);
00131 
00132 int GWEN_Widget_GetWidth(const GWEN_WIDGET *w);
00133 int GWEN_Widget_GetHeight(const GWEN_WIDGET *w);
00134 const char *GWEN_Widget_GetText(const GWEN_WIDGET *w);
00135 
00136 int GWEN_Widget_GetCursorX(const GWEN_WIDGET *w);
00137 void GWEN_Widget_SetCursorX(GWEN_WIDGET *w, int x);
00138 int GWEN_Widget_GetCursorY(const GWEN_WIDGET *w);
00139 void GWEN_Widget_SetCursorY(GWEN_WIDGET *w, int y);
00140 
00141 GWEN_TYPE_UINT32 GWEN_Widget_GetFlags(const GWEN_WIDGET *w);
00142 GWEN_TYPE_UINT32 GWEN_Widget_GetState(const GWEN_WIDGET *w);
00143 
00144 GWEN_WIDGET_EVENTHANDLER_FN GWEN_Widget_GetEventHandler(const GWEN_WIDGET *w);
00145 void GWEN_Widget_SetEventHandler(GWEN_WIDGET *w,
00146                                  GWEN_WIDGET_EVENTHANDLER_FN f);
00147 void GWEN_Widget_SetRunFn(GWEN_WIDGET *w, GWEN_WIDGET_RUN_FN f);
00148 
00149 int GWEN_Widget_SendEvent(GWEN_WIDGET *wRecipient,
00150                           GWEN_WIDGET *wSender,
00151                           GWEN_EVENT *e);
00152 
00153 int GWEN_Widget_Redraw(GWEN_WIDGET *w);
00154 int GWEN_Widget_SetText(GWEN_WIDGET *w, const char *t,
00155                         GWEN_EVENT_SETTEXT_MODE m);
00156 int GWEN_Widget_Move(GWEN_WIDGET *w, int x, int y);
00157 int GWEN_Widget_SetColour(GWEN_WIDGET *w, GWEN_WIDGET_COLOUR c);
00158 GWEN_WIDGET_COLOUR GWEN_Widget_GetColour(const GWEN_WIDGET *w);
00159 
00160 int GWEN_Widget_SetFocus(GWEN_WIDGET *w);
00161 int GWEN_Widget_Destroy(GWEN_WIDGET *w);
00162 int GWEN_Widget_Update(GWEN_WIDGET *w);
00163 int GWEN_Widget_Refresh(GWEN_WIDGET *w);
00164 int GWEN_Widget_Scroll(GWEN_WIDGET *w, int byX, int byY);
00165 int GWEN_Widget_Scrolled(GWEN_WIDGET *w, int byX, int byY);
00166 int GWEN_Widget_WriteAt(GWEN_WIDGET *w,
00167                         int x, int y,
00168                         const char *t, int len);
00169 int GWEN_Widget_ChangeAtts(GWEN_WIDGET *w,
00170                            GWEN_TYPE_UINT32 atts,
00171                            int set);
00172 int GWEN_Widget_Clear(GWEN_WIDGET *w, int x, int y, GWEN_EVENT_CLEAR_MODE m);
00173 int GWEN_Widget_Highlight(GWEN_WIDGET *w, int x, int y, int len,
00174                           GWEN_WIDGET_COLOUR hi);
00175 int GWEN_Widget_ContentChange(GWEN_WIDGET *w,
00176                               int contentWidth,
00177                               int contentHeight);
00178 int GWEN_Widget_Close(GWEN_WIDGET *w);
00179 
00180 int GWEN_Widget_Changed(GWEN_WIDGET *w);
00181 
00182 
00183 const char *GWEN_Widget_GetHelpText(const GWEN_WIDGET *w);
00184 void GWEN_Widget_SetHelpText(GWEN_WIDGET *w, const char *s);
00185 
00186 const char *GWEN_Widget_GetDbVarName(const GWEN_WIDGET *w);
00187 void GWEN_Widget_SetDbVarName(GWEN_WIDGET *w, const char *s);
00188 
00189 
00190 int GWEN_Widget_IsChildOf(GWEN_WIDGET *wchild, GWEN_WIDGET *w);
00191 int GWEN_Widget_IsAncestorOf(GWEN_WIDGET *wc, GWEN_WIDGET *w);
00192 
00193 
00194 int GWEN_Widget_Run(GWEN_WIDGET *w);
00195 
00196 
00197 void GWEN_Widget_Subscribe(GWEN_WIDGET *w,
00198                            GWEN_EVENT_TYPE t,
00199                            GWEN_WIDGET *subscriber);
00200 
00201 void GWEN_Widget_Unsubscribe(GWEN_WIDGET *w,
00202                              GWEN_EVENT_TYPE t,
00203                              GWEN_WIDGET *subscriber);
00204 
00205 int GWEN_Widget_GetPhysicalX(const GWEN_WIDGET *w);
00206 int GWEN_Widget_GetPhysicalY(const GWEN_WIDGET *w);
00207 
00208 GWEN_WIDGET *GWEN_Widget_FindByName(GWEN_WIDGET *w, const char *name);
00209 
00210 
00211 
00216 const char *GWEN_Widget_GetName(const GWEN_WIDGET *w);
00217 GWEN_TYPE_UINT32 GWEN_Widget_GetId(const GWEN_WIDGET *w);
00218 void GWEN_Widget_SetTypeName(GWEN_WIDGET *w, const char *s);
00219 const char *GWEN_Widget_GetTypeName(const GWEN_WIDGET *w);
00220 
00221 void GWEN_Widget_Dump(GWEN_WIDGET *w, int indent);
00225 #endif
00226 
00227 
00228 
00229 
00230 

Generated on Thu Oct 13 04:23:11 2005 for gwenhywfar by  doxygen 1.4.1