More faster header inline code

This commit is contained in:
Markus Gans 2015-10-17 19:40:43 +02:00
parent 4bef3e8f7b
commit 56a6878f46
18 changed files with 293 additions and 338 deletions

View File

@ -1,3 +1,6 @@
2015-10-17 Markus Gans <guru.mail@muenster.de>
* More faster header inline code
2015-10-16 Markus Gans <guru.mail@muenster.de>
* Fixed: calculator behavior for negative values
in trigonometric functions

View File

@ -148,7 +148,7 @@ void FApplication::cmd_options ()
//----------------------------------------------------------------------
#ifdef F_HAVE_LIBGPM
inline int FApplication::gpmEvent(bool clear)
int FApplication::gpmEvent (bool clear)
{
register int result;
register int max = (gpm_fd > stdin_no) ? gpm_fd : stdin_no;
@ -948,13 +948,10 @@ void FApplication::processMouseEvent()
|| b_state.wheel_up == Pressed
|| b_state.wheel_down == Pressed ) )
{
FWidget* window = FWindow::windowWidgetAt ( mouse->getX()
, mouse->getY() );
FWidget* window = FWindow::windowWidgetAt (*mouse);
if ( window )
{
FWidget* child = childWidgetAt ( window
, mouse->getX()
, mouse->getY() );
FWidget* child = childWidgetAt (window, *mouse);
clicked_widget = (child != 0) ? child : window;
}
}

View File

@ -129,7 +129,7 @@ class FApplication : public FWidget
bool parseUrxvtMouse();
#ifdef F_HAVE_LIBGPM
int gpmEvent(bool = true);
int gpmEvent (bool = true);
bool processGpmEvent();
#endif

View File

@ -146,9 +146,9 @@ void FButton::draw()
space = int(' ');
if ( isMonochron() || getMaxColor() < 16 )
ButtonText = new wchar_t[length+3];
ButtonText = new wchar_t[length+3]();
else
ButtonText = new wchar_t[length+1];
ButtonText = new wchar_t[length+1]();
txt = text;
src = const_cast<wchar_t*>(txt.wc_str());

View File

@ -208,7 +208,7 @@ void FButtonGroup::drawLabel()
txt = " " + text + " ";
length = txt.getLength();
hotkeypos = -1;
LabelText = new wchar_t[length+1];
LabelText = new wchar_t[length+1]();
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(LabelText);

View File

@ -123,7 +123,7 @@ void FDialog::init()
setFocus();
old_focus->redraw();
}
accelerator_list = new Accelerators;
accelerator_list = new Accelerators();
}
//----------------------------------------------------------------------

View File

@ -255,7 +255,7 @@ void FLabel::draw()
while ( y < text_lines && y < uInt(height) )
{
length = multiline_text[y].getLength();
LabelText = new wchar_t[length+1];
LabelText = new wchar_t[length+1]();
src = const_cast<wchar_t*>(multiline_text[y].wc_str());
dest = const_cast<wchar_t*>(LabelText);
@ -285,7 +285,7 @@ void FLabel::draw()
else
{
length = text.getLength();
LabelText = new wchar_t[length+1];
LabelText = new wchar_t[length+1]();
src = const_cast<wchar_t*>(text.wc_str());
dest = const_cast<wchar_t*>(LabelText);

View File

@ -324,7 +324,7 @@ void FMenu::drawItems()
txt = (*iter)->getText();
txt_length = uInt(txt.getLength());
item_text = new wchar_t[txt_length+1];
item_text = new wchar_t[txt_length+1]();
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(item_text);
to_char = int(txt_length);

View File

@ -180,7 +180,7 @@ void FMenuBar::drawItems()
txt = (*iter)->getText();
txt_length = uInt(txt.getLength());
item_text = new wchar_t[txt_length+1];
item_text = new wchar_t[txt_length+1]();
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(item_text);

View File

@ -27,7 +27,7 @@ FObject::FObject (FObject* parent)
if ( parent == 0 )
{
modify_timer = false;
timer_list = new TimerList;
timer_list = new TimerList();
}
else
has_parent = true;
@ -132,7 +132,7 @@ int FObject::addTimer (int interval)
modify_timer = true;
if ( ! timer_list )
timer_list = new TimerList;
timer_list = new TimerList();
// find an unused timer id
if ( ! timer_list->empty() )

View File

@ -114,7 +114,7 @@ void FStatusKey::setStatusbar (FStatusBar* sb)
// public methods of FStatusKey
//----------------------------------------------------------------------
inline void FStatusKey::setActive()
void FStatusKey::setActive()
{
active = true;
processActivate();

View File

@ -288,10 +288,8 @@ int FTerm::getScreenFont()
font.width = 32;
font.height = 32;
font.charcount = 512;
font.data = new uChar[data_size];
// initialize with 0
memset(font.data, 0, data_size);
font.data = new uChar[data_size]();
// font operation
ret = ioctl (fd_tty, KDFONTOP, &font);
@ -337,7 +335,7 @@ int FTerm::setScreenFont ( uChar* fontdata, uInt count
try
{
font.data = new uChar[data_size];
font.data = new uChar[data_size](); // initialize with 0
}
catch (const std::bad_alloc& ex)
{
@ -345,9 +343,6 @@ int FTerm::setScreenFont ( uChar* fontdata, uInt count
return -1;
}
// initialize with 0
memset(font.data, 0, data_size);
for (uInt i=0; i < count; i++)
memcpy ( const_cast<uChar*>(font.data + bytes_per_line*32*i)
, &fontdata[i * font.height]
@ -397,7 +392,7 @@ int FTerm::getUnicodeMap()
try
{
unimap.entries = new struct unipair[count];
unimap.entries = new struct unipair[count]();
}
catch (const std::bad_alloc& ex)
{
@ -1920,15 +1915,6 @@ void FTerm::restoreVTerm (int x, int y, int w, int h)
}
}
//----------------------------------------------------------------------
inline bool FTerm::isCovered(const FPoint& pos, FTerm::term_area* area) const
{
if ( area == 0 )
return false;
return isCovered (pos.getX(), pos.getY(), area);
}
//----------------------------------------------------------------------
bool FTerm::isCovered(int x, int y, FTerm::term_area* area) const
{
@ -2084,14 +2070,6 @@ void FTerm::setUpdateVTerm (bool on)
updateVTerm (last_area);
}
//----------------------------------------------------------------------
inline void FTerm::getArea (const FPoint& pos, FTerm::term_area* area)
{
if ( area == 0 )
return;
getArea (pos.getX(), pos.getY(), area);
}
//----------------------------------------------------------------------
void FTerm::getArea (int ax, int ay, FTerm::term_area* area)
{
@ -2128,16 +2106,6 @@ void FTerm::getArea (int ax, int ay, FTerm::term_area* area)
}
}
//----------------------------------------------------------------------
inline void FTerm::getArea (const FRect& box, FTerm::term_area* area)
{
getArea ( box.getX()
, box.getY()
, box.getWidth()
, box.getHeight()
, area );
}
//----------------------------------------------------------------------
void FTerm::getArea (int x, int y, int w, int h, FTerm::term_area* area)
{
@ -2250,12 +2218,6 @@ void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
}
}
//----------------------------------------------------------------------
inline FTerm::char_data FTerm::getCoveredCharacter (const FPoint& pos, FTerm* obj)
{
return getCoveredCharacter (pos.getX(), pos.getY(), obj);
}
//----------------------------------------------------------------------
FTerm::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj)
{
@ -2703,18 +2665,18 @@ void FTerm::setKDECursor(fc::kde_konsole_CursorShape style)
//----------------------------------------------------------------------
FString FTerm::getXTermFont()
{
FString font = "";
FString font("");
if ( raw_mode && non_blocking_stdin )
{
int n;
char temp[150] = {};
putstring("\033]50;?\07"); // get font
putstring ("\033]50;?\07"); // get font
fflush(stdout);
usleep(150000); // wait 150 ms
// read the answer
n = int(read(fileno(stdin), &temp, sizeof(temp)-1));
// Esc \ = OSC String Terminator
// Esc + \ = OSC string terminator
if ( n >= 2 && temp[n-1] == '\\' && temp[n-2] == 0x1b )
{
temp[n-2] = '\0';
@ -2730,7 +2692,7 @@ FString FTerm::getXTermFont()
//----------------------------------------------------------------------
FString FTerm::getXTermTitle()
{
FString title = "";
FString title("");
if ( kde_konsole )
return title;
@ -2739,12 +2701,12 @@ FString FTerm::getXTermTitle()
{
int n;
char temp[512] = {};
putstring("\033[21t"); // get title
putstring ("\033[21t"); // get title
fflush(stdout);
usleep(150000); // wait 150 ms
// read the answer
n = int(read(fileno(stdin), &temp, sizeof(temp)-1));
// Esc \ = OSC String Terminator
// Esc + \ = OSC string terminator
if ( n >= 2 && temp[n-1] == '\\' && temp[n-2] == 0x1b )
{
temp[n-2] = '\0';
@ -3713,7 +3675,7 @@ int FTerm::printf (const char* format, ...)
if ( len >= int(sizeof(buf)) )
{
buffer = new char[len+1];
buffer = new char[len+1]();
va_start (args, format);
vsnprintf (buffer, uLong(len+1), format, args);
va_end (args);
@ -4017,7 +3979,7 @@ inline void FTerm::appendCharacter (char_data*& screen_char)
}
//----------------------------------------------------------------------
inline void FTerm::appendAttributes (char_data*& screen_attr)
void FTerm::appendAttributes (char_data*& screen_attr)
{
if ( screen_attr->fg_color != fg_term_color
|| screen_attr->bg_color != bg_term_color )

View File

@ -431,15 +431,37 @@ class FTerm
};
#pragma pack(pop)
// FTerm inline functions
//----------------------------------------------------------------------
inline bool FTerm::isCovered(const FPoint& pos, FTerm::term_area* area) const
{ return isCovered (pos.getX(), pos.getY(), area); }
//----------------------------------------------------------------------
inline void FTerm::getArea (const FPoint& pos, FTerm::term_area* area)
{ return getArea (pos.getX(), pos.getY(), area); }
//----------------------------------------------------------------------
inline void FTerm::getArea (const FRect& box, FTerm::term_area* area)
{
getArea ( box.getX()
, box.getY()
, box.getWidth()
, box.getHeight()
, area );
}
//----------------------------------------------------------------------
inline FTerm::char_data FTerm::getCoveredCharacter (const FPoint& pos, FTerm* obj)
{ return getCoveredCharacter (pos.getX(), pos.getY(), obj); }
//----------------------------------------------------------------------
inline const char* FTerm::getClassName() const
{ return "FTerm"; }
//----------------------------------------------------------------------
inline FTerm::term_area* FTerm::getVWin() const
{
return vwin;
}
{ return vwin; }
//----------------------------------------------------------------------
inline int FTerm::getLineNumber()

View File

@ -198,7 +198,7 @@ void FToggleButton::drawLabel()
length = text.getLength();
hotkeypos = -1;
LabelText = new wchar_t[length+1];
LabelText = new wchar_t[length+1]();
txt = text;
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(LabelText);

View File

@ -124,8 +124,8 @@ FWidget::~FWidget() // destructor
//----------------------------------------------------------------------
void FWidget::init()
{
window_list = new widgetList;
close_widget = new widgetList;
window_list = new widgetList();
close_widget = new widgetList();
getTermGeometry(); // <-----.
// |
@ -161,7 +161,7 @@ void FWidget::init()
setColor (foregroundColor, backgroundColor);
clrscr();
accelerator_list = new Accelerators;
accelerator_list = new Accelerators();
}
//----------------------------------------------------------------------
@ -181,12 +181,6 @@ void FWidget::finish()
}
}
//----------------------------------------------------------------------
inline void FWidget::processDestroy()
{
emitCallback("destroy");
}
//----------------------------------------------------------------------
void FWidget::draw()
{ }
@ -386,12 +380,6 @@ FTerm::term_area* FWidget::getPrintArea()
}
}
//----------------------------------------------------------------------
inline void FWidget::setPrintArea(term_area* area)
{
print_area = area;
}
// protected methods of FWidget
//----------------------------------------------------------------------
void FWidget::adjustSize()
@ -839,12 +827,6 @@ void FWidget::setMainWidget(FWidget* obj)
fapp->setMainWidget(obj);
}
//----------------------------------------------------------------------
inline FWidget* FWidget::childWidgetAt (FWidget* p, const FPoint& pos)
{
return childWidgetAt (p, pos.getX(), pos.getY());
}
//----------------------------------------------------------------------
FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
{
@ -875,14 +857,14 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
}
//----------------------------------------------------------------------
inline FWidget* FWidget::getFocusWidget() const
FWidget* FWidget::getFocusWidget() const
{
FWidget* focus_widget = static_cast<FWidget*>(FApplication::focus_widget);
return focus_widget;
}
//----------------------------------------------------------------------
inline void FWidget::setFocusWidget(FWidget* obj)
void FWidget::setFocusWidget(FWidget* obj)
{
FApplication::focus_widget = obj;
}
@ -1330,18 +1312,6 @@ void FWidget::hide()
}
}
//----------------------------------------------------------------------
inline bool FWidget::setEnable(bool on)
{
return enable = (on) ? true : false;
}
//----------------------------------------------------------------------
inline bool FWidget::setVisibleCursor(bool on)
{
return visibleCursor = (on) ? true : false;
}
//----------------------------------------------------------------------
bool FWidget::focusFirstChild (void)
{
@ -1446,27 +1416,6 @@ bool FWidget::setFocus(bool on)
return focus = (on) ? true : false;
}
//----------------------------------------------------------------------
FPoint FWidget::globalToLocalPos (const FPoint& gPos)
{
return FPoint ( gPos.getX() - xpos - xmin + 2
, gPos.getY() - ypos - ymin + 2 );
}
//----------------------------------------------------------------------
void FWidget::setForegroundColor (int color)
{
if ( color >> 8 == 0 ) // valid colors 0..254
foregroundColor = color;
}
//----------------------------------------------------------------------
void FWidget::setBackgroundColor (int color)
{
if ( color >> 8 == 0 ) // valid colors 0..254
backgroundColor = color;
}
//----------------------------------------------------------------------
void FWidget::setX (int x, bool adjust)
{
@ -1513,12 +1462,6 @@ void FWidget::setY (int y, bool adjust)
adjustSize();
}
//----------------------------------------------------------------------
inline void FWidget::setPos (const FPoint& p, bool adjust)
{
setPos (p.getX(), p.getY(), adjust);
}
//----------------------------------------------------------------------
void FWidget::setPos (int x, int y, bool adjust)
{
@ -1668,16 +1611,6 @@ void FWidget::setTermGeometry (int w, int h)
}
}
//----------------------------------------------------------------------
inline void FWidget::setGeometry (const FRect& box, bool adjust)
{
setGeometry ( box.getX()
, box.getY()
, box.getWidth()
, box.getHeight()
, adjust );
}
//----------------------------------------------------------------------
void FWidget::setGeometry (int x, int y, int w, int h, bool adjust)
{
@ -1720,12 +1653,6 @@ void FWidget::setGeometry (int x, int y, int w, int h, bool adjust)
double_flatline_mask.left.resize (uLong(height), false);
}
//----------------------------------------------------------------------
inline void FWidget::move (const FPoint& pos)
{
move( pos.getX(), pos.getY() );
}
//----------------------------------------------------------------------
void FWidget::move (int x, int y)
{
@ -1761,12 +1688,6 @@ bool FWidget::setCursor()
return false;
}
//----------------------------------------------------------------------
bool FWidget::setCursorPos (const FPoint& pos)
{
return setCursorPos (pos.getX(), pos.getY());
}
//----------------------------------------------------------------------
bool FWidget::setCursorPos (register int x, register int y)
{
@ -1778,24 +1699,6 @@ bool FWidget::setCursorPos (register int x, register int y)
return false;
}
//----------------------------------------------------------------------
inline void FWidget::unsetCursorPos()
{
widgetCursorPosition.setPoint(-1,-1);
}
//----------------------------------------------------------------------
void FWidget::gotoxy (const FPoint& pos)
{
gotoxy (pos.getX(), pos.getY());
}
//----------------------------------------------------------------------
void FWidget::gotoxy (register int x, register int y)
{
cursor->setPoint(x,y);
}
//----------------------------------------------------------------------
void FWidget::clrscr()
{
@ -1841,24 +1744,6 @@ void FWidget::clrscr()
putArea (xpos+xmin-1, ypos+ymin-1, area);
}
//----------------------------------------------------------------------
bool FWidget::setBold (register bool on)
{
return (bold = on);
}
//----------------------------------------------------------------------
bool FWidget::setReverse (register bool on)
{
return (reverse = on);
}
//----------------------------------------------------------------------
bool FWidget::setUnderline (register bool on)
{
return (underline = on);
}
//----------------------------------------------------------------------
void FWidget::drawShadow()
{

View File

@ -285,37 +285,37 @@ class FWidget : public FObject, public FTerm
private:
FWidget (const FWidget&);
FWidget& operator = (const FWidget&);
void init();
void finish();
void processDestroy();
virtual void draw();
static void setColorTheme();
term_area* getPrintArea();
void setPrintArea(term_area*);
void init();
void finish();
void processDestroy();
virtual void draw();
static void setColorTheme();
term_area* getPrintArea();
void setPrintArea (term_area*);
protected:
virtual void adjustSize();
virtual void setStatusBar (FStatusBar*);
virtual void setMenuBar (FMenuBar*);
virtual void adjustSize();
virtual void setStatusBar (FStatusBar*);
virtual void setMenuBar (FMenuBar*);
// Event handlers
bool event (FEvent*);
virtual void onKeyPress (FKeyEvent*);
virtual void onKeyUp (FKeyEvent*);
virtual void onKeyDown (FKeyEvent*);
virtual void onMouseDown (FMouseEvent*);
virtual void onMouseUp (FMouseEvent*);
virtual void onMouseDoubleClick (FMouseEvent*);
virtual void onWheel (FWheelEvent*);
virtual void onMouseMove (FMouseEvent*);
virtual void onFocusIn (FFocusEvent*);
virtual void onFocusOut (FFocusEvent*);
virtual void onAccel (FAccelEvent*);
virtual void onResize (FResizeEvent*);
virtual void onShow (FShowEvent*);
virtual void onHide (FHideEvent*);
virtual void onClose (FCloseEvent*);
virtual bool focusNextChild (void);
virtual bool focusPrevChild (void);
bool event (FEvent*);
virtual void onKeyPress (FKeyEvent*);
virtual void onKeyUp (FKeyEvent*);
virtual void onKeyDown (FKeyEvent*);
virtual void onMouseDown (FMouseEvent*);
virtual void onMouseUp (FMouseEvent*);
virtual void onMouseDoubleClick (FMouseEvent*);
virtual void onWheel (FWheelEvent*);
virtual void onMouseMove (FMouseEvent*);
virtual void onFocusIn (FFocusEvent*);
virtual void onFocusOut (FFocusEvent*);
virtual void onAccel (FAccelEvent*);
virtual void onResize (FResizeEvent*);
virtual void onShow (FShowEvent*);
virtual void onHide (FHideEvent*);
virtual void onClose (FCloseEvent*);
virtual bool focusNextChild (void);
virtual bool focusPrevChild (void);
public:
explicit FWidget (FWidget* = 0); // constructor
@ -339,143 +339,156 @@ class FWidget : public FObject, public FTerm
static FStatusBar* statusBar();
static FMenuBar* menuBar();
void setStatusbarMessage (FString);
void clearStatusbarMessage();
FString getStatusbarMessage();
void setStatusbarMessage (FString);
void clearStatusbarMessage();
FString getStatusbarMessage();
void addCallback ( FString
, FCallback
, void* = null );
void addCallback ( FString
, FWidget*
, FMemberCallback
, void* = null );
void delCallback (FCallback);
void delCallback (FWidget*);
void emitCallback (FString);
void addCallback ( FString
, FCallback
, void* = null );
void addCallback ( FString
, FWidget*
, FMemberCallback
, void* = null );
void delCallback (FCallback);
void delCallback (FWidget*);
void emitCallback (FString);
void addAccelerator (int key);
void addAccelerator (int, FWidget*);
void delAccelerator (FWidget*);
void addAccelerator (int key);
void addAccelerator (int, FWidget*);
void delAccelerator (FWidget*);
virtual void redraw();
virtual void resize();
virtual void show();
virtual void hide();
bool setVisible();
bool isVisible() const;
bool isShown() const;
virtual void redraw();
virtual void resize();
virtual void show();
virtual void hide();
bool setVisible();
bool isVisible() const;
bool isShown() const;
virtual bool setEnable(bool);
virtual bool setEnable();
virtual bool unsetEnable();
virtual bool setDisable();
bool isEnabled() const;
virtual bool setEnable(bool);
virtual bool setEnable();
virtual bool unsetEnable();
virtual bool setDisable();
bool isEnabled() const;
virtual bool setVisibleCursor(bool);
virtual bool setVisibleCursor();
virtual bool unsetVisibleCursor();
bool hasVisibleCursor() const;
virtual bool setVisibleCursor(bool);
virtual bool setVisibleCursor();
virtual bool unsetVisibleCursor();
bool hasVisibleCursor() const;
virtual bool focusFirstChild (void);
virtual bool focusLastChild (void);
virtual bool setFocus(bool);
virtual bool setFocus();
virtual bool unsetFocus();
bool hasFocus() const;
bool acceptFocus() const;
void setFocusable();
void unsetFocusable();
virtual bool focusFirstChild (void);
virtual bool focusLastChild (void);
virtual bool setFocus(bool);
virtual bool setFocus();
virtual bool unsetFocus();
bool hasFocus() const;
bool acceptFocus() const;
void setFocusable();
void unsetFocusable();
bool ignorePadding(bool);
bool ignorePadding();
bool acceptPadding();
bool ignorePadding(bool);
bool ignorePadding();
bool acceptPadding();
int getForegroundColor() const;
int getBackgroundColor() const;
int getX() const;
int getY() const;
const FPoint getPos() const;
int getGlobalX() const;
int getGlobalY() const;
const FPoint getGlobalPos() const;
int getWidth() const;
int getHeight() const;
int getTopPadding() const;
int getLeftPadding() const;
int getBottomPadding() const;
int getRightPadding() const;
int getClientWidth() const;
int getClientHeight() const;
const FPoint& getShadow() const;
const FRect& getGeometry() const;
const FRect& getGeometryShadow() const;
const FRect& getGeometryGlobal() const;
const FRect& getGeometryGlobalShadow() const;
FPoint globalToLocalPos(const FPoint&);
void setForegroundColor (int);
void setBackgroundColor (int);
void setX (int, bool = true);
void setY (int, bool = true);
void setPos (const FPoint&, bool = true);
void setPos (int, int, bool = true);
void setWidth (int, bool = true);
void setHeight (int, bool = true);
void setTopPadding (int, bool = true);
void setLeftPadding (int, bool = true);
void setBottomPadding (int, bool = true);
void setRightPadding (int, bool = true);
void getTermGeometry();
void setTermGeometry (int, int);
virtual void setGeometry (const FRect&, bool = true);
virtual void setGeometry (int, int, int, int, bool = true);
virtual void move (const FPoint&);
virtual void move (int x, int y);
int getFlags() const;
int getForegroundColor() const;
int getBackgroundColor() const;
int getX() const;
int getY() const;
const FPoint getPos() const;
int getGlobalX() const;
int getGlobalY() const;
const FPoint getGlobalPos() const;
int getWidth() const;
int getHeight() const;
int getTopPadding() const;
int getLeftPadding() const;
int getBottomPadding() const;
int getRightPadding() const;
int getClientWidth() const;
int getClientHeight() const;
const FPoint& getShadow() const;
const FRect& getGeometry() const;
const FRect& getGeometryShadow() const;
const FRect& getGeometryGlobal() const;
const FRect& getGeometryGlobalShadow() const;
FPoint globalToLocalPos (const FPoint&);
void setForegroundColor (int);
void setBackgroundColor (int);
void setX (int, bool = true);
void setY (int, bool = true);
void setPos (const FPoint&, bool = true);
void setPos (int, int, bool = true);
void setWidth (int, bool = true);
void setHeight (int, bool = true);
void setTopPadding (int, bool = true);
void setLeftPadding (int, bool = true);
void setBottomPadding (int, bool = true);
void setRightPadding (int, bool = true);
void getTermGeometry();
void setTermGeometry (int, int);
virtual void setGeometry (const FRect&, bool = true);
virtual void setGeometry (int, int, int, int, bool = true);
virtual void move (const FPoint&);
virtual void move (int x, int y);
int getFlags() const;
bool setCursor();
FPoint getCursorPos();
bool setCursorPos (const FPoint&);
bool setCursorPos (register int, register int);
void unsetCursorPos();
bool setCursor();
FPoint getCursorPos();
bool setCursorPos (const FPoint&);
bool setCursorPos (register int, register int);
void unsetCursorPos();
static void gotoxy (const FPoint&);
static void gotoxy (register int, register int);
void clrscr();
static void gotoxy (const FPoint&);
static void gotoxy (register int, register int);
void clrscr();
static bool setBold(register bool);
static bool setBold();
static bool unsetBold();
static bool isBold();
static bool setBold(register bool);
static bool setBold();
static bool unsetBold();
static bool isBold();
static bool setReverse(register bool);
static bool setReverse();
static bool unsetReverse();
static bool isReverse();
static bool setReverse(register bool);
static bool setReverse();
static bool unsetReverse();
static bool isReverse();
static bool setUnderline(register bool);
static bool setUnderline();
static bool unsetUnderline();
static bool isUnderline();
static bool setUnderline(register bool);
static bool setUnderline();
static bool unsetUnderline();
static bool isUnderline();
void drawShadow();
void clearShadow();
void drawFlatBorder();
void clearFlatBorder();
void setDoubleFlatLine(int, bool = true);
void unsetDoubleFlatLine(int);
void drawShadow();
void clearShadow();
void drawFlatBorder();
void clearFlatBorder();
void setDoubleFlatLine(int, bool = true);
void unsetDoubleFlatLine(int);
std::vector<bool>& doubleFlatLine_ref(int);
virtual void drawBorder();
virtual void drawBorder();
static void quit();
static void quit();
};
#pragma pack(pop)
// FWidget inline functions
//----------------------------------------------------------------------
inline void FWidget::processDestroy()
{ emitCallback("destroy"); }
//----------------------------------------------------------------------
inline void FWidget::setPrintArea (term_area* area)
{ print_area = area; }
//----------------------------------------------------------------------
inline const char* FWidget::getClassName() const
{ return "FWidget"; }
//----------------------------------------------------------------------
inline FWidget* FWidget::childWidgetAt (FWidget* p, const FPoint& pos)
{ return childWidgetAt (p, pos.getX(), pos.getY()); }
//----------------------------------------------------------------------
inline FWidget* FWidget::parentWidget() const
{ return static_cast<FWidget*>(getParent()); }
@ -512,6 +525,10 @@ inline bool FWidget::isShown() const
inline bool FWidget::isWindow() const
{ return window_object; }
//----------------------------------------------------------------------
inline bool FWidget::setEnable (bool on)
{ return enable = (on) ? true : false; }
//----------------------------------------------------------------------
inline bool FWidget::setEnable()
{ return setEnable(true); }
@ -528,6 +545,10 @@ inline bool FWidget::setDisable()
inline bool FWidget::isEnabled() const
{ return enable; }
//----------------------------------------------------------------------
inline bool FWidget::setVisibleCursor (bool on)
{ return visibleCursor = (on) ? true : false; }
//----------------------------------------------------------------------
inline bool FWidget::setVisibleCursor()
{ return setVisibleCursor(true); }
@ -608,6 +629,31 @@ inline int FWidget::getGlobalY() const
inline const FPoint FWidget::getGlobalPos() const
{ return FPoint(xpos+xmin-1, ypos+ymin-1); }
//----------------------------------------------------------------------
inline FPoint FWidget::globalToLocalPos (const FPoint& gPos)
{
return FPoint ( gPos.getX() - xpos - xmin + 2
, gPos.getY() - ypos - ymin + 2 );
}
//----------------------------------------------------------------------
inline void FWidget::setForegroundColor (int color)
{
if ( color >> 8 == 0 ) // valid colors 0..254
foregroundColor = color;
}
//----------------------------------------------------------------------
inline void FWidget::setBackgroundColor (int color)
{
if ( color >> 8 == 0 ) // valid colors 0..254
backgroundColor = color;
}
//----------------------------------------------------------------------
inline void FWidget::setPos (const FPoint& p, bool adjust)
{ setPos (p.getX(), p.getY(), adjust); }
//----------------------------------------------------------------------
inline int FWidget::getWidth() const
{ return width; }
@ -660,6 +706,20 @@ inline const FRect& FWidget::getGeometryGlobal() const
inline const FRect& FWidget::getGeometryGlobalShadow() const
{ return adjustWidgetSizeGlobalShadow; }
//----------------------------------------------------------------------
inline void FWidget::setGeometry (const FRect& box, bool adjust)
{
setGeometry ( box.getX()
, box.getY()
, box.getWidth()
, box.getHeight()
, adjust );
}
//----------------------------------------------------------------------
inline void FWidget::move (const FPoint& pos)
{ move( pos.getX(), pos.getY() ); }
//----------------------------------------------------------------------
inline int FWidget::getFlags() const
{ return flags; }
@ -668,6 +728,26 @@ inline int FWidget::getFlags() const
inline FPoint FWidget::getCursorPos()
{ return widgetCursorPosition; }
//----------------------------------------------------------------------
inline bool FWidget::setCursorPos (const FPoint& pos)
{ return setCursorPos (pos.getX(), pos.getY()); }
//----------------------------------------------------------------------
inline void FWidget::unsetCursorPos()
{ widgetCursorPosition.setPoint(-1,-1); }
//----------------------------------------------------------------------
inline void FWidget::gotoxy (const FPoint& pos)
{ gotoxy (pos.getX(), pos.getY()); }
//----------------------------------------------------------------------
inline void FWidget::gotoxy (register int x, register int y)
{ cursor->setPoint(x,y); }
//----------------------------------------------------------------------
inline bool FWidget::setBold (register bool on)
{ return (bold = on); }
//----------------------------------------------------------------------
inline bool FWidget::setBold()
{ return setBold(true); }
@ -680,6 +760,10 @@ inline bool FWidget::unsetBold()
inline bool FWidget::isBold()
{ return bold; }
//----------------------------------------------------------------------
inline bool FWidget::setReverse (register bool on)
{ return (reverse = on); }
//----------------------------------------------------------------------
inline bool FWidget::setReverse()
{ return setReverse(true); }
@ -692,6 +776,10 @@ inline bool FWidget::unsetReverse()
inline bool FWidget::isReverse()
{ return reverse; }
//----------------------------------------------------------------------
inline bool FWidget::setUnderline (register bool on)
{ return (underline = on); }
//----------------------------------------------------------------------
inline bool FWidget::setUnderline()
{ return setUnderline(true); }

View File

@ -86,12 +86,6 @@ void FWindow::hide()
FWidget::hide();
}
//----------------------------------------------------------------------
FWindow* FWindow::windowWidgetAt(const FPoint& pos)
{
return windowWidgetAt(pos.getX(), pos.getY());
}
//----------------------------------------------------------------------
FWindow* FWindow::windowWidgetAt(int x, int y)
{

View File

@ -91,6 +91,10 @@ class FWindow : public FWidget
inline const char* FWindow::getClassName() const
{ return "FWindow"; }
//----------------------------------------------------------------------
inline FWindow* FWindow::windowWidgetAt (const FPoint& pos)
{ return windowWidgetAt(pos.getX(), pos.getY()); }
//----------------------------------------------------------------------
inline bool FWindow::raiseWindow()
{ return raiseWindow(this); }