naev 0.10.4
dialogue.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
6#include "nstring.h"
7
8/*
9 * popups and alerts
10 */
11/* Alert. */
12PRINTF_FORMAT( 1, 2 ) void dialogue_alert( const char *fmt, ... ); /* does not pause execution */
13/* Message. */
14PRINTF_FORMAT( 2, 3 ) void dialogue_msg( const char *caption, const char *fmt, ... );
15void dialogue_msgRaw( const char *caption, const char *msg );
16/* Image. */
17PRINTF_FORMAT( 3, 4 ) void dialogue_msgImg( const char *caption, const char *img, const char *fmt, ... );
18void dialogue_msgImgRaw( const char *caption, const char *msg, const char *img, int width, int height );
19/* YesNo. */
20PRINTF_FORMAT( 2, 3 ) int dialogue_YesNo( const char *caption, const char *fmt, ... ); /* Yes = 1, No = 0 */
21int dialogue_YesNoRaw( const char *caption, const char *msg );
22/* Input. */
23PRINTF_FORMAT( 4, 5 ) char* dialogue_input( const char* title, int min, int max, const char *fmt, ... );
24char* dialogue_inputRaw( const char* title, int min, int max, const char *msg );
25
26/*
27 * Choice dialogues.
28 */
29void dialogue_makeChoice( const char *caption, const char *msg, int opts );
30void dialogue_addChoice( const char *caption, const char *msg, const char *opt );
31char *dialogue_runChoice (void);
32
33/*
34 * Lists.
35 */
36PRINTF_FORMAT( 4, 5 ) int dialogue_list( const char* title, char **items, int nitems, const char *fmt, ... );
37int dialogue_listRaw( const char* title, char **items, int nitems, const char *msg );
38PRINTF_FORMAT( 8, 9 ) int dialogue_listPanel ( const char* title, char **items, int nitems, int extrawidth,
39 int minheight, void (*add_widgets) (unsigned int wid, int x, int y, int w, int h),
40 void (*select_call) (unsigned int wid, const char* wgtname, int x, int y, int w, int h),
41 const char *fmt, ... );
42int dialogue_listPanelRaw( const char* title, char **items, int nitems, int extrawidth,
43 int minheight, void (*add_widgets) (unsigned int wid, int x, int y, int w, int h),
44 void (*select_call) (unsigned int wid, const char* wgtname, int x, int y, int w, int h),
45 const char *msg );
46
47/*
48 * Custom.
49 */
50void dialogue_custom( const char* caption, int width, int height,
51 int (*update) (double dt, void* data),
52 void (*render) (double x, double y, double w, double h, void* data),
53 int (*event) (unsigned int wid, SDL_Event* event, void* data),
54 void *data, int autofree );
55int dialogue_customFullscreen( int enable );
56int dialogue_customResize( int width, int height );
57
58/*
59 * misc
60 */
61int dialogue_isOpen (void);
char * dialogue_runChoice(void)
Run the dialog and return the clicked string.
Definition: dialogue.c:792
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:465
void dialogue_alert(const char *fmt,...)
Displays an alert popup with only an ok button and a message.
Definition: dialogue.c:132
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:659
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:436
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:600
int dialogue_YesNoRaw(const char *caption, const char *msg)
Runs a dialogue with both yes and no options.
Definition: dialogue.c:366
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:621
void dialogue_custom(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 autofree)
Opens a custom dialogue window.
Definition: dialogue.c:863
void dialogue_msg(const char *caption, const char *fmt,...)
Opens a dialogue window with an ok button and a message.
Definition: dialogue.c:218
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:576
void dialogue_addChoice(const char *caption, const char *msg, const char *opt)
Add a choice to the dialog.
Definition: dialogue.c:770
int dialogue_customResize(int width, int height)
Resizes a custom dialogue.
Definition: dialogue.c:964
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:290
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:748
void dialogue_msgRaw(const char *caption, const char *msg)
Opens a dialogue window with an ok button and a fixed message.
Definition: dialogue.c:261
int dialogue_isOpen(void)
Checks to see if a dialogue is open.
Definition: dialogue.c:98
int dialogue_YesNo(const char *caption, const char *fmt,...)
Runs a dialogue with both yes and no options.
Definition: dialogue.c:344
int dialogue_customFullscreen(int enable)
Converts a custom dialogue to fullscreen.
Definition: dialogue.c:927
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:240