cxWidgets 1.0
Namespaces | Functions | Variables
cxUtils.h File Reference
#include "cxWindow.h"
#include "cxColors.h"
#include "cxInputOptions.h"
#include "cxInputTypes.h"
#include "cxWidgetsException.h"
#include "cxMessageDialogStyles.h"
#include <string>
#include <set>
#include <list>
Include dependency graph for cxUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  cx
 cxBorderChars.h - Defines border characters to be used in drawing a box (i.e., in cxWindow and all its derivitives)
 

Functions

void cx::init (bool pEnableMouse=true)
 Initializes the cxWidgets library. This must be called before.
 
void cx::cleanup ()
 Cleans up the cxWidgets library. Must be called after all.
 
int cx::top ()
 Returns the top row # of the main screen.
 
int cx::centerRow ()
 Returns the center row # of the main screen.
 
int cx::bottom ()
 Returns the bottom row # of the main screen.
 
int cx::left ()
 Returns the leftmost column # of the main screen.
 
int cx::centerCol ()
 Returns the center column # of the main screen.
 
int cx::right ()
 Returns the rightmost column # of the main screen.
 
int cx::width ()
 Returns the width of the main screen.
 
int cx::height ()
 Returns the height of the main screen.
 
void cx::getTermDimensions (int &pHeight, int &pWidth)
 Returns the terminal's current height & width.
 
bool cx::resizeTerm (int pNewHeight, int pNewWidth)
 Resizes the terminal screen.
 
e_cxColors cx::getDefaultMessageColor ()
 Returns the default message color.
 
void cx::setDefaultMessageColor (e_cxColors pColor)
 Sets the default message color.
 
e_cxColors cx::getDefaultTitleColor ()
 Returns the default title color.
 
void cx::setDefaultTitleColor (e_cxColors pColor)
 Sets the default title color.
 
e_cxColors cx::getDefaultStatusColor ()
 Returns the default status color.
 
void cx::setDefaultStatusColor (e_cxColors pColor)
 Sets the default status color.
 
e_cxColors cx::getDefaultBorderColor ()
 Returns the default border color.
 
void cx::setDefaultBorderColor (e_cxColors pColor)
 Sets the default border color.
 
void cx::messageBox (int pRow, int pCol, int pHeight, int pWidth, const std::string &pTitle, const std::string &pMessage, const std::string &pStatus="", eBorderStyle pBorderStyle=eBS_SINGLE_LINE)
 Shows a message box.
 
void cx::messageBox (int pRow, int pCol, const std::string &pTitle, const std::string &pMessage, const std::string &pStatus)
 Shows a message box automatically setting its height & width.
 
void cx::messageBox (int pRow, int pCol, const std::string &pMessage)
 Shows a message box, automatically setting its height & width.
 
void cx::messageBox (const std::string &pTitle, const std::string &pMessage, const std::string &pStatus="")
 
void cx::messageBox (const std::string &pTitle, const std::string &pMessage, const std::string &pStatus, int pHeight, int pWidth)
 Shows a message box.
 
void cx::messageBox (const std::string &pMessage, const std::string &pStatus, int pHeight, int pWidth)
 Shows a message box.
 
void cx::messageBox (const std::string &pMessage, e_cxColors pMessageColor=getDefaultMessageColor(), attr_t pMessageAttr=A_NORMAL, e_cxColors pTitleColor=getDefaultTitleColor(), e_cxColors pStatusColor=getDefaultStatusColor(), e_cxColors pBorderColor=getDefaultBorderColor())
 Shows a message box.
 
void cx::messageDialog (const std::string &pMessage)
 Shows a message dialog (a message box with an OK button)
 
void cx::messageDialog (const std::list< std::string > &pMessages)
 Shows a message dialog (a message box with an OK button)
 
void cx::splash (const std::string &pTitle, const std::string &pMessage, int pSleep)
 Shows a splash message.
 
void cx::splash (const std::string &pMessage, int pSleep)
 Shows a splash message.
 
void cx::eraseScreen ()
 Erases the screen.
 
void cx::updateWindows ()
 Updates (refreshes) all windows on the screen.
 
bool cx::isFunctionKey (int pKey)
 Returns whether a key is a function key, pageDown, or pageUp (these keys are tested by cxInput and cxMultiLineInput in their input loops).
 
bool cx::toggleCursor (bool pToggleCursor)
 Enables or disables the display of the cursor.
 
std::string cx::getTermType ()
 Returns a string representing the terminal type. This is the.
 
bool cx::colorIsBright (e_cxColors pColor)
 Returns whether a color has the brightness bit set.
 
int cx::countHotkeys (const std::string &pStr)
 Counts the number of hotkeys in a string. This is useful when working with cxMenu, which can contain items with hotkeys.
 
std::string cx::stringWithoutHotkeyChars (const std::string &pStr)
 Takes a string and returns a version without the & characters.
 
unsigned cx::visualStrLen (const std::string &pStr)
 Returns the length of a string without its hotkey characters -.
 
std::string cx::bringToTop (void *theWindow, void *unused)
 Brings a cxWindow to the top of the stack. Doesn't refresh.
 
std::string cx::cxFormShowModal (void *theForm, void *unused)
 Runs showModal() on a cxForm and returns the result. This.
 
std::string cx::cxMenuShowModal (void *theMenu, void *unused)
 Runs showModal() on a cxMenu and returns the result. This.
 
std::string cx::noOp (void *p1, void *p2)
 Does nothing. Can be used, for example, as an event function.
 
std::string cx::noOp (void *p1, void *p2, void *p3, void *p4)
 Does nothing. Can be used, for example, as an event function.
 
int cx::runSystemCmd (const std::string &pCmd)
 Runs a command on the system, calling the system() function.
 
void cx::writeText (int pRow, int pCol, const std::string &pText, attr_t pAttr=A_NORMAL, e_cxColors pColor=eGRAY_BLACK)
 Writes text on the screen.
 
void cx::getHotkeyChars (const std::string &pStr, std::set< char > &pHotkeys, bool pConvertCase=false, bool pToUpper=false)
 Scans a string for hotkeys (characters preceeded by an ampersand)
 
void cx::showAllWindows (bool pBringToTop=false)
 Shows all windows currently in use everywhere, from the.
 
cxWindowcx::getTopWindow ()
 Gets a pointer to the topmost cxWindow on the stack. This could.
 
cxWindowcx::getBottomWindow ()
 Gets a pointer to the bottom-most cxWindow on the stack. This could.
 
std::string cx::getKeyStr (int pKey)
 Returns a string version of a key.
 
std::string cx::getMouseStateStr (int pMouseState)
 Returns a string version of a mouse state.
 
std::string cx::getReturnCodeStr (long pReturnCode)
 Returns a string version of a return code.
 
std::string cx::getInputOptionStr (eInputOptions pInputOption)
 Returns a string version of a value from the eInputOptions.
 
std::string cx::getBorderStyleStr (eBorderStyle pBorderStyle)
 Returns a string version of an eBorderStyle value.
 
std::string cx::getInputTypeStr (eInputTypes pInputType)
 Returns a string version of an eInputType value.
 
void cx::signalHandler (int pSignal)
 Handler for system signals.
 
bool cx::promptYesNo (const std::string &pMessage, const std::string &pTitle="", long pButtons=cxYES_NO)
 Prompts the user with a cxMessageDialog for a yes/no choice.
 
bool cx::cxInitialized ()
 Returns whether or not cxWidgets has been initialized.
 
void cx::addAttr (e_WidgetItems pItem, attr_t pAttr)
 Adds an ncurses attribute to use for one of the items in the.
 
void cx::setAttr (e_WidgetItems pItem, attr_t pAttr)
 Sets the ncurses attribute to use for one of the items in the.
 
void cx::removeAttr (e_WidgetItems pItem, attr_t pAttr)
 Removes an ncurses attribute from one of the item lists.
 
void cx::removeAttrs (e_WidgetItems pItem)
 Removes all attributes for a given window item.
 
void cx::getAttrs (e_WidgetItems pItem, std::set< attr_t > &pAttrs)
 Returns the set of ncurses attributes for a given item.
 
bool cx::hasAttr (e_WidgetItems pItem, attr_t pAttr)
 Determine if the widget has an attribute "set".
 
void cx::enableAttrs (WINDOW *pWindow, e_WidgetItems pItem)
 Enables all of a set of attributes for a given item type on an.
 
void cx::disableAttrs (WINDOW *pWindow, e_WidgetItems pItem)
 Disables all of a set of attributes for a given item type on an.
 
attr_t cx::getAttr (const std::string &pAttr)
 Figure out the appropriate ncurses attr_t from a "string".
 
std::string cx::getAttrStr (attr_t pAttr)
 Returns a string version of an ncurses attribute.
 
std::string cx::getWidgetItemStr (e_WidgetItems pItem)
 Returns a string version of an e_WidgetItems value.
 
void cx::setMenuClearKeywordKey (int pKey)
 Sets the key that should be used to clear the "Keyword" input.
 
int cx::getMenuClearKeywordKey ()
 Returns the key that is set to clear the "Keyword" input for.
 
std::string cx::dump (bool pFancy=false, const std::string &pFilename="")
 dump the contents to the screen to a file
 
bool cx::isNavKey (int pKey)
 Returns whether a key is a navigational key, according to.
 
void cx::addNavKey (int pKey)
 Add a key to be considered a "navigational" key. The key will.
 
void cx::removeNavKey (int pKey)
 Removes a key from cx's list of "navigational" keys.
 
std::string cx::getString (int pRow, int pCol, int pNumber, WINDOW *pWin=nullptr)
 Get the contents of the screen (for debugging/testing)
 
bool cx::findString (const std::string &pSearch, int &pRow, int &pCol, WINDOW *pWin=nullptr)
 Look for a string on the screen (for debugging/testing)
 

Variables

static const std::string cx::termType = getTermType()
 Contains the terminal type string.