gwenhywfar  5.11.1beta
gui.h
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Tue Oct 02 2002
3  copyright : (C) 2002-2010 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * *
8  * This library is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU Lesser General Public *
10  * License as published by the Free Software Foundation; either *
11  * version 2.1 of the License, or (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16  * Lesser General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU Lesser General Public *
19  * License along with this library; if not, write to the Free Software *
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21  * MA 02111-1307 USA *
22  * *
23  ***************************************************************************/
24 
25 #ifndef GWENHYWFAR_GUI_GUI_H
26 #define GWENHYWFAR_GUI_GUI_H
27 
28 
29 
30 #include <gwenhywfar/inherit.h>
31 #include <gwenhywfar/logger.h>
32 #include <gwenhywfar/inetsocket.h>
34 #include <gwenhywfar/syncio.h>
35 #include <gwenhywfar/dialog.h>
36 #include <gwenhywfar/passwdstore.h>
37 
38 #include <inttypes.h>
39 
40 
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 
47 
48 
115 
116 
117 
132 
163 typedef enum {
169 
170 
176 typedef struct GWEN_GUI GWEN_GUI;
178 
179 
180 #define GWEN_GUI_CPU_TIMEOUT 200
181 
182 #define GWEN_GUI_CHECK_PERIOD 750
183 #define GWEN_GUI_DELAY_SECS 2
184 
185 
192 #define GWEN_GUI_PROGRESS_DELAY 0x00000001
193 #define GWEN_GUI_PROGRESS_SHOW_LOG 0x00000002
194 #define GWEN_GUI_PROGRESS_SHOW_ABORT 0x00000004
195 #define GWEN_GUI_PROGRESS_ALLOW_SUBLEVELS 0x00000008
196 #define GWEN_GUI_PROGRESS_ALLOW_EMBED 0x00000010
197 #define GWEN_GUI_PROGRESS_SHOW_PROGRESS 0x00000020
198 #define GWEN_GUI_PROGRESS_KEEP_OPEN 0x00000040
199 #define GWEN_GUI_PROGRESS_ALWAYS_SHOW_LOG 0x00000080
211 #define GWEN_GUI_INPUT_FLAGS_CONFIRM 0x00000001
213 #define GWEN_GUI_INPUT_FLAGS_SHOW 0x00000002
215 #define GWEN_GUI_INPUT_FLAGS_NUMERIC 0x00000004
217 #define GWEN_GUI_INPUT_FLAGS_RETRY 0x00000008
220 #define GWEN_GUI_INPUT_FLAGS_ALLOW_DEFAULT 0x00000010
222 #define GWEN_GUI_INPUT_FLAGS_TAN 0x00000020
224 #define GWEN_GUI_INPUT_FLAGS_OPTICAL 0x00000040
226 #define GWEN_GUI_INPUT_FLAGS_DIRECT 0x00000080
227 
279 #define GWEN_GUI_MSG_FLAGS_TYPE_MASK 0x07
281 #define GWEN_GUI_MSG_FLAGS_TYPE_INFO 0
283 #define GWEN_GUI_MSG_FLAGS_TYPE_IS_INFO(fl) \
284  ((fl & GWEN_GUI_MSG_FLAGS_TYPE_MASK)==GWEN_GUI_MSG_FLAGS_TYPE_INFO)
285 
287 #define GWEN_GUI_MSG_FLAGS_TYPE_WARN 1
289 #define GWEN_GUI_MSG_FLAGS_TYPE_IS_WARN(fl) \
290  ((fl & GWEN_GUI_MSG_FLAGS_TYPE_MASK)==GWEN_GUI_MSG_FLAGS_TYPE_WARN)
291 
293 #define GWEN_GUI_MSG_FLAGS_TYPE_ERROR 2
295 #define GWEN_GUI_MSG_FLAGS_TYPE_IS_ERROR \
296  ((fl & GWEN_GUI_MSG_FLAGS_TYPE_MASK)==GWEN_GUI_MSG_FLAGS_TYPE_ERROR)
297 
299 #define GWEN_GUI_MSG_FLAGS_CONFIRM_B1 (1<<3)
301 #define GWEN_GUI_MSG_FLAGS_CONFIRM_B2 (2<<3)
303 #define GWEN_GUI_MSG_FLAGS_CONFIRM_B3 (3<<3)
305 #define GWEN_GUI_MSG_FLAGS_CONFIRM_BUTTON(fl) (((fl)>>3) & 0x3)
306 
307 
329 #define GWEN_GUI_MSG_FLAGS_SEVERITY_MASK (0x7<<5)
331 #define GWEN_GUI_MSG_FLAGS_SEVERITY_NORMAL (0x0<<5)
332 #define GWEN_GUI_MSG_FLAGS_SEVERITY_IS_NORMAL(fl) \
333  ((fl & GWEN_GUI_MSG_FLAGS_SEVERITY_MASK)==\
334  GWEN_GUI_MSG_FLAGS_SEVERITY_NORMAL)
337 #define GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS (0x1<<5)
338 #define GWEN_GUI_MSG_FLAGS_SEVERITY_IS_DANGEROUS(fl) \
339  ((fl & GWEN_GUI_MSG_FLAGS_SEVERITY_MASK)==\
340  GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS)
353 #define GWEN_GUI_SHOWBOX_FLAGS_BEEP 0x00000001
368 #define GWEN_GUI_PROGRESS_NONE (0xffffffffUL)
369 
376 #define GWEN_GUI_PROGRESS_ONE (0xfffffffeUL)
386 typedef enum {
394 
395 
396 
403 
406 
409 
412 
415 
429 const char *GWEN_Gui_GetCharSet(const GWEN_GUI *gui);
430 
432 void GWEN_Gui_SetCharSet(GWEN_GUI *gui, const char *s);
433 
435 int GWEN_Gui_ConvertString(const char *text, size_t len, GWEN_BUFFER *tbuf,
436  const char *fromCs, const char *toCs);
437 
438 
481 
515 int GWEN_Gui_MessageBox(uint32_t flags,
516  const char *title,
517  const char *text,
518  const char *b1,
519  const char *b2,
520  const char *b3,
521  uint32_t guiid);
522 
529 void GWEN_Gui_ShowError(const char *title, const char *text, ...);
530 
531 
560 int GWEN_Gui_InputBox(uint32_t flags,
561  const char *title,
562  const char *text,
563  char *buffer,
564  int minLen,
565  int maxLen,
566  uint32_t guiid);
567 
594 uint32_t GWEN_Gui_ShowBox(uint32_t flags,
595  const char *title,
596  const char *text,
597  uint32_t guiid);
598 
611 void GWEN_Gui_HideBox(uint32_t id);
612 
613 
646 uint32_t GWEN_Gui_ProgressStart(uint32_t progressFlags,
647  const char *title,
648  const char *text,
649  uint64_t total,
650  uint32_t guiid);
651 
673 int GWEN_Gui_ProgressAdvance(uint32_t id, uint32_t progress);
674 
676 int GWEN_Gui_ProgressSetTotal(uint32_t id, uint64_t total);
677 
689 int GWEN_Gui_ProgressLog(uint32_t id,
690  GWEN_LOGGER_LEVEL level,
691  const char *text);
692 
706 int GWEN_Gui_ProgressLog2(uint32_t id,
707  GWEN_LOGGER_LEVEL level,
708  const char *text, ...);
709 
735 int GWEN_Gui_ProgressEnd(uint32_t id);
736 
737 
752 int GWEN_Gui_Print(const char *docTitle,
753  const char *docType,
754  const char *descr,
755  const char *text,
756  uint32_t guiid);
757 
788 int GWEN_Gui_GetPassword(uint32_t flags,
789  const char *token,
790  const char *title,
791  const char *text,
792  char *buffer,
793  int minLen,
794  int maxLen,
795  GWEN_GUI_PASSWORD_METHOD methodId,
796  GWEN_DB_NODE *methodParams,
797  uint32_t guiid);
798 
804 int GWEN_Gui_SetPasswordStatus(const char *token,
805  const char *pin,
807  uint32_t guiid);
808 
820 int GWEN_Gui_LogHook(const char *logDomain,
821  GWEN_LOGGER_LEVEL priority,
822  const char *s);
823 
824 
835  GWEN_SOCKET_LIST2 *writeSockets,
836  uint32_t guiid,
837  int msecs);
838 
849 int GWEN_Gui_GetSyncIo(const char *url,
850  const char *defaultProto,
851  int defaultPort,
852  GWEN_SYNCIO **pSio);
853 
854 
865  GWEN_SYNCIO *sio,
866  uint32_t guiid);
867 
868 
880 int GWEN_Gui_KeyDataFromText_OpenSSL(const char *text,
881  unsigned char *buffer,
882  unsigned int bufLength);
883 
884 
897 
908 int GWEN_Gui_ExecDialog(GWEN_DIALOG *dlg, uint32_t guiid);
909 
910 
921 int GWEN_Gui_OpenDialog(GWEN_DIALOG *dlg, uint32_t guiid);
922 
923 
935 
936 
946 int GWEN_Gui_RunDialog(GWEN_DIALOG *dlg, int untilEnd);
947 
948 
949 typedef enum {
953 
955 
970 int GWEN_Gui_GetFileName(const char *caption,
972  uint32_t flags,
973  const char *patterns,
974  GWEN_BUFFER *pathBuffer,
975  uint32_t guiid);
976 
990 
992 #define GWEN_GUI_FLAGS_NONINTERACTIVE 0x00000001
994 #define GWEN_GUI_FLAGS_ACCEPTVALIDCERTS 0x00000002
996 #define GWEN_GUI_FLAGS_REJECTINVALIDCERTS 0x00000004
998 #define GWEN_GUI_FLAGS_PERMPASSWORDS 0x00000008
999 
1001 #define GWEN_GUI_FLAGS_DIALOGSUPPORTED 0x80000000
1002 
1011 
1012 
1013 
1033  GWEN_DB_NODE *dbPasswords,
1034  int persistent);
1035 
1063 
1064 
1065 
1085  const char *defaultProto,
1086  int defaultPort,
1087  GWEN_SYNCIO *baseSio);
1088 
1089 
1090 #ifdef __cplusplus
1091 }
1092 #endif
1093 
1097 #endif
1098 
1099 
1100 
1101 
struct GWEN_DB_NODE GWEN_DB_NODE
Definition: db.h:228
struct GWEN_DIALOG GWEN_DIALOG
Definition: dialog.h:54
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:38
GWENHYWFAR_API int GWEN_Gui_ExecDialog(GWEN_DIALOG *dlg, uint32_t guiid)
GWENHYWFAR_API int GWEN_Gui_WaitForSockets(GWEN_SOCKET_LIST2 *readSockets, GWEN_SOCKET_LIST2 *writeSockets, uint32_t guiid, int msecs)
GWENHYWFAR_API int GWEN_Gui_InputBox(uint32_t flags, const char *title, const char *text, char *buffer, int minLen, int maxLen, uint32_t guiid)
GWENHYWFAR_API int GWEN_Gui_LogHook(const char *logDomain, GWEN_LOGGER_LEVEL priority, const char *s)
GWENHYWFAR_API GWEN_DEPRECATED uint32_t GWEN_Gui_ShowBox(uint32_t flags, const char *title, const char *text, uint32_t guiid)
GWEN_GUI_PASSWORD_METHOD
Definition: gui.h:163
@ GWEN_Gui_PasswordMethod_Unknown
Definition: gui.h:164
@ GWEN_Gui_PasswordMethod_Text
Definition: gui.h:166
@ GWEN_Gui_PasswordMethod_Mask
Definition: gui.h:165
@ GWEN_Gui_PasswordMethod_OpticalHHD
Definition: gui.h:167
GWENHYWFAR_API uint32_t GWEN_Gui_ProgressStart(uint32_t progressFlags, const char *title, const char *text, uint64_t total, uint32_t guiid)
GWENHYWFAR_API void GWEN_Gui_SetPasswdStore(GWEN_GUI *gui, GWEN_PASSWD_STORE *sto)
GWENHYWFAR_API GWEN_PASSWD_STORE * GWEN_Gui_GetPasswdStore(const GWEN_GUI *gui)
GWENHYWFAR_API int GWEN_Gui_ProgressEnd(uint32_t id)
GWENHYWFAR_API int GWEN_Gui_MessageBox(uint32_t flags, const char *title, const char *text, const char *b1, const char *b2, const char *b3, uint32_t guiid)
GWEN_GUI_FILENAME_TYPE
Definition: gui.h:949
@ GWEN_Gui_FileNameType_OpenDirectory
Definition: gui.h:952
@ GWEN_Gui_FileNameType_SaveFileName
Definition: gui.h:951
@ GWEN_Gui_FileNameType_OpenFileName
Definition: gui.h:950
GWENHYWFAR_API const char * GWEN_Gui_GetCharSet(const GWEN_GUI *gui)
GWENHYWFAR_API void GWEN_Gui_Attach(GWEN_GUI *gui)
GWENHYWFAR_API int GWEN_Gui_CheckCert(const GWEN_SSLCERTDESCR *cert, GWEN_SYNCIO *sio, uint32_t guiid)
GWENHYWFAR_API void GWEN_Gui_SubFlags(GWEN_GUI *gui, uint32_t fl)
GWENHYWFAR_API void GWEN_Gui_free(GWEN_GUI *gui)
GWENHYWFAR_API int GWEN_Gui_Print(const char *docTitle, const char *docType, const char *descr, const char *text, uint32_t guiid)
GWENHYWFAR_API void GWEN_Gui_SetPasswordDb(GWEN_GUI *gui, GWEN_DB_NODE *dbPasswords, int persistent)
GWENHYWFAR_API GWEN_GUI * GWEN_Gui_new(void)
GWEN_SYNCIO * GWEN_Gui_ExtendSyncIo(const char *url, const char *defaultProto, int defaultPort, GWEN_SYNCIO *baseSio)
GWENHYWFAR_API int GWEN_Gui_GetPassword(uint32_t flags, const char *token, const char *title, const char *text, char *buffer, int minLen, int maxLen, GWEN_GUI_PASSWORD_METHOD methodId, GWEN_DB_NODE *methodParams, uint32_t guiid)
GWENHYWFAR_API int GWEN_Gui_ProgressLog(uint32_t id, GWEN_LOGGER_LEVEL level, const char *text)
GWENHYWFAR_API int GWEN_Gui_RunDialog(GWEN_DIALOG *dlg, int untilEnd)
GWENHYWFAR_API void GWEN_Gui_SetGui(GWEN_GUI *gui)
GWENHYWFAR_API int GWEN_Gui_ConvertString(const char *text, size_t len, GWEN_BUFFER *tbuf, const char *fromCs, const char *toCs)
GWENHYWFAR_API GWEN_DB_NODE * GWEN_Gui_GetPasswordDb(const GWEN_GUI *gui)
GWENHYWFAR_API uint32_t GWEN_Gui_GetFlags(const GWEN_GUI *gui)
GWENHYWFAR_API int GWEN_Gui_OpenDialog(GWEN_DIALOG *dlg, uint32_t guiid)
GWENHYWFAR_API int GWEN_Gui_ProgressSetTotal(uint32_t id, uint64_t total)
GWENHYWFAR_API GWEN_DEPRECATED void GWEN_Gui_HideBox(uint32_t id)
GWENHYWFAR_API GWEN_GUI * GWEN_Gui_GetGui(void)
GWENHYWFAR_API void GWEN_Gui_SetCharSet(GWEN_GUI *gui, const char *s)
GWENHYWFAR_API void GWEN_Gui_SetFlags(GWEN_GUI *gui, uint32_t fl)
GWENHYWFAR_API int GWEN_Gui_CloseDialog(GWEN_DIALOG *dlg)
GWENHYWFAR_API void GWEN_Gui_ShowError(const char *title, const char *text,...)
GWENHYWFAR_API void GWEN_Gui_SetMinProgressLogLevel(GWEN_GUI *gui, GWEN_LOGGER_LEVEL ll)
GWENHYWFAR_API int GWEN_Gui_SetPasswordStatus(const char *token, const char *pin, GWEN_GUI_PASSWORD_STATUS status, uint32_t guiid)
GWEN_GUI_PASSWORD_STATUS
Definition: gui.h:386
@ GWEN_Gui_PasswordStatus_Unknown
Definition: gui.h:388
@ GWEN_Gui_PasswordStatus_Bad
Definition: gui.h:387
@ GWEN_Gui_PasswordStatus_Unused
Definition: gui.h:391
@ GWEN_Gui_PasswordStatus_Ok
Definition: gui.h:389
@ GWEN_Gui_PasswordStatus_Used
Definition: gui.h:390
@ GWEN_Gui_PasswordStatus_Remove
Definition: gui.h:392
GWENHYWFAR_API int GWEN_Gui_GetFileName(const char *caption, GWEN_GUI_FILENAME_TYPE fnt, uint32_t flags, const char *patterns, GWEN_BUFFER *pathBuffer, uint32_t guiid)
GWENHYWFAR_API void GWEN_Gui_AddFlags(GWEN_GUI *gui, uint32_t fl)
GWENHYWFAR_API const char * GWEN_Gui_GetName(void)
GWENHYWFAR_API int GWEN_Gui_ProgressLog2(uint32_t id, GWEN_LOGGER_LEVEL level, const char *text,...)
GWENHYWFAR_API int GWEN_Gui_ProgressAdvance(uint32_t id, uint32_t progress)
GWENHYWFAR_API GWEN_LOGGER_LEVEL GWEN_Gui_GetMinProgressLogLevel(const GWEN_GUI *gui)
struct GWEN_GUI GWEN_GUI
Definition: gui.h:176
GWENHYWFAR_API int GWEN_Gui_GetSyncIo(const char *url, const char *defaultProto, int defaultPort, GWEN_SYNCIO **pSio)
GWENHYWFAR_API int GWEN_Gui_KeyDataFromText_OpenSSL(const char *text, unsigned char *buffer, unsigned int bufLength)
#define GWENHYWFAR_API
Definition: gwenhywfarapi.h:67
#define GWEN_DEPRECATED
This file contains sockets and socket sets.
#define GWEN_INHERIT_FUNCTION_LIB_DEFS(t, decl)
Definition: inherit.h:125
struct GWEN_SOCKET_LIST2 GWEN_SOCKET_LIST2
Definition: listdoc.h:4030
GWEN_LOGGER_LEVEL
Definition: logger.h:64
struct GWEN_PASSWD_STORE GWEN_PASSWD_STORE
Definition: passwdstore.h:37
struct GWEN_SSLCERTDESCR GWEN_SSLCERTDESCR
struct GWEN_SYNCIO GWEN_SYNCIO
Definition: syncio.h:40