|
|
|
|
@ -123,69 +123,68 @@ |
|
|
|
|
///
|
|
|
|
|
namespace NC |
|
|
|
|
{ |
|
|
|
|
/// Colors used by NCurses
|
|
|
|
|
///
|
|
|
|
|
enum Color { clDefault, clBlack, clRed, clGreen, clYellow, clBlue, clMagenta, clCyan, clWhite, clEnd }; |
|
|
|
|
/// Colors used by NCurses
|
|
|
|
|
///
|
|
|
|
|
enum Color { clDefault, clBlack, clRed, clGreen, clYellow, clBlue, clMagenta, clCyan, clWhite, clEnd }; |
|
|
|
|
|
|
|
|
|
/// Format flags used by NCurses
|
|
|
|
|
///
|
|
|
|
|
enum Format { |
|
|
|
|
/// Format flags used by NCurses
|
|
|
|
|
///
|
|
|
|
|
enum Format { |
|
|
|
|
fmtNone = clEnd+1, |
|
|
|
|
fmtBold, fmtBoldEnd, |
|
|
|
|
fmtUnderline, fmtUnderlineEnd, |
|
|
|
|
fmtReverse, fmtReverseEnd, |
|
|
|
|
fmtAltCharset, fmtAltCharsetEnd |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/// Available border colors for window
|
|
|
|
|
///
|
|
|
|
|
enum Border { brNone, brBlack, brRed, brGreen, brYellow, brBlue, brMagenta, brCyan, brWhite }; |
|
|
|
|
/// Available border colors for window
|
|
|
|
|
///
|
|
|
|
|
enum Border { brNone, brBlack, brRed, brGreen, brYellow, brBlue, brMagenta, brCyan, brWhite }; |
|
|
|
|
|
|
|
|
|
/// This indicates how much the window has to be scrolled
|
|
|
|
|
///
|
|
|
|
|
enum Where { wUp, wDown, wPageUp, wPageDown, wHome, wEnd }; |
|
|
|
|
/// This indicates how much the window has to be scrolled
|
|
|
|
|
///
|
|
|
|
|
enum Where { wUp, wDown, wPageUp, wPageDown, wHome, wEnd }; |
|
|
|
|
|
|
|
|
|
/// Helper function that is invoked each time one will want
|
|
|
|
|
/// to obtain string from Window::GetString() function
|
|
|
|
|
/// @see Window::GetString()
|
|
|
|
|
///
|
|
|
|
|
typedef std::function<void(const std::wstring &)> GetStringHelper; |
|
|
|
|
/// Helper function that is invoked each time one will want
|
|
|
|
|
/// to obtain string from Window::GetString() function
|
|
|
|
|
/// @see Window::GetString()
|
|
|
|
|
///
|
|
|
|
|
typedef std::function<void(const std::wstring &)> GetStringHelper; |
|
|
|
|
|
|
|
|
|
/// Initializes curses screen and sets some additional attributes
|
|
|
|
|
/// @param window_title title of the window (has an effect only if pdcurses lib is used)
|
|
|
|
|
/// @param enable_colors enables colors
|
|
|
|
|
///
|
|
|
|
|
void InitScreen(const char *window_title, bool enable_colors); |
|
|
|
|
/// Initializes curses screen and sets some additional attributes
|
|
|
|
|
/// @param window_title title of the window (has an effect only if pdcurses lib is used)
|
|
|
|
|
/// @param enable_colors enables colors
|
|
|
|
|
///
|
|
|
|
|
void InitScreen(const char *window_title, bool enable_colors); |
|
|
|
|
|
|
|
|
|
/// Destroys the screen
|
|
|
|
|
///
|
|
|
|
|
void DestroyScreen(); |
|
|
|
|
/// Destroys the screen
|
|
|
|
|
///
|
|
|
|
|
void DestroyScreen(); |
|
|
|
|
|
|
|
|
|
/// Struct used to set color of both foreground and background of window
|
|
|
|
|
/// @see Window::operator<<()
|
|
|
|
|
///
|
|
|
|
|
struct Colors |
|
|
|
|
{ |
|
|
|
|
/// Struct used to set color of both foreground and background of window
|
|
|
|
|
/// @see Window::operator<<()
|
|
|
|
|
///
|
|
|
|
|
struct Colors |
|
|
|
|
{ |
|
|
|
|
Colors(Color one, Color two = clDefault) : fg(one), bg(two) { } |
|
|
|
|
Color fg; |
|
|
|
|
Color bg; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/// Struct used for going to given coordinates
|
|
|
|
|
/// @see Window::operator<<()
|
|
|
|
|
///
|
|
|
|
|
struct XY |
|
|
|
|
{ |
|
|
|
|
/// Struct used for going to given coordinates
|
|
|
|
|
/// @see Window::operator<<()
|
|
|
|
|
///
|
|
|
|
|
struct XY |
|
|
|
|
{ |
|
|
|
|
XY(int xx, int yy) : x(xx), y(yy) { } |
|
|
|
|
int x; |
|
|
|
|
int y; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/// Main class of NCurses namespace, used as base for other specialized windows
|
|
|
|
|
///
|
|
|
|
|
class Window |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
/// Main class of NCurses namespace, used as base for other specialized windows
|
|
|
|
|
///
|
|
|
|
|
struct Window |
|
|
|
|
{ |
|
|
|
|
/// Constructs an empty window with given parameters
|
|
|
|
|
/// @param startx X position of left upper corner of constructed window
|
|
|
|
|
/// @param starty Y position of left upper corner of constructed window
|
|
|
|
|
@ -510,7 +509,7 @@ namespace NC |
|
|
|
|
/// @param max_len maximal length of string
|
|
|
|
|
static void Cut(std::wstring &ws, size_t max_len); |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
protected: |
|
|
|
|
/// Sets colors of window (interal use only)
|
|
|
|
|
/// @param fg foregound color
|
|
|
|
|
/// @param bg background color
|
|
|
|
|
@ -562,7 +561,7 @@ namespace NC |
|
|
|
|
/// current border
|
|
|
|
|
Border itsBorder; |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
private: |
|
|
|
|
/// Sets state of bold attribute (internal use only)
|
|
|
|
|
/// @param bold_state state of bold attribute
|
|
|
|
|
///
|
|
|
|
|
@ -613,7 +612,8 @@ namespace NC |
|
|
|
|
int itsUnderlineCounter; |
|
|
|
|
int itsReverseCounter; |
|
|
|
|
int itsAltCharsetCounter; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|