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> 2015-10-16 Markus Gans <guru.mail@muenster.de>
* Fixed: calculator behavior for negative values * Fixed: calculator behavior for negative values
in trigonometric functions in trigonometric functions

View File

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

View File

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

View File

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

View File

@ -123,7 +123,7 @@ void FDialog::init()
setFocus(); setFocus();
old_focus->redraw(); 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) ) while ( y < text_lines && y < uInt(height) )
{ {
length = multiline_text[y].getLength(); 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()); src = const_cast<wchar_t*>(multiline_text[y].wc_str());
dest = const_cast<wchar_t*>(LabelText); dest = const_cast<wchar_t*>(LabelText);
@ -285,7 +285,7 @@ void FLabel::draw()
else else
{ {
length = text.getLength(); length = text.getLength();
LabelText = new wchar_t[length+1]; LabelText = new wchar_t[length+1]();
src = const_cast<wchar_t*>(text.wc_str()); src = const_cast<wchar_t*>(text.wc_str());
dest = const_cast<wchar_t*>(LabelText); dest = const_cast<wchar_t*>(LabelText);

View File

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

View File

@ -180,7 +180,7 @@ void FMenuBar::drawItems()
txt = (*iter)->getText(); txt = (*iter)->getText();
txt_length = uInt(txt.getLength()); 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()); src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(item_text); dest = const_cast<wchar_t*>(item_text);

View File

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

View File

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

View File

@ -288,10 +288,8 @@ int FTerm::getScreenFont()
font.width = 32; font.width = 32;
font.height = 32; font.height = 32;
font.charcount = 512; font.charcount = 512;
font.data = new uChar[data_size];
// initialize with 0 // initialize with 0
memset(font.data, 0, data_size); font.data = new uChar[data_size]();
// font operation // font operation
ret = ioctl (fd_tty, KDFONTOP, &font); ret = ioctl (fd_tty, KDFONTOP, &font);
@ -337,7 +335,7 @@ int FTerm::setScreenFont ( uChar* fontdata, uInt count
try try
{ {
font.data = new uChar[data_size]; font.data = new uChar[data_size](); // initialize with 0
} }
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
@ -345,9 +343,6 @@ int FTerm::setScreenFont ( uChar* fontdata, uInt count
return -1; return -1;
} }
// initialize with 0
memset(font.data, 0, data_size);
for (uInt i=0; i < count; i++) for (uInt i=0; i < count; i++)
memcpy ( const_cast<uChar*>(font.data + bytes_per_line*32*i) memcpy ( const_cast<uChar*>(font.data + bytes_per_line*32*i)
, &fontdata[i * font.height] , &fontdata[i * font.height]
@ -397,7 +392,7 @@ int FTerm::getUnicodeMap()
try try
{ {
unimap.entries = new struct unipair[count]; unimap.entries = new struct unipair[count]();
} }
catch (const std::bad_alloc& ex) 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 bool FTerm::isCovered(int x, int y, FTerm::term_area* area) const
{ {
@ -2084,14 +2070,6 @@ void FTerm::setUpdateVTerm (bool on)
updateVTerm (last_area); 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) 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) 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) FTerm::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj)
{ {
@ -2703,7 +2665,7 @@ void FTerm::setKDECursor(fc::kde_konsole_CursorShape style)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString FTerm::getXTermFont() FString FTerm::getXTermFont()
{ {
FString font = ""; FString font("");
if ( raw_mode && non_blocking_stdin ) if ( raw_mode && non_blocking_stdin )
{ {
@ -2714,7 +2676,7 @@ FString FTerm::getXTermFont()
usleep(150000); // wait 150 ms usleep(150000); // wait 150 ms
// read the answer // read the answer
n = int(read(fileno(stdin), &temp, sizeof(temp)-1)); 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 ) if ( n >= 2 && temp[n-1] == '\\' && temp[n-2] == 0x1b )
{ {
temp[n-2] = '\0'; temp[n-2] = '\0';
@ -2730,7 +2692,7 @@ FString FTerm::getXTermFont()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString FTerm::getXTermTitle() FString FTerm::getXTermTitle()
{ {
FString title = ""; FString title("");
if ( kde_konsole ) if ( kde_konsole )
return title; return title;
@ -2744,7 +2706,7 @@ FString FTerm::getXTermTitle()
usleep(150000); // wait 150 ms usleep(150000); // wait 150 ms
// read the answer // read the answer
n = int(read(fileno(stdin), &temp, sizeof(temp)-1)); 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 ) if ( n >= 2 && temp[n-1] == '\\' && temp[n-2] == 0x1b )
{ {
temp[n-2] = '\0'; temp[n-2] = '\0';
@ -3713,7 +3675,7 @@ int FTerm::printf (const char* format, ...)
if ( len >= int(sizeof(buf)) ) if ( len >= int(sizeof(buf)) )
{ {
buffer = new char[len+1]; buffer = new char[len+1]();
va_start (args, format); va_start (args, format);
vsnprintf (buffer, uLong(len+1), format, args); vsnprintf (buffer, uLong(len+1), format, args);
va_end (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 if ( screen_attr->fg_color != fg_term_color
|| screen_attr->bg_color != bg_term_color ) || screen_attr->bg_color != bg_term_color )

View File

@ -431,15 +431,37 @@ class FTerm
}; };
#pragma pack(pop) #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 inline const char* FTerm::getClassName() const
{ return "FTerm"; } { return "FTerm"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FTerm::term_area* FTerm::getVWin() const inline FTerm::term_area* FTerm::getVWin() const
{ { return vwin; }
return vwin;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline int FTerm::getLineNumber() inline int FTerm::getLineNumber()

View File

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

View File

@ -124,8 +124,8 @@ FWidget::~FWidget() // destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::init() void FWidget::init()
{ {
window_list = new widgetList; window_list = new widgetList();
close_widget = new widgetList; close_widget = new widgetList();
getTermGeometry(); // <-----. getTermGeometry(); // <-----.
// | // |
@ -161,7 +161,7 @@ void FWidget::init()
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
clrscr(); 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() 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 // protected methods of FWidget
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::adjustSize() void FWidget::adjustSize()
@ -839,12 +827,6 @@ void FWidget::setMainWidget(FWidget* obj)
fapp->setMainWidget(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) 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); FWidget* focus_widget = static_cast<FWidget*>(FApplication::focus_widget);
return focus_widget; return focus_widget;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FWidget::setFocusWidget(FWidget* obj) void FWidget::setFocusWidget(FWidget* obj)
{ {
FApplication::focus_widget = 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) bool FWidget::focusFirstChild (void)
{ {
@ -1446,27 +1416,6 @@ bool FWidget::setFocus(bool on)
return focus = (on) ? true : false; 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) void FWidget::setX (int x, bool adjust)
{ {
@ -1513,12 +1462,6 @@ void FWidget::setY (int y, bool adjust)
adjustSize(); 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) 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) 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); 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) void FWidget::move (int x, int y)
{ {
@ -1761,12 +1688,6 @@ bool FWidget::setCursor()
return false; return false;
} }
//----------------------------------------------------------------------
bool FWidget::setCursorPos (const FPoint& pos)
{
return setCursorPos (pos.getX(), pos.getY());
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FWidget::setCursorPos (register int x, register int y) bool FWidget::setCursorPos (register int x, register int y)
{ {
@ -1778,24 +1699,6 @@ bool FWidget::setCursorPos (register int x, register int y)
return false; 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() void FWidget::clrscr()
{ {
@ -1841,24 +1744,6 @@ void FWidget::clrscr()
putArea (xpos+xmin-1, ypos+ymin-1, area); 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() void FWidget::drawShadow()
{ {

View File

@ -472,10 +472,23 @@ class FWidget : public FObject, public FTerm
#pragma pack(pop) #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 inline const char* FWidget::getClassName() const
{ return "FWidget"; } { return "FWidget"; }
//----------------------------------------------------------------------
inline FWidget* FWidget::childWidgetAt (FWidget* p, const FPoint& pos)
{ return childWidgetAt (p, pos.getX(), pos.getY()); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FWidget* FWidget::parentWidget() const inline FWidget* FWidget::parentWidget() const
{ return static_cast<FWidget*>(getParent()); } { return static_cast<FWidget*>(getParent()); }
@ -512,6 +525,10 @@ inline bool FWidget::isShown() const
inline bool FWidget::isWindow() const inline bool FWidget::isWindow() const
{ return window_object; } { return window_object; }
//----------------------------------------------------------------------
inline bool FWidget::setEnable (bool on)
{ return enable = (on) ? true : false; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::setEnable() inline bool FWidget::setEnable()
{ return setEnable(true); } { return setEnable(true); }
@ -528,6 +545,10 @@ inline bool FWidget::setDisable()
inline bool FWidget::isEnabled() const inline bool FWidget::isEnabled() const
{ return enable; } { return enable; }
//----------------------------------------------------------------------
inline bool FWidget::setVisibleCursor (bool on)
{ return visibleCursor = (on) ? true : false; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::setVisibleCursor() inline bool FWidget::setVisibleCursor()
{ return setVisibleCursor(true); } { return setVisibleCursor(true); }
@ -608,6 +629,31 @@ inline int FWidget::getGlobalY() const
inline const FPoint FWidget::getGlobalPos() const inline const FPoint FWidget::getGlobalPos() const
{ return FPoint(xpos+xmin-1, ypos+ymin-1); } { 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 inline int FWidget::getWidth() const
{ return width; } { return width; }
@ -660,6 +706,20 @@ inline const FRect& FWidget::getGeometryGlobal() const
inline const FRect& FWidget::getGeometryGlobalShadow() const inline const FRect& FWidget::getGeometryGlobalShadow() const
{ return adjustWidgetSizeGlobalShadow; } { 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 inline int FWidget::getFlags() const
{ return flags; } { return flags; }
@ -668,6 +728,26 @@ inline int FWidget::getFlags() const
inline FPoint FWidget::getCursorPos() inline FPoint FWidget::getCursorPos()
{ return widgetCursorPosition; } { 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() inline bool FWidget::setBold()
{ return setBold(true); } { return setBold(true); }
@ -680,6 +760,10 @@ inline bool FWidget::unsetBold()
inline bool FWidget::isBold() inline bool FWidget::isBold()
{ return bold; } { return bold; }
//----------------------------------------------------------------------
inline bool FWidget::setReverse (register bool on)
{ return (reverse = on); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::setReverse() inline bool FWidget::setReverse()
{ return setReverse(true); } { return setReverse(true); }
@ -692,6 +776,10 @@ inline bool FWidget::unsetReverse()
inline bool FWidget::isReverse() inline bool FWidget::isReverse()
{ return reverse; } { return reverse; }
//----------------------------------------------------------------------
inline bool FWidget::setUnderline (register bool on)
{ return (underline = on); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::setUnderline() inline bool FWidget::setUnderline()
{ return setUnderline(true); } { return setUnderline(true); }

View File

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

View File

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