gwenhywfar  5.3.0
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  char *nextchr;
196 
197  nextchr=(char *)GWEN_Gui_GetCharSet(gui);
198  if (!nextchr)
199  nextchr="UTF-8";
200  ic=iconv_open("UTF-8", nextchr);
201  if (ic==(iconv_t)-1) {
202  DBG_ERROR(GWEN_LOGDOMAIN, "Cannot convert from \"%s\" to \"UTF-8\", %s",
203  nextchr, strerror(errno));
204  return GWEN_ERROR_GENERIC;
205  }
206 
207  pInbuf=inbuf;
208  outLeft=maxLen;
209 #endif
210 
211  /* if possible, disable echo from stdin to stdout during password
212  * entry */
213 #if HAVE_DECL_SIGPROCMASK
214  sigemptyset(&snew);
215  sigaddset(&snew, SIGINT);
216  sigaddset(&snew, SIGSTOP);
217  sigprocmask(SIG_BLOCK, &snew, &sold);
218 #endif
219 
220 #ifdef HAVE_TERMIOS_H
221  if (0 == tcgetattr(fileno(stdin), &OldInAttr)) {
222  NewInAttr = OldInAttr;
223  NewInAttr.c_lflag &= ~ECHO;
224  NewInAttr.c_lflag &= ~ICANON;
225  tcsetattr(fileno(stdin), TCSAFLUSH, &NewInAttr);
226  AttrInChanged = !0;
227  }
228  if (0 == tcgetattr(fileno(stdout), &OldOutAttr)) {
229  NewOutAttr = OldOutAttr;
230  NewOutAttr.c_lflag &= ~ICANON;
231  tcsetattr(fileno(stdout), TCSAFLUSH, &NewOutAttr);
232  AttrOutChanged = !0;
233  }
234 #endif
235 
236  pos=0;
237  pOutbuf=buffer;
238  for (;;) {
239 #ifdef HAVE_ICONV
240  nextchr=inbuf;
241  pInbuf=inbuf;
242  inLeft=0;
243  outLeft=maxLen-pos;
244  do {
245  chr=getchar();
246  if (chr==EOF)
247  break;
248  *nextchr++=chr;
249  inLeft++;
250  done=iconv(ic, &pInbuf, &inLeft, &pOutbuf, &outLeft);
251  }
252  while (done==(size_t)-1 && errno==EINVAL &&
253  nextchr-inbuf<INBUFSIZE);
254 
255  if (chr==EOF) {
256  DBG_ERROR(GWEN_LOGDOMAIN, "Unexpected EOF while reading from stdin");
258  break;
259  }
260  else if (done==(size_t)-1) {
261  if (errno==E2BIG || errno==EILSEQ) {
262  GWEN_Gui_StdPrintf(gui, stdout, "\007");
263  continue;
264  }
265  DBG_ERROR(GWEN_LOGDOMAIN, "Unrecoverable error in conversion: %s",
266  strerror(errno));
268  break;
269  }
270 #else /* HAVE_ICONV */
271  chr=getchar();
272  if (chr!=EOF)
273  *pOutbuf++=chr;
274  else {
275  DBG_ERROR(GWEN_LOGDOMAIN, "Unexpected EOF while reading from stdin");
277  break;
278  }
279 #endif /* HAVE_ICONV */
280 
281  if (chr==GWEN_GUI_CGUI_CHAR_DELETE) {
282  if (pos) {
283  /* Look for the start of the previous UTF-8 character */
284  do
285  pos--;
286  while ((buffer[pos]&0xC0)==0x80 && pos);
287  GWEN_Gui_StdPrintf(gui, stdout, "%c %c", 8, 8);
288  }
289  pOutbuf=buffer+pos;
290  }
291  else if (chr==GWEN_GUI_CGUI_CHAR_ENTER) {
292  if (minLen && pos<minLen) {
293  if (pos==0 && (flags & GWEN_GUI_INPUT_FLAGS_ALLOW_DEFAULT)) {
297  I18N("Empty Input"),
298  I18N("Your input was empty.\n"
299  "Do you want to use the default?"),
300  I18N("Yes"),
301  I18N("No"),
302  I18N("Abort"), guiid);
303  if (rv==1) {
305  break;
306  }
307  else {
309  break;
310  }
311  }
312  else {
313  /* too few characters */
314  GWEN_Gui_StdPrintf(gui, stdout, "\007");
315  pOutbuf=buffer+pos;
316  }
317  }
318  else {
319  GWEN_Gui_StdPrintf(gui, stdout, "\n");
320  buffer[pos]=0;
321  rv=0;
322  break;
323  }
324  }
325  else if (chr==GWEN_GUI_CGUI_CHAR_ABORT) {
326  DBG_INFO(GWEN_LOGDOMAIN, "User aborted");
328  break;
329  }
330  else if (pOutbuf-buffer<maxLen) {
331  if ((flags & GWEN_GUI_INPUT_FLAGS_NUMERIC) &&
332  !isdigit(chr)) {
333  /* bad character */
334  GWEN_Gui_StdPrintf(gui, stdout, "\007");
335  pOutbuf=buffer+pos;
336  }
337  else {
338  if (flags & GWEN_GUI_INPUT_FLAGS_SHOW) {
339  *pOutbuf=0;
340  GWEN_Gui_StdPrintf(gui, stdout, "%s", buffer+pos);
341  }
342  else
343 #ifndef HAVE_ICONV
344  /* Do not print stars for continuation bytes */
345  if ((chr&0xC0)!=0x80)
346 #endif
347  GWEN_Gui_StdPrintf(gui, stdout, "*");
348  pos=pOutbuf-buffer;
349  }
350  }
351  else {
352  /* buffer full */
353  GWEN_Gui_StdPrintf(gui, stdout, "\007");
354  pOutbuf=buffer+pos;
355  }
356  } /* for */
357 
358 #ifdef HAVE_TERMIOS_H
359  /* re-enable echo (if previously disabled) */
360  if (AttrOutChanged)
361  tcsetattr(fileno(stdout), TCSADRAIN, &OldOutAttr);
362  if (AttrInChanged)
363  tcsetattr(fileno(stdin), TCSADRAIN, &OldInAttr);
364 #endif
365 
366 #if HAVE_DECL_SIGPROCMASK
367  sigprocmask(SIG_BLOCK, &sold, 0);
368 #endif
369 #ifdef HAVE_ICONV
370  iconv_close(ic);
371 #endif
372  return rv;
373 }
374 
375 
376 
378  uint32_t flags,
379  const char *title,
380  const char *text,
381  const char *b1,
382  const char *b2,
383  const char *b3,
384  GWEN_UNUSED uint32_t guiid)
385 {
386  GWEN_BUFFER *tbuf;
387  int c;
388 
389  assert(gui);
390 
391  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
392  GWEN_Gui_GetRawText(gui, text, tbuf);
393 
396  GWEN_Gui_StdPrintf(gui, stdout,
397  "Got the following dangerous message:\n%s\n",
398  GWEN_Buffer_GetStart(tbuf));
399  GWEN_Buffer_free(tbuf);
400  return 0;
401  }
402  else {
404  "Auto-answering the following message with %d:\n%s",
406  GWEN_Buffer_GetStart(tbuf));
407  GWEN_Buffer_free(tbuf);
408  return GWEN_GUI_MSG_FLAGS_CONFIRM_BUTTON(flags);
409  }
410  }
411 
412  GWEN_Gui_StdPrintf(gui, stdout, "===== %s =====\n", title);
413  GWEN_Gui_StdPrintf(gui, stdout, "%s\n", GWEN_Buffer_GetStart(tbuf));
414  GWEN_Buffer_free(tbuf);
415  tbuf=0;
416 
417  if (b1) {
418  GWEN_Gui_StdPrintf(gui, stdout, "(1) %s", b1);
419  if (b2) {
420  GWEN_Gui_StdPrintf(gui, stdout, " (2) %s", b2);
421  if (b3) {
422  GWEN_Gui_StdPrintf(gui, stdout, " (3) %s", b3);
423  }
424  }
425  GWEN_Gui_StdPrintf(gui, stdout, "\n");
426  }
427  GWEN_Gui_StdPrintf(gui, stdout, "Please enter your choice: ");
428  for (;;) {
430  if (c==EOF) {
431  GWEN_Gui_StdPrintf(gui, stdout, "Aborted.\n");
433  }
434  if (!b1 && c==13)
435  return 0;
436  if (c=='1' && b1) {
437  GWEN_Gui_StdPrintf(gui, stdout, "1\n");
438  return 1;
439  }
440  else if (c=='2' && b2) {
441  GWEN_Gui_StdPrintf(gui, stdout, "2\n");
442  return 2;
443  }
444  else if (c=='3' && b3) {
445  GWEN_Gui_StdPrintf(gui, stdout, "3\n");
446  return 3;
447  }
448  else {
449  GWEN_Gui_StdPrintf(gui, stdout, "%c", 7);
450  }
451  } /* for */
452 
453 }
454 
455 
456 
458  uint32_t flags,
459  const char *title,
460  const char *text,
461  char *buffer,
462  int minLen,
463  int maxLen,
464  uint32_t guiid)
465 {
466  int rv;
467  GWEN_BUFFER *tbuf;
468 
469  assert(gui);
470  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
471  GWEN_Gui_GetRawText(gui, text, tbuf);
472 
473  GWEN_Gui_StdPrintf(gui, stdout, "===== %s =====\n", title);
474  GWEN_Gui_StdPrintf(gui, stdout, "%s\n", GWEN_Buffer_GetStart(tbuf));
475  GWEN_Buffer_free(tbuf);
476  tbuf=0;
477 
478  if (flags & GWEN_GUI_INPUT_FLAGS_CONFIRM) {
479  char *lbuffer=0;
480 
481  lbuffer=(char *)malloc(maxLen);
482  if (!lbuffer) {
483  DBG_ERROR(GWEN_LOGDOMAIN, "Not enough memory for %d bytes", maxLen);
484  return GWEN_ERROR_INVALID;
485  }
486  for (;;) {
487  GWEN_Gui_StdPrintf(gui, stdout, "Input: ");
488  rv=GWEN_Gui_CGui__input(gui, flags, lbuffer, minLen, maxLen, guiid);
489  if (rv) {
490  free(lbuffer);
491  return rv;
492  }
493 
494  GWEN_Gui_StdPrintf(gui, stdout, "Again: ");
495  rv=GWEN_Gui_CGui__input(gui, flags, buffer, minLen, maxLen, guiid);
496  if (rv) {
497  free(lbuffer);
498  return rv;
499  }
500  if (strcmp(lbuffer, buffer)!=0) {
501  GWEN_Gui_StdPrintf(gui, stdout,
502  "ERROR: Entries do not match, please try (again or abort)\n");
503  }
504  else {
505  rv=0;
506  break;
507  }
508 
509  } /* for */
510  free(lbuffer);
511  }
512  else {
513  GWEN_Gui_StdPrintf(gui, stdout, "Input: ");
514  rv=GWEN_Gui_CGui__input(gui, flags, buffer, minLen, maxLen, guiid);
515  }
516 
517  if ((rv==0) && (GWEN_Gui_GetFlags(gui) & GWEN_GUI_FLAGS_PERMPASSWORDS)) {
518  /* if the user allows it (by setting flag GWEN_GUI_FLAGS_PERMPASSWORDS)
519  * return 1, meaning the input may be stored in a permanent password store */
520  return 1;
521  }
522 
523  return rv;
524 }
525 
526 
527 
529  GWEN_UNUSED uint32_t flags,
530  const char *title,
531  const char *text,
532  GWEN_UNUSED uint32_t guiid)
533 {
534  GWEN_GUI_CGUI *cgui;
535  GWEN_BUFFER *tbuf;
536 
537  assert(gui);
538  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
539  assert(cgui);
540 
541  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
542  GWEN_Gui_GetRawText(gui, text, tbuf);
543 
544  GWEN_Gui_StdPrintf(gui, stdout, "===== %s =====\n", title);
545  GWEN_Gui_StdPrintf(gui, stdout, "%s\n", GWEN_Buffer_GetStart(tbuf));
546  GWEN_Buffer_free(tbuf);
547  tbuf=0;
548 
549  return ++(cgui->nextBoxId);
550 }
551 
552 
553 
555 {
556  GWEN_GUI_CGUI *cgui;
557 
558  assert(gui);
559  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
560  assert(cgui);
561 
562  /* nothing to do right now */
563 }
564 
565 
566 
568  uint32_t progressFlags,
569  const char *title,
570  const char *text,
571  uint64_t total,
572  GWEN_UNUSED uint32_t guiid)
573 {
574  GWEN_GUI_CGUI *cgui;
575  GWEN_GUI_CPROGRESS *cp;
576 
577  assert(gui);
578  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
579  assert(cgui);
580 
581  cp=GWEN_Gui_CProgress_new(gui,
582  ++(cgui->nextProgressId),
583  progressFlags,
584  title,
585  text,
586  total);
587  GWEN_Gui_CProgress_List_Insert(cp, cgui->progressList);
588  return GWEN_Gui_CProgress_GetId(cp);
589 }
590 
591 
592 
594 {
595  GWEN_GUI_CGUI *cgui;
596  GWEN_GUI_CPROGRESS *cp;
597 
598  assert(gui);
599  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
600  assert(cgui);
601 
602  cp=GWEN_Gui_CProgress_List_First(cgui->progressList);
603  if (id==0)
604  return cp;
605  while (cp) {
606  if (GWEN_Gui_CProgress_GetId(cp)==id)
607  break;
608  cp=GWEN_Gui_CProgress_List_Next(cp);
609  } /* while */
610 
611  return cp;
612 }
613 
614 
615 
617  uint32_t id,
618  uint64_t progress)
619 {
620  GWEN_GUI_CGUI *cgui;
621  GWEN_GUI_CPROGRESS *cp;
622 
623  assert(gui);
624  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
625  assert(cgui);
626 
627  cp=GWEN_Gui_CGui__findProgress(gui, id);
628  if (!cp) {
629  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
630  return 0;
631  }
632  else {
633  return GWEN_Gui_CProgress_Advance(cp, progress);
634  }
635 }
636 
637 
638 
639 int GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total)
640 {
641  GWEN_GUI_CGUI *cgui;
642  GWEN_GUI_CPROGRESS *cp;
643 
644  assert(gui);
645  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
646  assert(cgui);
647 
648  cp=GWEN_Gui_CGui__findProgress(gui, id);
649  if (!cp) {
650  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
651  }
652  else
653  GWEN_Gui_CProgress_SetTotal(cp, total);
654  return 0;
655 }
656 
657 
658 
660  uint32_t id,
661  GWEN_LOGGER_LEVEL level,
662  const char *text)
663 {
664  GWEN_GUI_CGUI *cgui;
665  GWEN_GUI_CPROGRESS *cp;
666 
667  assert(gui);
668  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
669  assert(cgui);
670 
671  cp=GWEN_Gui_CGui__findProgress(gui, id);
672  if (!cp) {
673  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
674  return 0;
675  }
676  else {
677  return GWEN_Gui_CProgress_Log(cp, level, text);
678  }
679 }
680 
681 
682 
683 int GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui, uint32_t id)
684 {
685  GWEN_GUI_CGUI *cgui;
686  GWEN_GUI_CPROGRESS *cp;
687 
688  assert(gui);
689  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
690  assert(cgui);
691 
692  cp=GWEN_Gui_CGui__findProgress(gui, id);
693  if (!cp) {
694  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
695  return 0;
696  }
697  else {
698  int rv;
699 
700  rv=GWEN_Gui_CProgress_End(cp);
701  GWEN_Gui_CProgress_List_Del(cp);
703  return rv;
704  }
705 }
706 
707 
708 
GWEN_GUI_CPROGRESS * GWEN_Gui_CGui__findProgress(GWEN_GUI *gui, uint32_t id)
Definition: cgui.c:593
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
Definition: buffer.c:235
#define I18N(m)
Definition: error.c:42
GWEN_GUI_PROGRESS_END_FN GWEN_Gui_SetProgressEndFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_END_FN f)
Definition: gui.c:489
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
GWEN_GUI_PROGRESS_LOG_FN GWEN_Gui_SetProgressLogFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_LOG_FN f)
Definition: gui.c:477
#define GWEN_GUI_INPUT_FLAGS_CONFIRM
Definition: gui.h:211
GWEN_GUI_HIDEBOX_FN GWEN_Gui_SetHideBoxFn(GWEN_GUI *gui, GWEN_GUI_HIDEBOX_FN f)
Definition: gui.c:428
#define GWEN_GUI_FLAGS_NONINTERACTIVE
Definition: gui.h:986
int GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total)
Definition: cgui.c:639
GWEN_LOGGER_LEVEL
Definition: logger.h:64
#define GWEN_GUI_INPUT_FLAGS_ALLOW_DEFAULT
Definition: gui.h:220
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:61
#define GWEN_GUI_FLAGS_PERMPASSWORDS
Definition: gui.h:992
#define GWEN_GUI_INPUT_FLAGS_NUMERIC
Definition: gui.h:215
#define GWEN_LOGDOMAIN
Definition: logger.h:35
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.c:875
char GWEN_Gui_CGui__readCharFromStdin(int waitFor)
Definition: cgui.c:111
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
#define GWEN_GUI_MSG_FLAGS_TYPE_INFO
Definition: gui.h:281
int GWEN_Gui_CProgress_End(GWEN_GUI_CPROGRESS *cp)
Definition: cprogress.c:272
int GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui, uint32_t id)
Definition: cgui.c:683
GWEN_GUI_PROGRESS_SETTOTAL_FN GWEN_Gui_SetProgressSetTotalFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_SETTOTAL_FN f)
Definition: gui.c:465
#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
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
uint32_t 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:567
#define GWENHYWFAR_CB
Definition: gwenhywfarapi.h:89
#define DBG_DEBUG(dbg_logger, format, args...)
Definition: debug.h:209
int GWEN_Gui_CGui_ProgressAdvance(GWEN_GUI *gui, uint32_t id, uint64_t progress)
Definition: cgui.c:616
GWEN_GUI_MESSAGEBOX_FN GWEN_Gui_SetMessageBoxFn(GWEN_GUI *gui, GWEN_GUI_MESSAGEBOX_FN f)
Definition: gui.c:389
int 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:457
GWEN_GUI_PROGRESS_START_FN GWEN_Gui_SetProgressStartFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_START_FN f)
Definition: gui.c:441
#define GWEN_ERROR_GENERIC
Definition: error.h:62
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
#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
void GWEN_Gui_CGui_HideBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t id)
Definition: cgui.c:554
GWEN_GUI_SHOWBOX_FN GWEN_Gui_SetShowBoxFn(GWEN_GUI *gui, GWEN_GUI_SHOWBOX_FN f)
Definition: gui.c:415
int GWEN_Gui_CGui_ProgressLog(GWEN_GUI *gui, uint32_t id, GWEN_LOGGER_LEVEL level, const char *text)
Definition: cgui.c:659
#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
GWEN_GUI * GWEN_Gui_new(void)
Definition: gui.c:78
void GWEN_Gui_GetRawText(GWEN_UNUSED const GWEN_GUI *gui, const char *text, GWEN_BUFFER *tbuf)
Definition: gui.c:353
#define GWEN_GUI_MSG_FLAGS_CONFIRM_B1
Definition: gui.h:299
#define ICONV_CONST
Definition: cgui.c:64
GWEN_GUI_INPUTBOX_FN GWEN_Gui_SetInputBoxFn(GWEN_GUI *gui, GWEN_GUI_INPUTBOX_FN f)
Definition: gui.c:402
#define DBG_INFO(dbg_logger, format, args...)
Definition: debug.h:178
uint32_t 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:528
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
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
#define GWEN_ERROR_USER_ABORTED
Definition: error.h:65
int GWEN_Gui_StdPrintf(const GWEN_GUI *gui, FILE *stream, const char *fmt,...)
Definition: gui.c:259
#define GWEN_INHERIT_SETDATA(bt, t, element, data, fn)
Definition: inherit.h:292
GWEN_GUI * GWEN_Gui_CGui_new(void)
Definition: cgui.c:74
int 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:377
uint32_t GWEN_Gui_GetFlags(const GWEN_GUI *gui)
Definition: gui.c:700
GWEN_GUI_PROGRESS_ADVANCE_FN GWEN_Gui_SetProgressAdvanceFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_ADVANCE_FN f)
Definition: gui.c:453
#define GWEN_UNUSED
const char * GWEN_Gui_GetCharSet(const GWEN_GUI *gui)
Definition: gui.c:752
#define GWEN_INHERIT_GETDATA(bt, t, element)
Definition: inherit.h:271