libxputty  0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
xmessage-dialog.h
Go to the documentation of this file.
1 /*
2  * 0BSD
3  *
4  * BSD Zero Clause License
5  *
6  * Copyright (c) 2019 Hermann Meyer
7  *
8  * Permission to use, copy, modify, and/or distribute this software for any
9  * purpose with or without fee is hereby granted.
10 
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  *
19  */
20 
21 #pragma once
22 
23 #ifndef XMESSAGE_DIALOG_H_
24 #define XMESSAGE_DIALOG_H_
25 
26 #include "xwidgets.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 enum {
39 };
40 
41 typedef struct {
42  int response;
44  unsigned int width;
45  unsigned int height;
46  unsigned int lin;
48  Pixmap *icon;
49  char **message;
50  unsigned int sel;
51  char **choices;
52 } MessageBox;
53 
54 /**
55  * @brief open_message_dialog - open a non blocking dialog window,
56  * lines in message chould be separated by the character "|"
57  * choices for the SELECTION_BOX should be separated as well with the
58  * character "|". message and/or choices could be NULL when not needed.
59  * To fetch the response of a dialog, connect to the dialog_callback
60  * supported "styles" been
61  * \n
62  * INFO_BOX - a message dialog display a info text
63  * \n
64  * WARNING_BOX - a message dialog display a warning
65  * \n
66  * ERROR_BOX - a message dialog display a error message
67  * \n
68  * QUESTION_BOX - a no/yes dialog message
69  * \n
70  * SELECTION_BOX - a dialog to select between multiple options
71  * \n
72  * ENTRY_BOX - a dialog to get text input
73  * @return Widget_t* - pointer to the Widget_t struct
74  */
75 
76 Widget_t *open_message_dialog(Widget_t *w, int style, const char *title,
77  const char *message, const char *choices);
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif //XMESSAGE_DIALOG_H_
QUESTION_BOX
@ QUESTION_BOX
Definition: xmessage-dialog.h:36
MessageBox::message
char ** message
Definition: xmessage-dialog.h:49
xwidgets.h
MessageBox::width
unsigned int width
Definition: xmessage-dialog.h:44
MessageBox::sel
unsigned int sel
Definition: xmessage-dialog.h:50
ERROR_BOX
@ ERROR_BOX
Definition: xmessage-dialog.h:35
WARNING_BOX
@ WARNING_BOX
Definition: xmessage-dialog.h:34
MessageBox
Definition: xmessage-dialog.h:41
INFO_BOX
@ INFO_BOX
Definition: xmessage-dialog.h:33
Widget_t
Widget_t - struct to hold the basic Widget_t info.
Definition: xwidget.h:298
MessageBox::height
unsigned int height
Definition: xmessage-dialog.h:45
MessageBox::choices
char ** choices
Definition: xmessage-dialog.h:51
MessageBox::text_entry
Widget_t * text_entry
Definition: xmessage-dialog.h:47
open_message_dialog
Widget_t * open_message_dialog(Widget_t *w, int style, const char *title, const char *message, const char *choices)
open_message_dialog - open a non blocking dialog window, lines in message chould be separated by the ...
Definition: xmessage-dialog.c:322
ENTRY_BOX
@ ENTRY_BOX
Definition: xmessage-dialog.h:38
MessageBox::response
int response
Definition: xmessage-dialog.h:42
MessageBox::message_type
int message_type
Definition: xmessage-dialog.h:43
MessageBox::lin
unsigned int lin
Definition: xmessage-dialog.h:46
MessageBox::icon
Pixmap * icon
Definition: xmessage-dialog.h:48
SELECTION_BOX
@ SELECTION_BOX
Definition: xmessage-dialog.h:37