gwenhywfar  5.10.1
cgui.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Tue Oct 02 2002
3  copyright : (C) 2002-2017 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 
26 #ifdef HAVE_CONFIG_H
27 # include <config.h>
28 #endif
29 
30 #define DISABLE_DEBUGLOG
31 
32 
33 #include "cgui_p.h"
34 #include "i18n_l.h"
35 
36 #include <gwenhywfar/gui_be.h>
37 #include <gwenhywfar/inherit.h>
38 #include <gwenhywfar/debug.h>
39 #include <gwenhywfar/misc.h>
40 #include <gwenhywfar/db.h>
41 #include <gwenhywfar/gwentime.h>
42 #include <gwenhywfar/mdigest.h>
43 #include <gwenhywfar/text.h>
44 
45 
46 #include <stdlib.h>
47 #include <string.h>
48 #include <ctype.h>
49 #ifdef HAVE_TERMIOS_H
50 # include <termios.h>
51 #endif
52 #include <unistd.h>
53 #include <fcntl.h>
54 #include <stdio.h>
55 #include <errno.h>
56 
57 #ifdef HAVE_SIGNAL_H
58 # include <signal.h>
59 #endif
60 #ifdef HAVE_ICONV_H
61 # include <iconv.h>
62 #endif
63 #ifndef ICONV_CONST
64 # define ICONV_CONST
65 #endif
66 
67 
68 
69 GWEN_INHERIT(GWEN_GUI, GWEN_GUI_CGUI)
70 
71 
72 
73 
75 {
76  GWEN_GUI *gui;
77  GWEN_GUI_CGUI *cgui;
78 
79  gui=GWEN_Gui_new();
80  GWEN_NEW_OBJECT(GWEN_GUI_CGUI, cgui);
81  cgui->progressList=GWEN_Gui_CProgress_List_new();
82  GWEN_INHERIT_SETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui, cgui,
84 
94 
95  return gui;
96 }
97 
98 
99 
101 {
102  GWEN_GUI_CGUI *cgui;
103 
104  cgui=(GWEN_GUI_CGUI *)p;
105  GWEN_Gui_CProgress_List_free(cgui->progressList);
106  GWEN_FREE_OBJECT(cgui);
107 }
108 
109 
110 
112 {
113  int chr;
114 #ifdef HAVE_TERMIOS_H
115  struct termios OldAttr, NewAttr;
116  int AttrChanged = 0;
117 #endif
118 #if HAVE_DECL_SIGPROCMASK
119  sigset_t snew, sold;
120 #endif
121 
122  // disable canonical mode to receive a single character
123 #if HAVE_DECL_SIGPROCMASK
124  sigemptyset(&snew);
125  sigaddset(&snew, SIGINT);
126  sigaddset(&snew, SIGSTOP);
127  sigprocmask(SIG_BLOCK, &snew, &sold);
128 #endif
129 #ifdef HAVE_TERMIOS_H
130  if (0 == tcgetattr(fileno(stdin), &OldAttr)) {
131  NewAttr = OldAttr;
132  NewAttr.c_lflag &= ~ICANON;
133  NewAttr.c_lflag &= ~ECHO;
134  tcsetattr(fileno(stdin), TCSAFLUSH, &NewAttr);
135  AttrChanged = !0;
136  }
137 #endif
138 
139  for (;;) {
140  chr=getchar();
141  if (waitFor) {
142  if (chr==-1 ||
143  chr==GWEN_GUI_CGUI_CHAR_ABORT ||
144  chr==GWEN_GUI_CGUI_CHAR_ENTER ||
145  chr==waitFor)
146  break;
147  }
148  else
149  break;
150  }
151 
152 #ifdef HAVE_TERMIOS_H
153  /* re-enable canonical mode (if previously disabled) */
154  if (AttrChanged)
155  tcsetattr(fileno(stdin), TCSADRAIN, &OldAttr);
156 #endif
157 
158 #if HAVE_DECL_SIGPROCMASK
159  sigprocmask(SIG_BLOCK, &sold, 0);
160 #endif
161 
162  return chr;
163 }
164 
165 
166 
168  uint32_t flags,
169  char *buffer,
170  int minLen,
171  int maxLen,
172  uint32_t guiid)
173 {
174 #ifdef HAVE_TERMIOS_H
175  struct termios OldInAttr, NewInAttr;
176  struct termios OldOutAttr, NewOutAttr;
177  int AttrInChanged = 0;
178  int AttrOutChanged = 0;
179 #endif
180  int chr;
181  unsigned int pos;
182  char *pOutbuf;
183  int rv;
184 #if HAVE_DECL_SIGPROCMASK
185  sigset_t snew, sold;
186 #endif
187 #ifdef HAVE_ICONV
188 #define INBUFSIZE 6
189  char inbuf[INBUFSIZE];
190  iconv_t ic;
191  size_t inLeft;
192  size_t outLeft;
193  size_t done;
194  ICONV_CONST char *pInbuf;
195  const char *wantedCharSet;
196  char *nextchr;
197 
198  wantedCharSet=GWEN_Gui_GetCharSet(gui);
199  if (!wantedCharSet)
200  wantedCharSet="UTF-8";
201  ic=iconv_open("UTF-8", wantedCharSet);
202  if (ic==(iconv_t)-1) {
203  DBG_ERROR(GWEN_LOGDOMAIN, "Cannot convert from \"%s\" to \"UTF-8\", %s",
204  wantedCharSet, strerror(errno));
205  return GWEN_ERROR_GENERIC;
206  }
207 
208  pInbuf=inbuf;
209  outLeft=maxLen;
210 #endif
211 
212  /* if possible, disable echo from stdin to stdout during password
213  * entry */
214 #if HAVE_DECL_SIGPROCMASK
215  sigemptyset(&snew);
216  sigaddset(&snew, SIGINT);
217  sigaddset(&snew, SIGSTOP);
218  sigprocmask(SIG_BLOCK, &snew, &sold);
219 #endif
220 
221 #ifdef HAVE_TERMIOS_H
222  if (0 == tcgetattr(fileno(stdin), &OldInAttr)) {
223  NewInAttr = OldInAttr;
224  NewInAttr.c_lflag &= ~ECHO;
225  NewInAttr.c_lflag &= ~ICANON;
226  tcsetattr(fileno(stdin), TCSAFLUSH, &NewInAttr);
227  AttrInChanged = !0;
228  }
229  if (0 == tcgetattr(fileno(stdout), &OldOutAttr)) {
230  NewOutAttr = OldOutAttr;
231  NewOutAttr.c_lflag &= ~ICANON;
232  tcsetattr(fileno(stdout), TCSAFLUSH, &NewOutAttr);
233  AttrOutChanged = !0;
234  }
235 #endif
236 
237  pos=0;
238  pOutbuf=buffer;
239  for (;;) {
240 #ifdef HAVE_ICONV
241  nextchr=inbuf;
242  pInbuf=inbuf;
243  inLeft=0;
244  outLeft=maxLen-pos;
245  do {
246  chr=getchar();
247  if (chr==EOF)
248  break;
249  *nextchr++=chr;
250  inLeft++;
251  done=iconv(ic, &pInbuf, &inLeft, &pOutbuf, &outLeft);
252  }
253  while (done==(size_t)-1 && errno==EINVAL &&
254  nextchr-inbuf<INBUFSIZE);
255 
256  if (chr==EOF) {
257  DBG_ERROR(GWEN_LOGDOMAIN, "Unexpected EOF while reading from stdin");
259  break;
260  }
261  else if (done==(size_t)-1) {
262  if (errno==E2BIG || errno==EILSEQ) {
263  GWEN_Gui_StdPrintf(gui, stdout, "\007");
264  continue;
265  }
266  DBG_ERROR(GWEN_LOGDOMAIN, "Unrecoverable error in conversion: %s",
267  strerror(errno));
269  break;
270  }
271 #else /* HAVE_ICONV */
272  chr=getchar();
273  if (chr!=EOF)
274  *pOutbuf++=chr;
275  else {
276  DBG_ERROR(GWEN_LOGDOMAIN, "Unexpected EOF while reading from stdin");
278  break;
279  }
280 #endif /* HAVE_ICONV */
281 
282  if (chr==GWEN_GUI_CGUI_CHAR_DELETE) {
283  if (pos) {
284  /* Look for the start of the previous UTF-8 character */
285  do
286  pos--;
287  while ((buffer[pos]&0xC0)==0x80 && pos);
288  GWEN_Gui_StdPrintf(gui, stdout, "%c %c", 8, 8);
289  }
290  pOutbuf=buffer+pos;
291  }
292  else if (chr==GWEN_GUI_CGUI_CHAR_ENTER) {
293  if (minLen && pos<minLen) {
294  if (pos==0 && (flags & GWEN_GUI_INPUT_FLAGS_ALLOW_DEFAULT)) {
298  I18N("Empty Input"),
299  I18N("Your input was empty.\n"
300  "Do you want to use the default?"),
301  I18N("Yes"),
302  I18N("No"),
303  I18N("Abort"), guiid);
304  if (rv==1) {
306  break;
307  }
308  else {
310  break;
311  }
312  }
313  else {
314  /* too few characters */
315  GWEN_Gui_StdPrintf(gui, stdout, "\007");
316  pOutbuf=buffer+pos;
317  }
318  }
319  else {
320  GWEN_Gui_StdPrintf(gui, stdout, "\n");
321  buffer[pos]=0;
322  rv=0;
323  break;
324  }
325  }
326  else if (chr==GWEN_GUI_CGUI_CHAR_ABORT) {
327  DBG_INFO(GWEN_LOGDOMAIN, "User aborted");
329  break;
330  }
331  else if (pOutbuf-buffer<maxLen) {
332  if ((flags & GWEN_GUI_INPUT_FLAGS_NUMERIC) &&
333  !isdigit(chr)) {
334  /* bad character */
335  GWEN_Gui_StdPrintf(gui, stdout, "\007");
336  pOutbuf=buffer+pos;
337  }
338  else {
339  if (flags & GWEN_GUI_INPUT_FLAGS_SHOW) {
340  *pOutbuf=0;
341  GWEN_Gui_StdPrintf(gui, stdout, "%s", buffer+pos);
342  }
343  else
344 #ifndef HAVE_ICONV
345  /* Do not print stars for continuation bytes */
346  if ((chr&0xC0)!=0x80)
347 #endif
348  GWEN_Gui_StdPrintf(gui, stdout, "*");
349  pos=pOutbuf-buffer;
350  }
351  }
352  else {
353  /* buffer full */
354  GWEN_Gui_StdPrintf(gui, stdout, "\007");
355  pOutbuf=buffer+pos;
356  }
357  } /* for */
358 
359 #ifdef HAVE_TERMIOS_H
360  /* re-enable echo (if previously disabled) */
361  if (AttrOutChanged)
362  tcsetattr(fileno(stdout), TCSADRAIN, &OldOutAttr);
363  if (AttrInChanged)
364  tcsetattr(fileno(stdin), TCSADRAIN, &OldInAttr);
365 #endif
366 
367 #if HAVE_DECL_SIGPROCMASK
368  sigprocmask(SIG_BLOCK, &sold, 0);
369 #endif
370 #ifdef HAVE_ICONV
371  iconv_close(ic);
372 #endif
373  return rv;
374 }
375 
376 
377 
379  uint32_t flags,
380  const char *title,
381  const char *text,
382  const char *b1,
383  const char *b2,
384  const char *b3,
385  GWEN_UNUSED uint32_t guiid)
386 {
387  GWEN_BUFFER *tbuf;
388  int c;
389 
390  assert(gui);
391 
392  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
393  GWEN_Gui_GetRawText(gui, text, tbuf);
394 
397  GWEN_Gui_StdPrintf(gui, stdout,
398  "Got the following dangerous message:\n%s\n",
399  GWEN_Buffer_GetStart(tbuf));
400  GWEN_Buffer_free(tbuf);
401  return 0;
402  }
403  else {
405  "Auto-answering the following message with %d:\n%s",
407  GWEN_Buffer_GetStart(tbuf));
408  GWEN_Buffer_free(tbuf);
409  return GWEN_GUI_MSG_FLAGS_CONFIRM_BUTTON(flags);
410  }
411  }
412 
413  GWEN_Gui_StdPrintf(gui, stdout, "===== %s =====\n", title);
414  GWEN_Gui_StdPrintf(gui, stdout, "%s\n", GWEN_Buffer_GetStart(tbuf));
415  GWEN_Buffer_free(tbuf);
416  tbuf=0;
417 
418  if (b1) {
419  GWEN_Gui_StdPrintf(gui, stdout, "(1) %s", b1);
420  if (b2) {
421  GWEN_Gui_StdPrintf(gui, stdout, " (2) %s", b2);
422  if (b3) {
423  GWEN_Gui_StdPrintf(gui, stdout, " (3) %s", b3);
424  }
425  }
426  GWEN_Gui_StdPrintf(gui, stdout, "\n");
427  }
428  GWEN_Gui_StdPrintf(gui, stdout, "Please enter your choice: ");
429  for (;;) {
431  if (c==EOF) {
432  GWEN_Gui_StdPrintf(gui, stdout, "Aborted.\n");
434  }
435  if (!b1 && c==13)
436  return 0;
437  if (c=='1' && b1) {
438  GWEN_Gui_StdPrintf(gui, stdout, "1\n");
439  return 1;
440  }
441  else if (c=='2' && b2) {
442  GWEN_Gui_StdPrintf(gui, stdout, "2\n");
443  return 2;
444  }
445  else if (c=='3' && b3) {
446  GWEN_Gui_StdPrintf(gui, stdout, "3\n");
447  return 3;
448  }
449  else {
450  GWEN_Gui_StdPrintf(gui, stdout, "%c", 7);
451  }
452  } /* for */
453 
454 }
455 
456 
457 
459  uint32_t flags,
460  const char *title,
461  const char *text,
462  char *buffer,
463  int minLen,
464  int maxLen,
465  uint32_t guiid)
466 {
467  int rv;
468  GWEN_BUFFER *tbuf;
469 
470  assert(gui);
471 
473  (flags & GWEN_GUI_INPUT_FLAGS_TAN)) {
474  DBG_ERROR(GWEN_LOGDOMAIN, "No TAN input in non-interactive mode");
476  }
477 
478 
479  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
480  GWEN_Gui_GetRawText(gui, text, tbuf);
481 
482  GWEN_Gui_StdPrintf(gui, stdout, "===== %s =====\n", title);
483  GWEN_Gui_StdPrintf(gui, stdout, "%s\n", GWEN_Buffer_GetStart(tbuf));
484  GWEN_Buffer_free(tbuf);
485  tbuf=0;
486 
487  if (flags & GWEN_GUI_INPUT_FLAGS_CONFIRM) {
488  char *lbuffer=0;
489 
490  lbuffer=(char *)malloc(maxLen);
491  if (!lbuffer) {
492  DBG_ERROR(GWEN_LOGDOMAIN, "Not enough memory for %d bytes", maxLen);
493  return GWEN_ERROR_INVALID;
494  }
495  for (;;) {
496  GWEN_Gui_StdPrintf(gui, stdout, "Input: ");
497  rv=GWEN_Gui_CGui__input(gui, flags, lbuffer, minLen, maxLen, guiid);
498  if (rv) {
499  free(lbuffer);
500  return rv;
501  }
502 
503  GWEN_Gui_StdPrintf(gui, stdout, "Again: ");
504  rv=GWEN_Gui_CGui__input(gui, flags, buffer, minLen, maxLen, guiid);
505  if (rv) {
506  free(lbuffer);
507  return rv;
508  }
509  if (strcmp(lbuffer, buffer)!=0) {
510  GWEN_Gui_StdPrintf(gui, stdout,
511  "ERROR: Entries do not match, please try (again or abort)\n");
512  }
513  else {
514  rv=0;
515  break;
516  }
517 
518  } /* for */
519  free(lbuffer);
520  }
521  else {
522  GWEN_Gui_StdPrintf(gui, stdout, "Input: ");
523  rv=GWEN_Gui_CGui__input(gui, flags, buffer, minLen, maxLen, guiid);
524  }
525 
526  if ((rv==0) && (GWEN_Gui_GetFlags(gui) & GWEN_GUI_FLAGS_PERMPASSWORDS)) {
527  /* if the user allows it (by setting flag GWEN_GUI_FLAGS_PERMPASSWORDS)
528  * return 1, meaning the input may be stored in a permanent password store */
529  return 1;
530  }
531 
532  return rv;
533 }
534 
535 
536 
538  GWEN_UNUSED uint32_t flags,
539  const char *title,
540  const char *text,
541  GWEN_UNUSED uint32_t guiid)
542 {
543  GWEN_GUI_CGUI *cgui;
544  GWEN_BUFFER *tbuf;
545 
546  assert(gui);
547  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
548  assert(cgui);
549 
550  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
551  GWEN_Gui_GetRawText(gui, text, tbuf);
552 
553  GWEN_Gui_StdPrintf(gui, stdout, "===== %s =====\n", title);
554  GWEN_Gui_StdPrintf(gui, stdout, "%s\n", GWEN_Buffer_GetStart(tbuf));
555  GWEN_Buffer_free(tbuf);
556  tbuf=0;
557 
558  return ++(cgui->nextBoxId);
559 }
560 
561 
562 
564 {
565  GWEN_GUI_CGUI *cgui;
566 
567  assert(gui);
568  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
569  assert(cgui);
570 
571  /* nothing to do right now */
572 }
573 
574 
575 
577  uint32_t progressFlags,
578  const char *title,
579  const char *text,
580  uint64_t total,
581  GWEN_UNUSED uint32_t guiid)
582 {
583  GWEN_GUI_CGUI *cgui;
584  GWEN_GUI_CPROGRESS *cp;
585 
586  assert(gui);
587  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
588  assert(cgui);
589 
590  cp=GWEN_Gui_CProgress_new(gui,
591  ++(cgui->nextProgressId),
592  progressFlags,
593  title,
594  text,
595  total);
596  GWEN_Gui_CProgress_List_Insert(cp, cgui->progressList);
597  return GWEN_Gui_CProgress_GetId(cp);
598 }
599 
600 
601 
603 {
604  GWEN_GUI_CGUI *cgui;
605  GWEN_GUI_CPROGRESS *cp;
606 
607  assert(gui);
608  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
609  assert(cgui);
610 
611  cp=GWEN_Gui_CProgress_List_First(cgui->progressList);
612  if (id==0)
613  return cp;
614  while (cp) {
615  if (GWEN_Gui_CProgress_GetId(cp)==id)
616  break;
617  cp=GWEN_Gui_CProgress_List_Next(cp);
618  } /* while */
619 
620  return cp;
621 }
622 
623 
624 
626  uint32_t id,
627  uint64_t progress)
628 {
629  GWEN_GUI_CGUI *cgui;
630  GWEN_GUI_CPROGRESS *cp;
631 
632  assert(gui);
633  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
634  assert(cgui);
635 
636  cp=GWEN_Gui_CGui__findProgress(gui, id);
637  if (!cp) {
638  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
639  return 0;
640  }
641  else {
642  return GWEN_Gui_CProgress_Advance(cp, progress);
643  }
644 }
645 
646 
647 
648 int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total)
649 {
650  GWEN_GUI_CGUI *cgui;
651  GWEN_GUI_CPROGRESS *cp;
652 
653  assert(gui);
654  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
655  assert(cgui);
656 
657  cp=GWEN_Gui_CGui__findProgress(gui, id);
658  if (!cp) {
659  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
660  }
661  else
662  GWEN_Gui_CProgress_SetTotal(cp, total);
663  return 0;
664 }
665 
666 
667 
669  uint32_t id,
670  GWEN_LOGGER_LEVEL level,
671  const char *text)
672 {
673  GWEN_GUI_CGUI *cgui;
674  GWEN_GUI_CPROGRESS *cp;
675 
676  assert(gui);
677  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
678  assert(cgui);
679 
680  cp=GWEN_Gui_CGui__findProgress(gui, id);
681  if (!cp) {
682  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
683  return 0;
684  }
685  else {
686  return GWEN_Gui_CProgress_Log(cp, level, text);
687  }
688 }
689 
690 
691 
693 {
694  GWEN_GUI_CGUI *cgui;
695  GWEN_GUI_CPROGRESS *cp;
696 
697  assert(gui);
698  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
699  assert(cgui);
700 
701  cp=GWEN_Gui_CGui__findProgress(gui, id);
702  if (!cp) {
703  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
704  return 0;
705  }
706  else {
707  int rv;
708 
709  rv=GWEN_Gui_CProgress_End(cp);
710  GWEN_Gui_CProgress_List_Del(cp);
712  return rv;
713  }
714 }
715 
716 
717 
GWEN_GUI_CPROGRESS * GWEN_Gui_CGui__findProgress(GWEN_GUI *gui, uint32_t id)
Definition: cgui.c:602
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
Definition: buffer.c:235
uint32_t GWENHYWFAR_CB GWEN_Gui_CGui_ProgressStart(GWEN_GUI *gui, uint32_t progressFlags, const char *title, const char *text, uint64_t total, GWEN_UNUSED uint32_t guiid)
Definition: cgui.c:576
#define I18N(m)
Definition: error.c:42
uint32_t GWEN_Gui_CProgress_GetId(const GWEN_GUI_CPROGRESS *cp)
Definition: cprogress.c:96
#define GWEN_ERROR_INVALID
Definition: error.h:67
#define GWEN_GUI_MSG_FLAGS_SEVERITY_IS_DANGEROUS(fl)
Definition: gui.h:338
int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressLog(GWEN_GUI *gui, uint32_t id, GWEN_LOGGER_LEVEL level, const char *text)
Definition: cgui.c:668
int GWENHYWFAR_CB GWEN_Gui_CGui_InputBox(GWEN_GUI *gui, uint32_t flags, const char *title, const char *text, char *buffer, int minLen, int maxLen, uint32_t guiid)
Definition: cgui.c:458
#define GWEN_GUI_INPUT_FLAGS_CONFIRM
Definition: gui.h:211
#define GWEN_GUI_FLAGS_NONINTERACTIVE
Definition: gui.h:992
GWEN_LOGGER_LEVEL
Definition: logger.h:64
#define GWEN_GUI_INPUT_FLAGS_ALLOW_DEFAULT
Definition: gui.h:220
int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui, uint32_t id)
Definition: cgui.c:692
GWENHYWFAR_API int GWEN_Gui_StdPrintf(const GWEN_GUI *gui, FILE *stream, const char *fmt,...) GWEN_FORMAT(printf
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:61
#define GWEN_GUI_FLAGS_PERMPASSWORDS
Definition: gui.h:998
#define GWEN_GUI_INPUT_FLAGS_NUMERIC
Definition: gui.h:215
#define GWEN_LOGDOMAIN
Definition: logger.h:35
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)
Definition: gui_virtual.c:342
char GWEN_Gui_CGui__readCharFromStdin(int waitFor)
Definition: cgui.c:111
int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressAdvance(GWEN_GUI *gui, uint32_t id, uint64_t progress)
Definition: cgui.c:625
void GWENHYWFAR_CB GWEN_Gui_CGui_FreeData(GWEN_UNUSED void *bp, void *p)
Definition: cgui.c:100
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
Definition: buffer.c:42
GWENHYWFAR_API GWEN_GUI_SHOWBOX_FN GWEN_Gui_SetShowBoxFn(GWEN_GUI *gui, GWEN_GUI_SHOWBOX_FN f)
Definition: gui_virtual.c:55
#define GWEN_GUI_MSG_FLAGS_TYPE_INFO
Definition: gui.h:281
int GWEN_Gui_CProgress_End(GWEN_GUI_CPROGRESS *cp)
Definition: cprogress.c:272
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:55
#define GWEN_GUI_MSG_FLAGS_CONFIRM_BUTTON(fl)
Definition: gui.h:305
#define GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS
Definition: gui.h:337
GWENHYWFAR_API GWEN_GUI_PROGRESS_START_FN GWEN_Gui_SetProgressStartFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_START_FN f)
Definition: gui_virtual.c:81
GWEN_GUI_CPROGRESS * GWEN_Gui_CProgress_new(GWEN_GUI *gui, uint32_t id, uint32_t progressFlags, const char *title, const char *text, uint64_t total)
Definition: cprogress.c:28
#define GWENHYWFAR_CB
Definition: gwenhywfarapi.h:89
#define DBG_DEBUG(dbg_logger, format, args...)
Definition: debug.h:214
#define GWEN_GUI_INPUT_FLAGS_TAN
Definition: gui.h:222
#define GWEN_ERROR_GENERIC
Definition: error.h:62
int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total)
Definition: cgui.c:648
int GWEN_Gui_CProgress_Log(GWEN_GUI_CPROGRESS *cp, GWEN_LOGGER_LEVEL level, const char *text)
Definition: cprogress.c:239
void GWEN_Buffer_free(GWEN_BUFFER *bf)
Definition: buffer.c:89
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:38
void GWENHYWFAR_CB GWEN_Gui_CGui_HideBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t id)
Definition: cgui.c:563
#define GWEN_ERROR_DEFAULT_VALUE
Definition: error.h:117
int GWEN_Gui_CGui__input(GWEN_UNUSED GWEN_GUI *gui, uint32_t flags, char *buffer, int minLen, int maxLen, uint32_t guiid)
Definition: cgui.c:167
GWENHYWFAR_API GWEN_GUI_PROGRESS_LOG_FN GWEN_Gui_SetProgressLogFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_LOG_FN f)
Definition: gui_virtual.c:117
#define DBG_ERROR(dbg_logger, format, args...)
Definition: debug.h:97
#define GWEN_GUI_INPUT_FLAGS_SHOW
Definition: gui.h:213
int GWEN_Gui_CProgress_Advance(GWEN_GUI_CPROGRESS *cp, uint64_t progress)
Definition: cprogress.c:164
GWENHYWFAR_API GWEN_GUI_PROGRESS_ADVANCE_FN GWEN_Gui_SetProgressAdvanceFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_ADVANCE_FN f)
Definition: gui_virtual.c:93
GWEN_GUI * GWEN_Gui_new(void)
Definition: gui.c:99
#define GWEN_GUI_MSG_FLAGS_CONFIRM_B1
Definition: gui.h:299
GWENHYWFAR_API GWEN_GUI_INPUTBOX_FN GWEN_Gui_SetInputBoxFn(GWEN_GUI *gui, GWEN_GUI_INPUTBOX_FN f)
Definition: gui_virtual.c:42
#define ICONV_CONST
Definition: cgui.c:64
#define DBG_INFO(dbg_logger, format, args...)
Definition: debug.h:181
struct GWEN_GUI GWEN_GUI
Definition: gui.h:176
void GWEN_Gui_CProgress_SetTotal(GWEN_GUI_CPROGRESS *cp, uint64_t i)
Definition: cprogress.c:128
GWENHYWFAR_API GWEN_GUI_HIDEBOX_FN GWEN_Gui_SetHideBoxFn(GWEN_GUI *gui, GWEN_GUI_HIDEBOX_FN f)
Definition: gui_virtual.c:68
struct GWEN_GUI_CPROGRESS GWEN_GUI_CPROGRESS
Definition: cprogress_l.h:14
#define GWEN_INHERIT(bt, t)
Definition: inherit.h:264
void GWEN_Gui_CProgress_free(GWEN_GUI_CPROGRESS *cp)
Definition: cprogress.c:75
GWENHYWFAR_API GWEN_GUI_PROGRESS_END_FN GWEN_Gui_SetProgressEndFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_END_FN f)
Definition: gui_virtual.c:129
#define GWEN_ERROR_USER_ABORTED
Definition: error.h:65
GWENHYWFAR_API int GWENHYWFAR_API void GWEN_Gui_GetRawText(const GWEN_GUI *gui, const char *text, GWEN_BUFFER *tbuf)
#define GWEN_INHERIT_SETDATA(bt, t, element, data, fn)
Definition: inherit.h:292
GWEN_GUI * GWEN_Gui_CGui_new(void)
Definition: cgui.c:74
uint32_t GWEN_Gui_GetFlags(const GWEN_GUI *gui)
Definition: gui.c:195
GWENHYWFAR_API GWEN_GUI_PROGRESS_SETTOTAL_FN GWEN_Gui_SetProgressSetTotalFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_SETTOTAL_FN f)
Definition: gui_virtual.c:105
GWENHYWFAR_API GWEN_GUI_MESSAGEBOX_FN GWEN_Gui_SetMessageBoxFn(GWEN_GUI *gui, GWEN_GUI_MESSAGEBOX_FN f)
Definition: gui_virtual.c:29
#define GWEN_UNUSED
uint32_t GWENHYWFAR_CB GWEN_Gui_CGui_ShowBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t flags, const char *title, const char *text, GWEN_UNUSED uint32_t guiid)
Definition: cgui.c:537
const char * GWEN_Gui_GetCharSet(const GWEN_GUI *gui)
Definition: gui.c:250
#define GWEN_INHERIT_GETDATA(bt, t, element)
Definition: inherit.h:271
int GWENHYWFAR_CB GWEN_Gui_CGui_MessageBox(GWEN_GUI *gui, uint32_t flags, const char *title, const char *text, const char *b1, const char *b2, const char *b3, GWEN_UNUSED uint32_t guiid)
Definition: cgui.c:378