Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include
File: cursslk.h
// * this is for making emacs happy: -*-Mode: C++;-*-
[0] Fix | Delete
/****************************************************************************
[1] Fix | Delete
* Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
[2] Fix | Delete
* *
[3] Fix | Delete
* Permission is hereby granted, free of charge, to any person obtaining a *
[4] Fix | Delete
* copy of this software and associated documentation files (the *
[5] Fix | Delete
* "Software"), to deal in the Software without restriction, including *
[6] Fix | Delete
* without limitation the rights to use, copy, modify, merge, publish, *
[7] Fix | Delete
* distribute, distribute with modifications, sublicense, and/or sell *
[8] Fix | Delete
* copies of the Software, and to permit persons to whom the Software is *
[9] Fix | Delete
* furnished to do so, subject to the following conditions: *
[10] Fix | Delete
* *
[11] Fix | Delete
* The above copyright notice and this permission notice shall be included *
[12] Fix | Delete
* in all copies or substantial portions of the Software. *
[13] Fix | Delete
* *
[14] Fix | Delete
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
[15] Fix | Delete
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
[16] Fix | Delete
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
[17] Fix | Delete
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
[18] Fix | Delete
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
[19] Fix | Delete
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
[20] Fix | Delete
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
[21] Fix | Delete
* *
[22] Fix | Delete
* Except as contained in this notice, the name(s) of the above copyright *
[23] Fix | Delete
* holders shall not be used in advertising or otherwise to promote the *
[24] Fix | Delete
* sale, use or other dealings in this Software without prior written *
[25] Fix | Delete
* authorization. *
[26] Fix | Delete
****************************************************************************/
[27] Fix | Delete
[28] Fix | Delete
/****************************************************************************
[29] Fix | Delete
* Author: Juergen Pfeifer, 1997 *
[30] Fix | Delete
****************************************************************************/
[31] Fix | Delete
[32] Fix | Delete
// $Id: cursslk.h,v 1.13 2005/05/28 21:58:18 tom Exp $
[33] Fix | Delete
[34] Fix | Delete
#ifndef NCURSES_CURSSLK_H_incl
[35] Fix | Delete
#define NCURSES_CURSSLK_H_incl
[36] Fix | Delete
[37] Fix | Delete
#include <cursesw.h>
[38] Fix | Delete
[39] Fix | Delete
class NCURSES_IMPEXP Soft_Label_Key_Set {
[40] Fix | Delete
public:
[41] Fix | Delete
// This inner class represents the attributes of a Soft Label Key (SLK)
[42] Fix | Delete
class NCURSES_IMPEXP Soft_Label_Key {
[43] Fix | Delete
friend class Soft_Label_Key_Set;
[44] Fix | Delete
public:
[45] Fix | Delete
typedef enum { Left=0, Center=1, Right=2 } Justification;
[46] Fix | Delete
[47] Fix | Delete
private:
[48] Fix | Delete
char *label; // The Text of the Label
[49] Fix | Delete
Justification format; // The Justification
[50] Fix | Delete
int num; // The number of the Label
[51] Fix | Delete
[52] Fix | Delete
Soft_Label_Key() : label(NULL), format(Left), num(-1) {
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
virtual ~Soft_Label_Key() {
[56] Fix | Delete
delete[] label;
[57] Fix | Delete
};
[58] Fix | Delete
[59] Fix | Delete
public:
[60] Fix | Delete
// Set the text of the Label
[61] Fix | Delete
Soft_Label_Key& operator=(char *text);
[62] Fix | Delete
[63] Fix | Delete
// Set the Justification of the Label
[64] Fix | Delete
Soft_Label_Key& operator=(Justification just) {
[65] Fix | Delete
format = just;
[66] Fix | Delete
return *this;
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
// Retrieve the text of the label
[70] Fix | Delete
inline char* operator()(void) const {
[71] Fix | Delete
return label;
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
Soft_Label_Key& operator=(const Soft_Label_Key& rhs)
[75] Fix | Delete
{
[76] Fix | Delete
if (this != &rhs) {
[77] Fix | Delete
*this = rhs;
[78] Fix | Delete
}
[79] Fix | Delete
return *this;
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
Soft_Label_Key(const Soft_Label_Key& rhs)
[83] Fix | Delete
: label(NULL),
[84] Fix | Delete
format(rhs.format),
[85] Fix | Delete
num(rhs.num)
[86] Fix | Delete
{
[87] Fix | Delete
*this = rhs.label;
[88] Fix | Delete
}
[89] Fix | Delete
};
[90] Fix | Delete
[91] Fix | Delete
public:
[92] Fix | Delete
typedef enum {
[93] Fix | Delete
None = -1,
[94] Fix | Delete
Three_Two_Three = 0,
[95] Fix | Delete
Four_Four = 1,
[96] Fix | Delete
PC_Style = 2,
[97] Fix | Delete
PC_Style_With_Index = 3
[98] Fix | Delete
} Label_Layout;
[99] Fix | Delete
[100] Fix | Delete
private:
[101] Fix | Delete
static long NCURSES_IMPEXP count; // Number of Key Sets
[102] Fix | Delete
static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets
[103] Fix | Delete
static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets
[104] Fix | Delete
bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized
[105] Fix | Delete
[106] Fix | Delete
Soft_Label_Key *slk_array; // The array of SLK's
[107] Fix | Delete
[108] Fix | Delete
// Init the Key Set
[109] Fix | Delete
void init();
[110] Fix | Delete
[111] Fix | Delete
// Activate or Deactivate Label# i, Label counting starts with 1!
[112] Fix | Delete
void activate_label(int i, bool bf=TRUE);
[113] Fix | Delete
[114] Fix | Delete
// Activate of Deactivate all Labels
[115] Fix | Delete
void activate_labels(bool bf);
[116] Fix | Delete
[117] Fix | Delete
protected:
[118] Fix | Delete
inline void Error (const char* msg) const THROWS(NCursesException) {
[119] Fix | Delete
THROW(new NCursesException (msg));
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
// Remove SLK's from screen
[123] Fix | Delete
void clear() {
[124] Fix | Delete
if (ERR==::slk_clear())
[125] Fix | Delete
Error("slk_clear");
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
// Restore them
[129] Fix | Delete
void restore() {
[130] Fix | Delete
if (ERR==::slk_restore())
[131] Fix | Delete
Error("slk_restore");
[132] Fix | Delete
}
[133] Fix | Delete
[134] Fix | Delete
public:
[135] Fix | Delete
[136] Fix | Delete
// Construct a Key Set, use the most comfortable layout as default.
[137] Fix | Delete
// You must create a Soft_Label_Key_Set before you create any object of
[138] Fix | Delete
// the NCursesWindow, NCursesPanel or derived classes. (Actually before
[139] Fix | Delete
// ::initscr() is called).
[140] Fix | Delete
Soft_Label_Key_Set(Label_Layout fmt);
[141] Fix | Delete
[142] Fix | Delete
// This constructor assumes, that you already constructed a Key Set
[143] Fix | Delete
// with a layout by the constructor above. This layout will be reused.
[144] Fix | Delete
NCURSES_IMPEXP Soft_Label_Key_Set();
[145] Fix | Delete
[146] Fix | Delete
Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs)
[147] Fix | Delete
{
[148] Fix | Delete
if (this != &rhs) {
[149] Fix | Delete
*this = rhs;
[150] Fix | Delete
init(); // allocate a new slk_array[]
[151] Fix | Delete
}
[152] Fix | Delete
return *this;
[153] Fix | Delete
}
[154] Fix | Delete
[155] Fix | Delete
Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs)
[156] Fix | Delete
: b_attrInit(rhs.b_attrInit),
[157] Fix | Delete
slk_array(NULL)
[158] Fix | Delete
{
[159] Fix | Delete
init(); // allocate a new slk_array[]
[160] Fix | Delete
}
[161] Fix | Delete
[162] Fix | Delete
virtual ~Soft_Label_Key_Set();
[163] Fix | Delete
[164] Fix | Delete
// Get Label# i. Label counting starts with 1!
[165] Fix | Delete
NCURSES_IMPEXP Soft_Label_Key& operator[](int i);
[166] Fix | Delete
[167] Fix | Delete
// Retrieve number of Labels
[168] Fix | Delete
inline int labels() const { return num_labels; }
[169] Fix | Delete
[170] Fix | Delete
// Refresh the SLK portion of the screen
[171] Fix | Delete
inline void refresh() {
[172] Fix | Delete
if (ERR==::slk_refresh())
[173] Fix | Delete
Error("slk_refresh");
[174] Fix | Delete
}
[175] Fix | Delete
[176] Fix | Delete
// Mark the SLK portion of the screen for refresh, defer actual refresh
[177] Fix | Delete
// until next update call.
[178] Fix | Delete
inline void noutrefresh() {
[179] Fix | Delete
if (ERR==::slk_noutrefresh())
[180] Fix | Delete
Error("slk_noutrefresh");
[181] Fix | Delete
}
[182] Fix | Delete
[183] Fix | Delete
// Mark the whole SLK portion of the screen as modified
[184] Fix | Delete
inline void touch() {
[185] Fix | Delete
if (ERR==::slk_touch())
[186] Fix | Delete
Error("slk_touch");
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
// Activate Label# i
[190] Fix | Delete
inline void show(int i) {
[191] Fix | Delete
activate_label(i,FALSE);
[192] Fix | Delete
activate_label(i,TRUE);
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
// Hide Label# i
[196] Fix | Delete
inline void hide(int i) {
[197] Fix | Delete
activate_label(i,FALSE);
[198] Fix | Delete
}
[199] Fix | Delete
[200] Fix | Delete
// Show all Labels
[201] Fix | Delete
inline void show() {
[202] Fix | Delete
activate_labels(FALSE);
[203] Fix | Delete
activate_labels(TRUE);
[204] Fix | Delete
}
[205] Fix | Delete
[206] Fix | Delete
// Hide all Labels
[207] Fix | Delete
inline void hide() {
[208] Fix | Delete
activate_labels(FALSE);
[209] Fix | Delete
}
[210] Fix | Delete
[211] Fix | Delete
inline void attron(attr_t attrs) {
[212] Fix | Delete
if (ERR==::slk_attron(attrs))
[213] Fix | Delete
Error("slk_attron");
[214] Fix | Delete
}
[215] Fix | Delete
[216] Fix | Delete
inline void attroff(attr_t attrs) {
[217] Fix | Delete
if (ERR==::slk_attroff(attrs))
[218] Fix | Delete
Error("slk_attroff");
[219] Fix | Delete
}
[220] Fix | Delete
[221] Fix | Delete
inline void attrset(attr_t attrs) {
[222] Fix | Delete
if (ERR==::slk_attrset(attrs))
[223] Fix | Delete
Error("slk_attrset");
[224] Fix | Delete
}
[225] Fix | Delete
[226] Fix | Delete
inline void color(short color_pair_number) {
[227] Fix | Delete
if (ERR==::slk_color(color_pair_number))
[228] Fix | Delete
Error("slk_color");
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
inline attr_t attr() const {
[232] Fix | Delete
return ::slk_attr();
[233] Fix | Delete
}
[234] Fix | Delete
};
[235] Fix | Delete
[236] Fix | Delete
#endif /* NCURSES_CURSSLK_H_incl */
[237] Fix | Delete
[238] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function