dialog.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     begin       : Wed Jan 20 2010
00003     copyright   : (C) 2010 by Martin Preuss
00004     email       : martin@libchipcard.de
00005 
00006  ***************************************************************************
00007  *                                                                         *
00008  *   This library is free software; you can redistribute it and/or         *
00009  *   modify it under the terms of the GNU Lesser General Public            *
00010  *   License as published by the Free Software Foundation; either          *
00011  *   version 2.1 of the License, or (at your option) any later version.    *
00012  *                                                                         *
00013  *   This library is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00016  *   Lesser General Public License for more details.                       *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU Lesser General Public      *
00019  *   License along with this library; if not, write to the Free Software   *
00020  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00021  *   MA  02111-1307  USA                                                   *
00022  *                                                                         *
00023  ***************************************************************************/
00024 
00025 
00026 #ifndef GWENHYWFAR_GUI_DIALOG_H
00027 #define GWENHYWFAR_GUI_DIALOG_H
00028 
00029 
00030 #include <gwenhywfar/inherit.h>
00031 #include <gwenhywfar/list1.h>
00032 #include <gwenhywfar/list2.h>
00033 #include <gwenhywfar/xml.h>
00034 #include <gwenhywfar/db.h>
00035 
00036 
00037 
00047 
00048 
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052 
00053 
00054 typedef struct GWEN_DIALOG GWEN_DIALOG;
00055 GWEN_INHERIT_FUNCTION_LIB_DEFS(GWEN_DIALOG, GWENHYWFAR_API)
00056 GWEN_LIST_FUNCTION_LIB_DEFS(GWEN_DIALOG, GWEN_Dialog, GWENHYWFAR_API)
00057 GWEN_LIST2_FUNCTION_LIB_DEFS(GWEN_DIALOG, GWEN_Dialog, GWENHYWFAR_API)
00058 
00059 
00060 #define GWEN_WIDGET_FLAGS_NONE              0x00000000L
00061 #define GWEN_WIDGET_FLAGS_FILLX             0x80000000L
00062 #define GWEN_WIDGET_FLAGS_FILLY             0x40000000L
00063 #define GWEN_WIDGET_FLAGS_READONLY          0x20000000L
00064 #define GWEN_WIDGET_FLAGS_PASSWORD          0x10000000L
00065 #define GWEN_WIDGET_FLAGS_DEFAULT_WIDGET    0x08000000L
00066 
00067 #define GWEN_WIDGET_FLAGS_DECOR_SHRINKABLE  0x04000000L
00068 #define GWEN_WIDGET_FLAGS_DECOR_STRETCHABLE 0x02000000L
00069 #define GWEN_WIDGET_FLAGS_DECOR_MINIMIZE    0x01000000L
00070 #define GWEN_WIDGET_FLAGS_DECOR_MAXIMIZE    0x00800000L
00071 #define GWEN_WIDGET_FLAGS_DECOR_CLOSE       0x00400000L
00072 #define GWEN_WIDGET_FLAGS_DECOR_MENU        0x00200000L
00073 
00074 #define GWEN_WIDGET_FLAGS_FIXED_WIDTH       0x00100000L
00075 #define GWEN_WIDGET_FLAGS_FIXED_HEIGHT      0x00080000L
00076 #define GWEN_WIDGET_FLAGS_EQUAL_WIDTH       0x00040000L
00077 #define GWEN_WIDGET_FLAGS_EQUAL_HEIGHT      0x00020000L
00078 
00079 #define GWEN_WIDGET_FLAGS_JUSTIFY_LEFT      0x00010000L
00080 #define GWEN_WIDGET_FLAGS_JUSTIFY_RIGHT     0x00008000L
00081 #define GWEN_WIDGET_FLAGS_JUSTIFY_TOP       0x00004000L
00082 #define GWEN_WIDGET_FLAGS_JUSTIFY_BOTTOM    0x00002000L
00083 #define GWEN_WIDGET_FLAGS_JUSTIFY_CENTERX   0x00001000L
00084 #define GWEN_WIDGET_FLAGS_JUSTIFY_CENTERY   0x00000800L
00085 
00086 #define GWEN_WIDGET_FLAGS_NO_WORDWRAP       0x00000400L
00087 
00088 
00089 
00090 typedef enum {
00091   GWEN_DialogEvent_TypeInit=0,
00092   GWEN_DialogEvent_TypeFini,
00093   GWEN_DialogEvent_TypeValueChanged,
00094   GWEN_DialogEvent_TypeActivated,
00095   GWEN_DialogEvent_TypeEnabled,
00096   GWEN_DialogEvent_TypeDisabled,
00097   GWEN_DialogEvent_TypeClose,
00098 
00099   GWEN_DialogEvent_TypeLast
00100 } GWEN_DIALOG_EVENTTYPE;
00101 
00102 
00103 
00109 enum {
00110   GWEN_DialogEvent_ResultHandled=0,
00111   GWEN_DialogEvent_ResultNotHandled,
00112   GWEN_DialogEvent_ResultAccept,
00113   GWEN_DialogEvent_ResultReject
00114 };
00115 
00116 
00122 typedef int GWENHYWFAR_CB (*GWEN_DIALOG_SIGNALHANDLER)(GWEN_DIALOG *dlg,
00123                                                        GWEN_DIALOG_EVENTTYPE t,
00124                                                        const char *sender);
00125 
00126 
00127 
00128 GWENHYWFAR_API
00129 GWEN_DIALOG *GWEN_Dialog_new(const char *dialogId);
00130 
00131 GWENHYWFAR_API
00132 void GWEN_Dialog_free(GWEN_DIALOG *dlg);
00133 
00137 GWENHYWFAR_API
00138 int GWEN_Dialog_ReadXml(GWEN_DIALOG *dlg, GWEN_XMLNODE *node);
00139 
00140 
00144 GWENHYWFAR_API
00145 int GWEN_Dialog_ReadXmlFile(GWEN_DIALOG *dlg, const char *fname);
00146 
00152 GWENHYWFAR_API
00153 const char*GWEN_Dialog_GetId(const GWEN_DIALOG *dlg);
00154 
00155 
00156 GWENHYWFAR_API
00157 uint32_t GWEN_Dialog_GetGuiId(const GWEN_DIALOG *dlg);
00158 
00159 
00164 GWENHYWFAR_API
00165 void GWEN_Dialog_AddMediaPath(GWEN_DIALOG *dlg, const char *s);
00166 
00167 
00179 GWENHYWFAR_API
00180 void GWEN_Dialog_AddMediaPathsFromPathManager(GWEN_DIALOG *dlg,
00181                                               const char *destlib,
00182                                               const char *pathName,
00183                                               const char *relPath);
00184 
00185 
00194 GWENHYWFAR_API
00195 int GWEN_Dialog_AddSubDialog(GWEN_DIALOG *dlg,
00196                              const char *parentWidgetName,
00197                              GWEN_DIALOG *subdlg);
00198 
00199 GWENHYWFAR_API
00200 int GWEN_Dialog_RemoveWidget(GWEN_DIALOG *dlg, const char *name);
00201 
00202 
00207 GWENHYWFAR_API
00208 GWEN_DIALOG_SIGNALHANDLER GWEN_Dialog_SetSignalHandler(GWEN_DIALOG *dlg,
00209                                                        GWEN_DIALOG_SIGNALHANDLER fn);
00210 
00211 
00212 
00213 
00214 
00215 typedef enum {
00216   GWEN_DialogProperty_None=0,
00217 
00218   GWEN_DialogProperty_Title,
00219   GWEN_DialogProperty_Value,
00220   GWEN_DialogProperty_MinValue,
00221   GWEN_DialogProperty_MaxValue,
00222   GWEN_DialogProperty_Enabled,
00223   GWEN_DialogProperty_AddValue,
00224   GWEN_DialogProperty_ClearValues,
00225   GWEN_DialogProperty_ValueCount,
00226   GWEN_DialogProperty_ColumnWidth,
00227   GWEN_DialogProperty_Width,
00228   GWEN_DialogProperty_Height,
00229   GWEN_DialogProperty_SelectionMode,
00230   GWEN_DialogProperty_SelectionState,
00231   GWEN_DialogProperty_Focus,
00233   GWEN_DialogProperty_SortDirection,
00234   GWEN_DialogProperty_Sort,
00235   GWEN_DialogProperty_Visibility,
00236   GWEN_DialogProperty_ToolTip,
00237 
00238   GWEN_DialogProperty_Unknown=-1
00239 } GWEN_DIALOG_PROPERTY;
00240 
00241 
00242 typedef enum {
00243   GWEN_Dialog_SelectionMode_None=0,
00244   GWEN_Dialog_SelectionMode_Single,
00245   GWEN_Dialog_SelectionMode_Multi
00246 } GWEN_DIALOG_SELECTION_MODE;
00247 
00248 
00249 typedef enum {
00250   GWEN_DialogSortDirection_None=0,
00251   GWEN_DialogSortDirection_Up,
00252   GWEN_DialogSortDirection_Down
00253 } GWEN_DIALOG_SORT_DIRECTION;
00254 
00255 
00264 
00283 GWENHYWFAR_API
00284 int GWEN_Dialog_SetIntProperty(GWEN_DIALOG *dlg,
00285                                const char *name,
00286                                GWEN_DIALOG_PROPERTY prop,
00287                                int index,
00288                                int value,
00289                                int doSignal);
00290 
00300 GWENHYWFAR_API
00301 int GWEN_Dialog_GetIntProperty(GWEN_DIALOG *dlg,
00302                                const char *name,
00303                                GWEN_DIALOG_PROPERTY prop,
00304                                int index,
00305                                int defaultValue);
00306 
00313 GWENHYWFAR_API
00314 int GWEN_Dialog_SetCharProperty(GWEN_DIALOG *dlg,
00315                                 const char *name,
00316                                 GWEN_DIALOG_PROPERTY prop,
00317                                 int index,
00318                                 const char *value,
00319                                 int doSignal);
00320 
00343 GWENHYWFAR_API
00344 const char *GWEN_Dialog_GetCharProperty(GWEN_DIALOG *dlg,
00345                                         const char *name,
00346                                         GWEN_DIALOG_PROPERTY prop,
00347                                         int index,
00348                                         const char *defaultValue);
00360 GWENHYWFAR_API
00361 uint32_t GWEN_Dialog_GetWidgetFlags(const GWEN_DIALOG *dlg, const char *name);
00362 
00363 GWENHYWFAR_API
00364 void GWEN_Dialog_SetWidgetFlags(GWEN_DIALOG *dlg, const char *name, uint32_t fl);
00365 
00366 GWENHYWFAR_API
00367 void GWEN_Dialog_AddWidgetFlags(GWEN_DIALOG *dlg, const char *name, uint32_t fl);
00368 
00369 GWENHYWFAR_API
00370 void GWEN_Dialog_SubWidgetFlags(GWEN_DIALOG *dlg, const char *name, uint32_t fl);
00371 
00380 GWENHYWFAR_API
00381 int GWEN_Dialog_GetWidgetColumns(const GWEN_DIALOG *dlg, const char *name);
00382 
00383 
00384 
00388 GWENHYWFAR_API
00389 void GWEN_Dialog_SetWidgetColumns(GWEN_DIALOG *dlg, const char *name, int i);
00390 
00391 
00392 
00399 GWENHYWFAR_API
00400 int GWEN_Dialog_GetWidgetRows(const GWEN_DIALOG *dlg, const char *name);
00401 
00402 
00406 GWENHYWFAR_API
00407 void GWEN_Dialog_SetWidgetRows(GWEN_DIALOG *dlg, const char *name, int i);
00408 
00409 
00410 GWENHYWFAR_API
00411 const char *GWEN_Dialog_GetWidgetText(const GWEN_DIALOG *dlg, const char *name);
00412 
00413 GWENHYWFAR_API
00414 void GWEN_Dialog_SetWidgetText(GWEN_DIALOG *dlg, const char *name, const char *t);
00415 
00416 
00429 GWENHYWFAR_API
00430 GWEN_DB_NODE *GWEN_Dialog_GetPreferences(const GWEN_DIALOG *dlg);
00431 
00440 
00444 GWENHYWFAR_API
00445 void GWEN_Dialog_SetI18nDomain(GWEN_DIALOG *dlg, const char *s);
00446 
00456 GWENHYWFAR_API
00457 const char *GWEN_Dialog_GetI18nDomain(const GWEN_DIALOG *dlg);
00458 
00462 GWENHYWFAR_API
00463 const char *GWEN_Dialog_TranslateString(const GWEN_DIALOG *dlg, const char *s);
00467 #ifdef __cplusplus
00468 }
00469 #endif
00470 
00471 
00472 
00476 #endif