naev 0.12.5
dialogue.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
6#include "SDL_events.h"
7
8#include "nstring.h"
9
10/*
11 * popups and alerts
12 */
13/* Alert. */
14PRINTF_FORMAT( 1, 2 )
15void dialogue_alert( const char *fmt, ... ); /* does not pause execution */
16void dialogue_alertRaw( const char *msg ); /* does not pause execution */
17/* Message. */
18PRINTF_FORMAT( 2, 3 )
19void dialogue_msg( const char *caption, const char *fmt, ... );
20void dialogue_msgRaw( const char *caption, const char *msg );
21/* Image. */
22PRINTF_FORMAT( 3, 4 )
23void dialogue_msgImg( const char *caption, const char *img, const char *fmt,
24 ... );
25void dialogue_msgImgRaw( const char *caption, const char *msg, const char *img,
26 int width, int height );
27/* YesNo. */
28PRINTF_FORMAT( 2, 3 )
29int dialogue_YesNo( const char *caption, const char *fmt,
30 ... ); /* Yes = 1, No = 0 */
31int dialogue_YesNoRaw( const char *caption, const char *msg );
32/* Input. */
33PRINTF_FORMAT( 4, 5 )
34char *dialogue_input( const char *title, int min, int max, const char *fmt,
35 ... );
36char *dialogue_inputRaw( const char *title, int min, int max, const char *msg );
37
38/*
39 * Choice dialogues.
40 */
41void dialogue_makeChoice( const char *caption, const char *msg, int opts );
42void dialogue_addChoice( const char *caption, const char *msg,
43 const char *opt );
44char *dialogue_runChoice( void );
45
46/*
47 * Lists.
48 */
49PRINTF_FORMAT( 4, 5 )
50int dialogue_list( const char *title, char **items, int nitems, const char *fmt,
51 ... );
52int dialogue_listRaw( const char *title, char **items, int nitems,
53 const char *msg );
54PRINTF_FORMAT( 8, 9 )
56 const char *title, char **items, int nitems, int extrawidth, int minheight,
57 void ( *add_widgets )( unsigned int wid, int x, int y, int w, int h ),
58 void ( *select_call )( unsigned int wid, const char *wgtname, int x, int y,
59 int w, int h ),
60 const char *fmt, ... );
62 const char *title, char **items, int nitems, int extrawidth, int minheight,
63 void ( *add_widgets )( unsigned int wid, int x, int y, int w, int h ),
64 void ( *select_call )( unsigned int wid, const char *wgtname, int x, int y,
65 int w, int h ),
66 const char *msg );
67
68/*
69 * Custom.
70 */
72 const char *wdwname, const char *caption, int width, int height,
73 int ( *update )( double dt, void *data ),
74 void ( *render )( double x, double y, double w, double h, void *data ),
75 int ( *event )( unsigned int wid, SDL_Event *event, void *data ), void *data,
76 int dynamic, void ( *freefunc )( void *data ) );
77int dialogue_customFullscreen( unsigned int wid, int enable );
78int dialogue_customResize( unsigned int wid, int width, int height );
79
80/*
81 * misc
82 */
83int dialogue_isOpen( void );
char * dialogue_runChoice(void)
Run the dialog and return the clicked string.
Definition dialogue.c:817
char * dialogue_inputRaw(const char *title, int min, int max, const char *msg)
Creates a dialogue that allows the player to write a message.
Definition dialogue.c:470
void dialogue_alert(const char *fmt,...)
Displays an alert popup with only an ok button and a message.
Definition dialogue.c:130
void dialogue_custom(const char *wdwname, const char *caption, int width, int height, int(*update)(double dt, void *data), void(*render)(double x, double y, double w, double h, void *data), int(*event)(unsigned int wid, SDL_Event *event, void *data), void *data, int dynamic, void(*freefunc)(void *data))
Opens a custom dialogue window.
Definition dialogue.c:890
int dialogue_customFullscreen(unsigned int wid, int enable)
Converts a custom dialogue to fullscreen.
Definition dialogue.c:956
int dialogue_listPanelRaw(const char *title, char **items, int nitems, int extrawidth, int minheight, void(*add_widgets)(unsigned int wid, int x, int y, int w, int h), void(*select_call)(unsigned int wid, const char *wgtname, int x, int y, int w, int h), const char *msg)
Creates a list dialogue with OK and Cancel buttons, with a fixed message, as well as a small extra ar...
Definition dialogue.c:681
char * dialogue_input(const char *title, int min, int max, const char *fmt,...)
Creates a dialogue that allows the player to write a message.
Definition dialogue.c:441
int dialogue_listRaw(const char *title, char **items, int nitems, const char *msg)
Creates a list dialogue with OK and Cancel button.
Definition dialogue.c:614
int dialogue_YesNoRaw(const char *caption, const char *msg)
Runs a dialogue with both yes and no options.
Definition dialogue.c:373
int dialogue_listPanel(const char *title, char **items, int nitems, int extrawidth, int minheight, void(*add_widgets)(unsigned int wid, int x, int y, int w, int h), void(*select_call)(unsigned int wid, const char *wgtname, int x, int y, int w, int h), const char *fmt,...)
Creates a list dialogue with OK and Cancel buttons, with a fixed message, as well as a small extra ar...
Definition dialogue.c:639
int dialogue_customResize(unsigned int wid, int width, int height)
Resizes a custom dialogue.
Definition dialogue.c:992
void dialogue_msg(const char *caption, const char *fmt,...)
Opens a dialogue window with an ok button and a message.
Definition dialogue.c:227
int dialogue_list(const char *title, char **items, int nitems, const char *fmt,...)
Creates a list dialogue with OK and Cancel button with a fixed message.
Definition dialogue.c:588
void dialogue_addChoice(const char *caption, const char *msg, const char *opt)
Add a choice to the dialog.
Definition dialogue.c:796
void dialogue_alertRaw(const char *msg)
Displays an alert popup with only an ok button and a message.
Definition dialogue.c:149
void dialogue_msgImgRaw(const char *caption, const char *msg, const char *img, int width, int height)
Opens a dialogue window with an ok button, a fixed message and an image.
Definition dialogue.c:296
void dialogue_makeChoice(const char *caption, const char *msg, int opts)
Create the choice dialog. Need to add choices with below method.
Definition dialogue.c:773
void dialogue_msgRaw(const char *caption, const char *msg)
Opens a dialogue window with an ok button and a fixed message.
Definition dialogue.c:269
int dialogue_isOpen(void)
Checks to see if a dialogue is open.
Definition dialogue.c:96
int dialogue_YesNo(const char *caption, const char *fmt,...)
Runs a dialogue with both yes and no options.
Definition dialogue.c:352
void dialogue_msgImg(const char *caption, const char *img, const char *fmt,...)
Opens a dialogue window with an ok button, a message and an image.
Definition dialogue.c:248