_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Macros | Functions | Variables
stratagus-tinyfiledialogs.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
#include <limits.h>
#include <unistd.h>
#include <dirent.h>
#include <termios.h>
#include <sys/utsname.h>
#include <signal.h>

Go to the source code of this file.

Macros

#define _POSIX_C_SOURCE   2 /* to accept POSIX 2 in old ANSI C standards */
 
#define SLASH   "/"
 
#define MAX_PATH_OR_CMD   1024 /* _MAX_PATH or MAX_PATH */
 
#define MAX_MULTIPLE_FILES   1024
 
#define LOW_MULTIPLE_FILES   32
 

Functions

const char * tinyfd_getGlobalChar (char const *aCharVariableName)
 
int tinyfd_getGlobalInt (char const *aIntVariableName)
 
int tinyfd_setGlobalInt (char const *aIntVariableName, int aValue)
 
void tinyfd_beep (void)
 
int tinyfd_notifyPopup (char const *aTitle, char const *aMessage, char const *aIconType)
 
int tinyfd_messageBox (char const *aTitle, char const *aMessage, char const *aDialogType, char const *aIconType, int aDefaultButton)
 
char * tinyfd_inputBox (char const *aTitle, char const *aMessage, char const *aDefaultInput)
 
char * tinyfd_saveFileDialog (char const *aTitle, char const *aDefaultPathAndFile, int aNumOfFilterPatterns, char const *const *aFilterPatterns, char const *aSingleFilterDescription)
 
char * tinyfd_openFileDialog (char const *aTitle, char const *aDefaultPathAndFile, int aNumOfFilterPatterns, char const *const *aFilterPatterns, char const *aSingleFilterDescription, int aAllowMultipleSelects)
 
char * tinyfd_selectFolderDialog (char const *aTitle, char const *aDefaultPath)
 
char * tinyfd_colorChooser (char const *aTitle, char const *aDefaultHexRGB, unsigned char const aDefaultRGB[3], unsigned char aoResultRGB[3])
 
static int getenvDISPLAY (void)
 
static char * getCurDir (void)
 
static char * getPathWithoutFinalSlash (char *aoDestination, char const *aSource)
 
static char * getLastName (char *aoDestination, char const *aSource)
 
static void ensureFinalSlash (char *aioString)
 
static void Hex2RGB (char const aHexRGB[8], unsigned char aoResultRGB[3])
 
static void RGB2Hex (unsigned char const aRGB[3], char aoResultHexRGB[8])
 
void tfd_replaceSubStr (char const *aSource, char const *aOldSubStr, char const *aNewSubStr, char *aoDestination)
 
static int filenameValid (char const *aFileNameWithoutPath)
 
static int fileExists (char const *aFilePathAndName)
 
static void wipefile (char const *aFilename)
 
int tfd_quoteDetected (char const *aString)
 
static char * ensureFilesExist (char *aDestination, char const *aSourcePathsAndNames)
 
int tfd_isDarwin (void)
 
static int dirExists (char const *aDirPath)
 
static int detectPresence (char const *aExecutable)
 
static char * getVersion (char const *aExecutable)
 
static int * getMajorMinorPatch (char const *aExecutable)
 
static int tryCommand (char const *aCommand)
 
static int isTerminalRunning (void)
 
static char * dialogNameOnly (void)
 
int isDialogVersionBetter09b (void)
 
static int whiptailPresentOnly (void)
 
static char * terminalName (void)
 
static char * dialogName (void)
 
static int whiptailPresent (void)
 
static int graphicMode (void)
 
static int pactlPresent (void)
 
static int speakertestPresent (void)
 
static int playPresent ()
 
static int beepexePresent ()
 
static int beepPresent (void)
 
static int xmessagePresent (void)
 
static int gxmessagePresent (void)
 
static int gmessagePresent (void)
 
static int notifysendPresent (void)
 
static int perlPresent (void)
 
static int afplayPresent (void)
 
static int xdialogPresent (void)
 
static int gdialogPresent (void)
 
static int osascriptPresent (void)
 
int tfd_qarmaPresent (void)
 
int tfd_matedialogPresent (void)
 
int tfd_shellementaryPresent (void)
 
int tfd_xpropPresent (void)
 
int tfd_zenityPresent (void)
 
int tfd_yadPresent (void)
 
int tfd_zenity3Present (void)
 
int tfd_kdialogPresent (void)
 
static int osx9orBetter (void)
 
static int python3Present (void)
 
static int python2Present (void)
 
static int tkinter3Present (void)
 
static int tkinter2Present (void)
 
static int pythonDbusPresent (void)
 
static void sigHandler (int signum)
 

Variables

char tinyfd_version [8] = "3.8.8"
 
char tinyfd_needs []
 
int tinyfd_verbose = 0
 
int tinyfd_silent = 1
 
int tinyfd_allowCursesDialogs = 1
 
int tinyfd_forceConsole = 0
 
int tinyfd_assumeGraphicDisplay = 0
 
char tinyfd_response [1024]
 
static int gWarningDisplayed = 0
 
static char gTitle [] = "missing software! (we will try basic console input)"
 
static char gPython2Name [16]
 
static char gPython3Name [16]
 
static char gPythonName [16]
 

Macro Definition Documentation

◆ _POSIX_C_SOURCE

#define _POSIX_C_SOURCE   2 /* to accept POSIX 2 in old ANSI C standards */

◆ LOW_MULTIPLE_FILES

#define LOW_MULTIPLE_FILES   32

◆ MAX_MULTIPLE_FILES

#define MAX_MULTIPLE_FILES   1024

◆ MAX_PATH_OR_CMD

#define MAX_PATH_OR_CMD   1024 /* _MAX_PATH or MAX_PATH */

◆ SLASH

#define SLASH   "/"

Function Documentation

◆ afplayPresent()

static int afplayPresent ( void  )
static

◆ beepexePresent()

static int beepexePresent ( )
static

◆ beepPresent()

static int beepPresent ( void  )
static

◆ detectPresence()

static int detectPresence ( char const *  aExecutable)
static

◆ dialogName()

static char* dialogName ( void  )
static

◆ dialogNameOnly()

static char* dialogNameOnly ( void  )
static

◆ dirExists()

static int dirExists ( char const *  aDirPath)
static

◆ ensureFilesExist()

static char* ensureFilesExist ( char *  aDestination,
char const *  aSourcePathsAndNames 
)
static

◆ ensureFinalSlash()

static void ensureFinalSlash ( char *  aioString)
static

◆ fileExists()

static int fileExists ( char const *  aFilePathAndName)
static

◆ filenameValid()

static int filenameValid ( char const *  aFileNameWithoutPath)
static

◆ gdialogPresent()

static int gdialogPresent ( void  )
static

◆ getCurDir()

static char* getCurDir ( void  )
static

◆ getenvDISPLAY()

static int getenvDISPLAY ( void  )
static

◆ getLastName()

static char* getLastName ( char *  aoDestination,
char const *  aSource 
)
static

◆ getMajorMinorPatch()

static int* getMajorMinorPatch ( char const *  aExecutable)
static

◆ getPathWithoutFinalSlash()

static char* getPathWithoutFinalSlash ( char *  aoDestination,
char const *  aSource 
)
static

◆ getVersion()

static char* getVersion ( char const *  aExecutable)
static

◆ gmessagePresent()

static int gmessagePresent ( void  )
static

◆ graphicMode()

static int graphicMode ( void  )
static

◆ gxmessagePresent()

static int gxmessagePresent ( void  )
static

◆ Hex2RGB()

static void Hex2RGB ( char const  aHexRGB[8],
unsigned char  aoResultRGB[3] 
)
static

◆ isDialogVersionBetter09b()

int isDialogVersionBetter09b ( void  )

◆ isTerminalRunning()

static int isTerminalRunning ( void  )
static

◆ notifysendPresent()

static int notifysendPresent ( void  )
static

◆ osascriptPresent()

static int osascriptPresent ( void  )
static

◆ osx9orBetter()

static int osx9orBetter ( void  )
static

◆ pactlPresent()

static int pactlPresent ( void  )
static

◆ perlPresent()

static int perlPresent ( void  )
static

◆ playPresent()

static int playPresent ( )
static

◆ python2Present()

static int python2Present ( void  )
static

◆ python3Present()

static int python3Present ( void  )
static

◆ pythonDbusPresent()

static int pythonDbusPresent ( void  )
static

◆ RGB2Hex()

static void RGB2Hex ( unsigned char const  aRGB[3],
char  aoResultHexRGB[8] 
)
static

◆ sigHandler()

static void sigHandler ( int  signum)
static

◆ speakertestPresent()

static int speakertestPresent ( void  )
static

◆ terminalName()

static char* terminalName ( void  )
static

◆ tfd_isDarwin()

int tfd_isDarwin ( void  )

◆ tfd_kdialogPresent()

int tfd_kdialogPresent ( void  )

◆ tfd_matedialogPresent()

int tfd_matedialogPresent ( void  )

◆ tfd_qarmaPresent()

int tfd_qarmaPresent ( void  )

◆ tfd_quoteDetected()

int tfd_quoteDetected ( char const *  aString)

◆ tfd_replaceSubStr()

void tfd_replaceSubStr ( char const *  aSource,
char const *  aOldSubStr,
char const *  aNewSubStr,
char *  aoDestination 
)

◆ tfd_shellementaryPresent()

int tfd_shellementaryPresent ( void  )

◆ tfd_xpropPresent()

int tfd_xpropPresent ( void  )

◆ tfd_yadPresent()

int tfd_yadPresent ( void  )

◆ tfd_zenity3Present()

int tfd_zenity3Present ( void  )

◆ tfd_zenityPresent()

int tfd_zenityPresent ( void  )

◆ tinyfd_beep()

void tinyfd_beep ( void  )

◆ tinyfd_colorChooser()

char * tinyfd_colorChooser ( char const *  aTitle,
char const *  aDefaultHexRGB,
unsigned char const  aDefaultRGB[3],
unsigned char  aoResultRGB[3] 
)

◆ tinyfd_getGlobalChar()

const char * tinyfd_getGlobalChar ( char const *  aCharVariableName)

◆ tinyfd_getGlobalInt()

int tinyfd_getGlobalInt ( char const *  aIntVariableName)

◆ tinyfd_inputBox()

char * tinyfd_inputBox ( char const *  aTitle,
char const *  aMessage,
char const *  aDefaultInput 
)

◆ tinyfd_messageBox()

int tinyfd_messageBox ( char const *  aTitle,
char const *  aMessage,
char const *  aDialogType,
char const *  aIconType,
int  aDefaultButton 
)

◆ tinyfd_notifyPopup()

int tinyfd_notifyPopup ( char const *  aTitle,
char const *  aMessage,
char const *  aIconType 
)

◆ tinyfd_openFileDialog()

char * tinyfd_openFileDialog ( char const *  aTitle,
char const *  aDefaultPathAndFile,
int  aNumOfFilterPatterns,
char const *const *  aFilterPatterns,
char const *  aSingleFilterDescription,
int  aAllowMultipleSelects 
)

◆ tinyfd_saveFileDialog()

char * tinyfd_saveFileDialog ( char const *  aTitle,
char const *  aDefaultPathAndFile,
int  aNumOfFilterPatterns,
char const *const *  aFilterPatterns,
char const *  aSingleFilterDescription 
)

◆ tinyfd_selectFolderDialog()

char * tinyfd_selectFolderDialog ( char const *  aTitle,
char const *  aDefaultPath 
)

◆ tinyfd_setGlobalInt()

int tinyfd_setGlobalInt ( char const *  aIntVariableName,
int  aValue 
)

◆ tkinter2Present()

static int tkinter2Present ( void  )
static

◆ tkinter3Present()

static int tkinter3Present ( void  )
static

◆ tryCommand()

static int tryCommand ( char const *  aCommand)
static

◆ whiptailPresent()

static int whiptailPresent ( void  )
static

◆ whiptailPresentOnly()

static int whiptailPresentOnly ( void  )
static

◆ wipefile()

static void wipefile ( char const *  aFilename)
static

◆ xdialogPresent()

static int xdialogPresent ( void  )
static

◆ xmessagePresent()

static int xmessagePresent ( void  )
static

Variable Documentation

◆ gPython2Name

char gPython2Name[16]
static

◆ gPython3Name

char gPython3Name[16]
static

◆ gPythonName

char gPythonName[16]
static

◆ gTitle

char gTitle[] = "missing software! (we will try basic console input)"
static

◆ gWarningDisplayed

int gWarningDisplayed = 0
static

◆ tinyfd_allowCursesDialogs

int tinyfd_allowCursesDialogs = 1

◆ tinyfd_assumeGraphicDisplay

int tinyfd_assumeGraphicDisplay = 0

◆ tinyfd_forceConsole

int tinyfd_forceConsole = 0

◆ tinyfd_needs

char tinyfd_needs
Initial value:
= "\
___________\n\
/ \\ \n\
| tiny file |\n\
| dialogs |\n\
\\_____ ____/\n\
\\|\
\ntiny file dialogs on UNIX needs:\
\n applescript or kdialog or yad or Xdialog\
\nor zenity (or matedialog or shellementary or qarma)\
\nor python (2 or 3) + tkinter + python-dbus (optional)\
\nor dialog (opens console if needed)\
\nor xterm + bash (opens console for basic input)\
\nor existing console for basic input"

◆ tinyfd_response

char tinyfd_response

◆ tinyfd_silent

int tinyfd_silent = 1

◆ tinyfd_verbose

int tinyfd_verbose = 0

◆ tinyfd_version

char tinyfd_version = "3.8.8"
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.