More constant character pointers

This commit is contained in:
Markus Gans 2017-03-17 22:59:06 +01:00
parent 06ec274d00
commit 05c61f1901
41 changed files with 330 additions and 632 deletions

View File

@ -1,3 +1,6 @@
2017-03-17 Markus Gans <guru.mail@muenster.de>
* More constant character pointers
2017-03-13 Markus Gans <guru.mail@muenster.de> 2017-03-13 Markus Gans <guru.mail@muenster.de>
* Corrects directly the input cursor position on window moving * Corrects directly the input cursor position on window moving

View File

@ -20,6 +20,11 @@ Missing Features
└──► tmp └──► tmp
--------------------------------------- ---------------------------------------
- The FSlider() widget
. . . . . . . . .
────▲────────────
0 2 4 6 8
- Adding for flexible layouts a FGrid widget container that organizes - Adding for flexible layouts a FGrid widget container that organizes
its child widgets in rows and columns its child widgets in rows and columns

View File

@ -163,8 +163,8 @@ bool FButton::setFocus (bool on)
{ {
if ( getStatusBar() ) if ( getStatusBar() )
{ {
FString msg = getStatusbarMessage(); const FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage(); const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
getStatusBar()->setMessage(msg); getStatusBar()->setMessage(msg);
@ -734,8 +734,8 @@ void FButton::draw()
if ( is_Focus && getStatusBar() ) if ( is_Focus && getStatusBar() )
{ {
FString msg = getStatusbarMessage(); const FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage(); const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
{ {

View File

@ -17,21 +17,7 @@ FCheckMenuItem::FCheckMenuItem (FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FCheckMenuItem::FCheckMenuItem (FString& txt, FWidget* parent) FCheckMenuItem::FCheckMenuItem (const FString& txt, FWidget* parent)
: FMenuItem(txt, parent)
{
init (parent);
}
//----------------------------------------------------------------------
FCheckMenuItem::FCheckMenuItem (const std::string& txt, FWidget* parent)
: FMenuItem(txt, parent)
{
init (parent);
}
//----------------------------------------------------------------------
FCheckMenuItem::FCheckMenuItem (const char* txt, FWidget* parent)
: FMenuItem(txt, parent) : FMenuItem(txt, parent)
{ {
init (parent); init (parent);

View File

@ -48,9 +48,7 @@ class FCheckMenuItem : public FMenuItem
public: public:
// Constructors // Constructors
explicit FCheckMenuItem (FWidget* = 0); explicit FCheckMenuItem (FWidget* = 0);
FCheckMenuItem (FString&, FWidget* = 0); FCheckMenuItem (const FString&, FWidget* = 0);
FCheckMenuItem (const std::string&, FWidget* = 0);
FCheckMenuItem (const char*, FWidget* = 0);
// Destructor // Destructor
virtual ~FCheckMenuItem(); virtual ~FCheckMenuItem();

View File

@ -17,29 +17,12 @@ FDialogListMenu::FDialogListMenu(FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FDialogListMenu::FDialogListMenu (FString& txt, FWidget* parent) FDialogListMenu::FDialogListMenu (const FString& txt, FWidget* parent)
: FMenu(txt, parent) : FMenu(txt, parent)
{ {
init(); init();
} }
//----------------------------------------------------------------------
FDialogListMenu::FDialogListMenu (const std::string& txt, FWidget* parent)
: FMenu(txt, parent)
{
init();
}
//----------------------------------------------------------------------
FDialogListMenu::FDialogListMenu (const char* txt, FWidget* parent)
: FMenu(txt, parent)
{
init();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FDialogListMenu::~FDialogListMenu() FDialogListMenu::~FDialogListMenu()
{ } { }

View File

@ -55,9 +55,7 @@ class FDialogListMenu : public FMenu
public: public:
// Constructors // Constructors
explicit FDialogListMenu (FWidget* = 0); explicit FDialogListMenu (FWidget* = 0);
FDialogListMenu (FString&, FWidget* = 0); FDialogListMenu (const FString&, FWidget* = 0);
FDialogListMenu (const std::string&, FWidget* = 0);
FDialogListMenu (const char*, FWidget* = 0);
// Destructor // Destructor
virtual ~FDialogListMenu(); virtual ~FDialogListMenu();

View File

@ -151,7 +151,7 @@ const FString FFileDialog::getSelectedFile() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FFileDialog::setPath (const FString& dir) void FFileDialog::setPath (const FString& dir)
{ {
const char* dirname = dir.c_str(); const char* const dirname = dir.c_str();
char resolved_path[MAXPATHLEN]; char resolved_path[MAXPATHLEN];
FString r_dir; FString r_dir;
struct stat sb; struct stat sb;
@ -237,8 +237,8 @@ void FFileDialog::onKeyPress (FKeyEvent* ev)
int FFileDialog::readDir() int FFileDialog::readDir()
{ {
int start, dir_num; int start, dir_num;
const char* dir = directory.c_str(); const char* const dir = directory.c_str();
const char* filter = filter_pattern.c_str(); const char* const filter = filter_pattern.c_str();
errno = 0; errno = 0;
directory_stream = opendir(dir); directory_stream = opendir(dir);
@ -355,9 +355,9 @@ int FFileDialog::readDir()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString FFileDialog::fileOpenChooser ( FWidget* parent const FString FFileDialog::fileOpenChooser ( FWidget* parent
, const FString& dirname , const FString& dirname
, const FString& filter ) , const FString& filter )
{ {
FFileDialog* fileopen; FFileDialog* fileopen;
FString ret; FString ret;
@ -390,9 +390,9 @@ FString FFileDialog::fileOpenChooser ( FWidget* parent
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString FFileDialog::fileSaveChooser ( FWidget* parent const FString FFileDialog::fileSaveChooser ( FWidget* parent
, const FString& dirname , const FString& dirname
, const FString& filter ) , const FString& filter )
{ {
FFileDialog* fileopen; FFileDialog* fileopen;
FString ret; FString ret;
@ -572,8 +572,8 @@ char* FFileDialog::getHomeDir()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FFileDialog::pattern_match ( const char* pattern inline bool FFileDialog::pattern_match ( const char* const pattern
, const char* fname ) , char*& fname )
{ {
char search[128] = {}; char search[128] = {};
@ -669,7 +669,7 @@ int FFileDialog::changeDir (const FString& dirname)
{ {
int i = 1; int i = 1;
std::vector<dir_entry>::const_iterator iter, end; std::vector<dir_entry>::const_iterator iter, end;
const char* baseName = basename(const_cast<char*>(lastdir.c_str())); const char* const baseName = basename(const_cast<char*>(lastdir.c_str()));
iter = dir_entries.begin(); iter = dir_entries.begin();
end = dir_entries.end(); end = dir_entries.end();

View File

@ -106,12 +106,12 @@ class FFileDialog : public FDialog
// Methods // Methods
int readDir(); int readDir();
static FString fileOpenChooser ( FWidget* static const FString fileOpenChooser ( FWidget*
, const FString& = FString() , const FString& = FString()
, const FString& = FString() ); , const FString& = FString() );
static FString fileSaveChooser ( FWidget* static const FString fileSaveChooser ( FWidget*
, const FString& = FString() , const FString& = FString()
, const FString& = FString() ); , const FString& = FString() );
protected: protected:
// Method // Method
@ -130,7 +130,7 @@ class FFileDialog : public FDialog
// Method // Method
void init(); void init();
static char* getHomeDir(); static char* getHomeDir();
inline bool pattern_match (const char*, const char*); inline bool pattern_match (const char* const, char*&);
void clear(); void clear();
int numOfDirs(); int numOfDirs();
int changeDir (const FString&); int changeDir (const FString&);

View File

@ -108,8 +108,8 @@ bool FLineEdit::setFocus (bool on)
if ( getStatusBar() ) if ( getStatusBar() )
{ {
FString msg = getStatusbarMessage(); const FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage(); const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
getStatusBar()->setMessage(msg); getStatusBar()->setMessage(msg);
@ -153,7 +153,7 @@ bool FLineEdit::setShadow (bool on)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FLineEdit::setText (FString txt) void FLineEdit::setText (const FString txt)
{ {
text_offset = 0; text_offset = 0;
cursor_pos = 0; cursor_pos = 0;
@ -165,7 +165,7 @@ void FLineEdit::setText (FString txt)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FLineEdit::setLabelText (FString ltxt) void FLineEdit::setLabelText (const FString ltxt)
{ {
label_text = ltxt; label_text = ltxt;
label->setText(label_text); label->setText(label_text);
@ -173,7 +173,7 @@ void FLineEdit::setLabelText (FString ltxt)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FLineEdit::setLabelOrientation(label_o o) void FLineEdit::setLabelOrientation(const label_o o)
{ {
label_orientation = o; label_orientation = o;
adjustLabel(); adjustLabel();
@ -734,8 +734,8 @@ void FLineEdit::draw()
if ( isFocus && getStatusBar() ) if ( isFocus && getStatusBar() )
{ {
FString msg = getStatusbarMessage(); const FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage(); const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
{ {

View File

@ -62,9 +62,9 @@ class FLineEdit : public FWidget
int getLabelOrientation(); int getLabelOrientation();
// Mutators // Mutators
void setText (FString); void setText (const FString);
void setLabelText (FString); void setLabelText (const FString);
void setLabelOrientation(label_o); void setLabelOrientation(const label_o);
bool setEnable(bool); bool setEnable(bool);
bool setEnable(); bool setEnable();
bool unsetEnable(); bool unsetEnable();

View File

@ -30,23 +30,7 @@ FListBoxItem::FListBoxItem (const FListBoxItem& item)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListBoxItem::FListBoxItem (FString& txt, FWidget::data_ptr data) FListBoxItem::FListBoxItem (const FString& txt, FWidget::data_ptr data)
: text(txt)
, data_pointer(data)
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem (const std::string& txt, FWidget::data_ptr data)
: text(txt)
, data_pointer(data)
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem (const char* txt, FWidget::data_ptr data)
: text(txt) : text(txt)
, data_pointer(data) , data_pointer(data)
, brackets(fc::NoBrackets) , brackets(fc::NoBrackets)
@ -211,8 +195,8 @@ bool FListBox::setFocus (bool on)
if ( getStatusBar() ) if ( getStatusBar() )
{ {
FString msg = getStatusbarMessage(); const FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage(); const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
getStatusBar()->setMessage(msg); getStatusBar()->setMessage(msg);
@ -230,7 +214,7 @@ bool FListBox::setFocus (bool on)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListBox::setText (FString txt) void FListBox::setText (const FString txt)
{ {
text = txt; text = txt;
} }
@ -277,7 +261,7 @@ void FListBox::hide()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListBox::insert ( FString item void FListBox::insert ( const FString item
, fc::brackets_type b , fc::brackets_type b
, bool s , bool s
, data_ptr d ) , data_ptr d )
@ -1687,7 +1671,6 @@ void FListBox::drawList()
if ( lineHasBrackets ) if ( lineHasBrackets )
{ {
const wchar_t* element_str;
int full_length; int full_length;
uInt len; uInt len;
uInt i = 0; uInt i = 0;
@ -1728,7 +1711,7 @@ void FListBox::drawList()
.mid ( uInt(xoffset) .mid ( uInt(xoffset)
, uInt(getWidth()-nf_offset-4) ); , uInt(getWidth()-nf_offset-4) );
element_str = element.wc_str(); const wchar_t* const& element_str = element.wc_str();
len = element.getLength(); len = element.getLength();
for (; i < len; i++) for (; i < len; i++)
@ -1788,12 +1771,11 @@ void FListBox::drawList()
} }
else // line has no brackets else // line has no brackets
{ {
const wchar_t* element_str;
uInt i, len; uInt i, len;
element = data[y+uInt(yoffset)].getText() element = data[y+uInt(yoffset)].getText()
.mid ( uInt(1+xoffset) .mid ( uInt(1+xoffset)
, uInt(getWidth()-nf_offset-4) ); , uInt(getWidth()-nf_offset-4) );
element_str = element.wc_str(); const wchar_t* const& element_str = element.wc_str();
len = element.getLength(); len = element.getLength();
if ( serach_mark ) if ( serach_mark )

View File

@ -48,9 +48,7 @@ class FListBoxItem
// Constructors // Constructors
FListBoxItem (); FListBoxItem ();
FListBoxItem (const FListBoxItem&); // copy constructor FListBoxItem (const FListBoxItem&); // copy constructor
explicit FListBoxItem (FString&, FWidget::data_ptr = 0); explicit FListBoxItem (const FString&, FWidget::data_ptr = 0);
explicit FListBoxItem (const std::string&, FWidget::data_ptr = 0);
explicit FListBoxItem (const char*, FWidget::data_ptr = 0);
// Destructor // Destructor
virtual ~FListBoxItem(); virtual ~FListBoxItem();
@ -64,9 +62,7 @@ class FListBoxItem
protected: protected:
// Mutators // Mutators
void setText (FString&); void setText (const FString&);
void setText (const std::string&);
void setText (const char*);
void setData (FWidget::data_ptr); void setData (FWidget::data_ptr);
private: private:
@ -92,15 +88,7 @@ inline FWidget::data_ptr FListBoxItem::getData() const
{ return data_pointer; } { return data_pointer; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FListBoxItem::setText (FString& txt) inline void FListBoxItem::setText (const FString& txt)
{ text = txt; }
//----------------------------------------------------------------------
inline void FListBoxItem::setText (const std::string& txt)
{ text = txt; }
//----------------------------------------------------------------------
inline void FListBoxItem::setText (const char* txt)
{ text = txt; } { text = txt; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -160,7 +148,7 @@ class FListBox : public FWidget
// Methods // Methods
void hide(); void hide();
void insert ( FString void insert ( const FString
, fc::brackets_type = fc::NoBrackets , fc::brackets_type = fc::NoBrackets
, bool = false , bool = false
, data_ptr = 0); , data_ptr = 0);

View File

@ -25,35 +25,7 @@ FMenu::FMenu(FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenu::FMenu (FString& txt, FWidget* parent) FMenu::FMenu (const FString& txt, FWidget* parent)
: FWindow(parent)
, item(0)
, super_menu(0)
, open_sub_menu(0)
, max_item_width(0)
, mouse_down(false)
, has_checkable_items(false)
{
item = new FMenuItem(txt, parent);
init(parent);
}
//----------------------------------------------------------------------
FMenu::FMenu (const std::string& txt, FWidget* parent)
: FWindow(parent)
, item(0)
, super_menu(0)
, open_sub_menu(0)
, max_item_width(0)
, mouse_down(false)
, has_checkable_items(false)
{
item = new FMenuItem(txt, parent);
init(parent);
}
//----------------------------------------------------------------------
FMenu::FMenu (const char* txt, FWidget* parent)
: FWindow(parent) : FWindow(parent)
, item(0) , item(0)
, super_menu(0) , super_menu(0)
@ -92,7 +64,7 @@ bool FMenu::setMenuWidget (bool on)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::setStatusbarMessage(FString msg) void FMenu::setStatusbarMessage (const FString msg)
{ {
FWidget::setStatusbarMessage(msg); FWidget::setStatusbarMessage(msg);
@ -650,8 +622,8 @@ void FMenu::onMouseMove (FMouseEvent* ev)
// Mouse is over border or separator // Mouse is over border or separator
if ( getStatusBar() ) if ( getStatusBar() )
{ {
FString msg = getStatusbarMessage(); const FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage(); const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
{ {

View File

@ -53,9 +53,7 @@ class FMenu : public FWindow, public FMenuList
public: public:
// Constructor // Constructor
explicit FMenu (FWidget* = 0); explicit FMenu (FWidget* = 0);
FMenu (FString&, FWidget* = 0); FMenu (const FString&, FWidget* = 0);
FMenu (const std::string&, FWidget* = 0);
FMenu (const char*, FWidget* = 0);
// Destructor // Destructor
virtual ~FMenu(); virtual ~FMenu();
@ -75,11 +73,9 @@ class FMenu : public FWindow, public FMenuList
bool setMenuWidget (bool); bool setMenuWidget (bool);
bool setMenuWidget(); bool setMenuWidget();
bool unsetMenuWidget(); bool unsetMenuWidget();
void setStatusbarMessage (FString); void setStatusbarMessage (const FString);
void setMenu (FMenu*); void setMenu (FMenu*);
void setText (FString&); void setText (const FString&);
void setText (const std::string&);
void setText (const char*);
// Inquiries // Inquiries
bool isEnabled() const; bool isEnabled() const;
@ -212,15 +208,7 @@ inline void FMenu::setMenu (FMenu* m)
{ item->setMenu(m); } { item->setMenu(m); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FMenu::setText (FString& txt) inline void FMenu::setText (const FString& txt)
{ item->setText(txt); }
//----------------------------------------------------------------------
inline void FMenu::setText (const std::string& txt)
{ item->setText(txt); }
//----------------------------------------------------------------------
inline void FMenu::setText (const char* txt)
{ item->setText(txt); } { item->setText(txt); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -35,7 +35,7 @@ FMenuItem::FMenuItem (FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenuItem::FMenuItem (FString& txt, FWidget* parent) FMenuItem::FMenuItem (const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget(parent)
, text(txt) , text(txt)
, selected(false) , selected(false)
@ -55,87 +55,7 @@ FMenuItem::FMenuItem (FString& txt, FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenuItem::FMenuItem (const std::string& txt, FWidget* parent) FMenuItem::FMenuItem (int k, const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, selected(false)
, separator(false)
, checkable(false)
, checked(false)
, radio_button(false)
, dialog_index(false)
, text_length(0)
, hotkey(0)
, accel_key(0)
, menu(0)
, super_menu(0)
, associated_window(0)
{
init (parent);
}
//----------------------------------------------------------------------
FMenuItem::FMenuItem (const char* txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, selected(false)
, separator(false)
, checkable(false)
, checked(false)
, radio_button(false)
, dialog_index(false)
, text_length(0)
, hotkey(0)
, accel_key(0)
, menu(0)
, super_menu(0)
, associated_window(0)
{
init (parent);
}
//----------------------------------------------------------------------
FMenuItem::FMenuItem (int k, FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, selected(false)
, separator(false)
, checkable(false)
, checked(false)
, radio_button(false)
, dialog_index(false)
, text_length(0)
, hotkey(0)
, accel_key(k)
, menu(0)
, super_menu(0)
, associated_window(0)
{
init (parent);
}
//----------------------------------------------------------------------
FMenuItem::FMenuItem (int k, const std::string& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, selected(false)
, separator(false)
, checkable(false)
, checked(false)
, radio_button(false)
, dialog_index(false)
, text_length(0)
, hotkey(0)
, accel_key(k)
, menu(0)
, super_menu(0)
, associated_window(0)
{
init (parent);
}
//----------------------------------------------------------------------
FMenuItem::FMenuItem (int k, const char* txt, FWidget* parent)
: FWidget(parent) : FWidget(parent)
, text(txt) , text(txt)
, selected(false) , selected(false)
@ -238,8 +158,8 @@ bool FMenuItem::setFocus (bool on)
if ( getStatusBar() ) if ( getStatusBar() )
{ {
FString msg = getStatusbarMessage(); const FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage(); const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
getStatusBar()->setMessage(msg); getStatusBar()->setMessage(msg);
@ -276,7 +196,7 @@ void FMenuItem::unsetSelected()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuItem::setText (FString& txt) void FMenuItem::setText (const FString& txt)
{ {
text = txt; text = txt;
text_length = text.getLength(); text_length = text.getLength();
@ -288,19 +208,6 @@ void FMenuItem::setText (FString& txt)
setWidth(int(text_length)); setWidth(int(text_length));
} }
//----------------------------------------------------------------------
void FMenuItem::setText (const std::string& txt)
{
FString s = FString(txt);
setText (s);
}
//----------------------------------------------------------------------
void FMenuItem::setText (const char* txt)
{
FString s = FString(txt);
setText (s);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuItem::addAccelerator (int key, FWidget* obj) void FMenuItem::addAccelerator (int key, FWidget* obj)
@ -847,7 +754,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
{ {
int n = int(std::distance(begin, iter)); int n = int(std::distance(begin, iter));
// get the dialog title // get the dialog title
FString name = win->getText(); const FString name = win->getText();
// create a new dialog list item // create a new dialog list item
FMenuItem* win_item = new FMenuItem (name, winmenu); FMenuItem* win_item = new FMenuItem (name, winmenu);

View File

@ -56,12 +56,8 @@ class FMenuItem : public FWidget
// Constructor // Constructor
explicit FMenuItem (FWidget* = 0); explicit FMenuItem (FWidget* = 0);
FMenuItem (FString&, FWidget* = 0); FMenuItem (const FString&, FWidget* = 0);
FMenuItem (const std::string&, FWidget* = 0); FMenuItem (int, const FString&, FWidget* = 0);
FMenuItem (const char*, FWidget* = 0);
FMenuItem (int, FString&, FWidget* = 0);
FMenuItem (int, const std::string&, FWidget* = 0);
FMenuItem (int, const char*, FWidget* = 0);
// Destructor // Destructor
virtual ~FMenuItem(); virtual ~FMenuItem();
@ -85,9 +81,7 @@ class FMenuItem : public FWidget
void setChecked(); void setChecked();
void unsetChecked(); void unsetChecked();
void setMenu (FMenu*); void setMenu (FMenu*);
void setText (FString&); void setText (const FString&);
void setText (const std::string&);
void setText (const char*);
// Inquiries // Inquiries
bool isSelected() const; bool isSelected() const;

View File

@ -5,7 +5,7 @@
#include "fmessagebox.h" #include "fmessagebox.h"
static const char* button_text[] = static const char* const button_text[] =
{ {
0, 0,
"&OK", "&OK",
@ -153,20 +153,6 @@ void FMessageBox::setHeadline (const FString& headline)
max_line_width = len; max_line_width = len;
} }
//----------------------------------------------------------------------
void FMessageBox::setHeadline (const std::string& headline)
{
FString headline_txt(headline);
setHeadline( headline_txt );
}
//----------------------------------------------------------------------
void FMessageBox::setHeadline (const char* headline)
{
FString headline_txt(headline);
setHeadline( headline_txt );
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMessageBox::setText (const FString& txt) void FMessageBox::setText (const FString& txt)
{ {
@ -183,20 +169,6 @@ void FMessageBox::setText (const FString& txt)
adjustButtons(); adjustButtons();
} }
//----------------------------------------------------------------------
void FMessageBox::setText (const std::string& txt)
{
FString message_text(txt);
setText( message_text );
}
//----------------------------------------------------------------------
void FMessageBox::setText (const char* txt)
{
FString message_text(txt);
setText( message_text );
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FMessageBox::info ( FWidget* parent int FMessageBox::info ( FWidget* parent
, const FString& caption , const FString& caption

View File

@ -89,14 +89,10 @@ class FMessageBox : public FDialog
// Mutator // Mutator
void setTitlebarText (const FString&); void setTitlebarText (const FString&);
void setHeadline (const FString&); void setHeadline (const FString&);
void setHeadline (const std::string&);
void setHeadline (const char*);
bool setCenterText(bool); bool setCenterText(bool);
bool setCenterText(); bool setCenterText();
bool unsetCenterText(); bool unsetCenterText();
void setText (const FString&); void setText (const FString&);
void setText (const std::string&);
void setText (const char*);
// Methods // Methods
static int info ( FWidget* static int info ( FWidget*

View File

@ -18,7 +18,7 @@ FRadioButton::FRadioButton(FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRadioButton::FRadioButton ( const FString& txt, FWidget* parent ) FRadioButton::FRadioButton (const FString& txt, FWidget* parent)
: FToggleButton(txt, parent) : FToggleButton(txt, parent)
{ {
init(); init();

View File

@ -17,21 +17,7 @@ FRadioMenuItem::FRadioMenuItem (FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRadioMenuItem::FRadioMenuItem (FString& txt, FWidget* parent) FRadioMenuItem::FRadioMenuItem (const FString& txt, FWidget* parent)
: FMenuItem(txt, parent)
{
init (parent);
}
//----------------------------------------------------------------------
FRadioMenuItem::FRadioMenuItem (const std::string& txt, FWidget* parent)
: FMenuItem(txt, parent)
{
init (parent);
}
//----------------------------------------------------------------------
FRadioMenuItem::FRadioMenuItem (const char* txt, FWidget* parent)
: FMenuItem(txt, parent) : FMenuItem(txt, parent)
{ {
init (parent); init (parent);

View File

@ -48,9 +48,7 @@ class FRadioMenuItem : public FMenuItem
public: public:
// Constructors // Constructors
explicit FRadioMenuItem (FWidget* = 0); explicit FRadioMenuItem (FWidget* = 0);
FRadioMenuItem (FString&, FWidget* = 0); FRadioMenuItem (const FString&, FWidget* = 0);
FRadioMenuItem (const std::string&, FWidget* = 0);
FRadioMenuItem (const char*, FWidget* = 0);
// Destructor // Destructor
virtual ~FRadioMenuItem(); virtual ~FRadioMenuItem();

View File

@ -22,31 +22,7 @@ FStatusKey::FStatusKey(FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FStatusKey::FStatusKey (int k, FString& txt, FWidget* parent) FStatusKey::FStatusKey (int k, const FString& txt, FWidget* parent)
: FWidget(parent)
, key(k)
, text(txt)
, active(false)
, mouse_focus(false)
, bar(0)
{
init (parent);
}
//----------------------------------------------------------------------
FStatusKey::FStatusKey (int k, const std::string& txt, FWidget* parent)
: FWidget(parent)
, key(k)
, text(txt)
, active(false)
, mouse_focus(false)
, bar(0)
{
init (parent);
}
//----------------------------------------------------------------------
FStatusKey::FStatusKey (int k, const char* txt, FWidget* parent)
: FWidget(parent) : FWidget(parent)
, key(k) , key(k)
, text(txt) , text(txt)
@ -167,25 +143,11 @@ FStatusBar::~FStatusBar()
// public methods of FStatusBar // public methods of FStatusBar
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FStatusBar::setMessage (FString& mgs) void FStatusBar::setMessage (const FString& mgs)
{ {
text = mgs; text = mgs;
} }
//----------------------------------------------------------------------
void FStatusBar::setMessage (const std::string& mgs)
{
FString s = FString(mgs);
setMessage (s);
}
//----------------------------------------------------------------------
void FStatusBar::setMessage (const char* mgs)
{
FString s = FString(mgs);
setMessage (s);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FStatusBar::hasActivatedKey() bool FStatusBar::hasActivatedKey()
{ {

View File

@ -54,9 +54,7 @@ class FStatusKey : public FWidget
public: public:
// Constructors // Constructors
explicit FStatusKey (FWidget* = 0); explicit FStatusKey (FWidget* = 0);
FStatusKey (int, FString&, FWidget* = 0); FStatusKey (int, const FString&, FWidget* = 0);
FStatusKey (int, const std::string&, FWidget* = 0);
FStatusKey (int, const char*, FWidget* = 0);
// Destructor // Destructor
virtual ~FStatusKey(); virtual ~FStatusKey();
@ -83,9 +81,7 @@ class FStatusKey : public FWidget
protected: protected:
// Mutators // Mutators
void setKey (int); void setKey (int);
void setText (FString&); void setText (const FString&);
void setText (const std::string&);
void setText (const char*);
private: private:
// Disable copy constructor // Disable copy constructor
@ -151,15 +147,7 @@ inline void FStatusKey::setKey (int k)
{ key = k; } { key = k; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FStatusKey::setText (FString& txt) inline void FStatusKey::setText (const FString& txt)
{ text = txt; }
//----------------------------------------------------------------------
inline void FStatusKey::setText (const std::string& txt)
{ text = txt; }
//----------------------------------------------------------------------
inline void FStatusKey::setText (const char* txt)
{ text = txt; } { text = txt; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -196,9 +184,7 @@ class FStatusBar : public FWindow
// Mutators // Mutators
void activateKey (int); void activateKey (int);
void deactivateKey (int); void deactivateKey (int);
void setMessage (FString&); void setMessage (const FString&);
void setMessage (const std::string&);
void setMessage (const char*);
// Inquiries // Inquiries
bool isActivated (int) const; bool isActivated (int) const;

View File

@ -4,8 +4,8 @@
#include "fstring.h" #include "fstring.h"
// static class constant // static class constant
const char* FString::bad_alloc_str = "not enough memory " \ const char* const FString::bad_alloc_str = "not enough memory " \
"to alloc a new string"; "to alloc a new string";
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FString // class FString

View File

@ -326,7 +326,7 @@ class FString
static const uInt FWDBUFFER = 15; static const uInt FWDBUFFER = 15;
static const uInt INPBUFFER = 200; static const uInt INPBUFFER = 200;
static const uInt CHAR_SIZE = sizeof(wchar_t); // bytes per character static const uInt CHAR_SIZE = sizeof(wchar_t); // bytes per character
static const char* bad_alloc_str; static const char* const bad_alloc_str;
// Methods // Methods
void initLength (uInt); void initLength (uInt);

View File

@ -162,7 +162,7 @@ int FTerm::getColumnNumber()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString FTerm::getKeyName (int keynum) const FString FTerm::getKeyName (int keynum)
{ {
for (int i=0; FkeyName[i].string[0] != 0; i++) for (int i=0; FkeyName[i].string[0] != 0; i++)
if ( FkeyName[i].num && FkeyName[i].num == keynum ) if ( FkeyName[i].num && FkeyName[i].num == keynum )
@ -808,7 +808,7 @@ void FTerm::setKDECursor (fc::kdeKonsoleCursorShape style)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString* FTerm::getXTermFont() const FString* FTerm::getXTermFont()
{ {
if ( xterm_terminal || screen_terminal || FTermcap::osc_support ) if ( xterm_terminal || screen_terminal || FTermcap::osc_support )
{ {
@ -846,7 +846,7 @@ FString* FTerm::getXTermFont()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString* FTerm::getXTermTitle() const FString* FTerm::getXTermTitle()
{ {
if ( kde_konsole ) if ( kde_konsole )
return 0; return 0;
@ -1436,7 +1436,7 @@ const FString FTerm::getSecDA()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::putstringf (const char* format, ...) void FTerm::putstringf (const char* const format, ...)
{ {
assert ( format != 0 ); assert ( format != 0 );
char buf[512]; char buf[512];
@ -1452,7 +1452,7 @@ void FTerm::putstringf (const char* format, ...)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTerm::putstring (const char* s, int affcnt) inline void FTerm::putstring (const char* const s, int affcnt)
{ {
tputs (s, affcnt, std::putchar); tputs (s, affcnt, std::putchar);
} }
@ -1881,7 +1881,7 @@ int FTerm::closeConsole()
void FTerm::identifyTermType() void FTerm::identifyTermType()
{ {
// Import the untrusted environment variable TERM // Import the untrusted environment variable TERM
const char* term_env = std::getenv(const_cast<char*>("TERM")); const char* const& term_env = std::getenv(const_cast<char*>("TERM"));
if ( term_env ) if ( term_env )
{ {

View File

@ -105,168 +105,168 @@ class FTerm
virtual ~FTerm(); virtual ~FTerm();
// Accessors // Accessors
virtual const char* getClassName() const; virtual const char* getClassName() const;
static termios getTTY(); static termios getTTY();
static int getLineNumber(); static int getLineNumber();
static int getColumnNumber(); static int getColumnNumber();
static FString getKeyName (int); static const FString getKeyName (int);
static modifier_key& getModifierKey(); static modifier_key& getModifierKey();
static char* getTermType(); static char* getTermType();
static char* getTermName(); static char* getTermName();
static uInt getTabstop(); static uInt getTabstop();
static int getMaxColor(); static int getMaxColor();
static fc::consoleCursorStyle getConsoleCursor(); static fc::consoleCursorStyle getConsoleCursor();
// Inquiries // Inquiries
static bool isKeyTimeout (timeval*, register long); static bool isKeyTimeout (timeval*, register long);
static bool isNormal (char_data*&); static bool isNormal (char_data*&);
static bool isRaw(); static bool isRaw();
static bool hasPCcharset(); static bool hasPCcharset();
static bool hasUTF8(); static bool hasUTF8();
static bool hasVT100(); static bool hasVT100();
static bool hasASCII(); static bool hasASCII();
static bool isMonochron(); static bool isMonochron();
static bool isXTerminal(); static bool isXTerminal();
static bool isAnsiTerminal(); static bool isAnsiTerminal();
static bool isRxvtTerminal(); static bool isRxvtTerminal();
static bool isUrxvtTerminal(); static bool isUrxvtTerminal();
static bool isMltermTerminal(); static bool isMltermTerminal();
static bool isPuttyTerminal(); static bool isPuttyTerminal();
static bool isKdeTerminal(); static bool isKdeTerminal();
static bool isGnomeTerminal(); static bool isGnomeTerminal();
static bool isKtermTerminal(); static bool isKtermTerminal();
static bool isTeraTerm(); static bool isTeraTerm();
static bool isCygwinTerminal(); static bool isCygwinTerminal();
static bool isMinttyTerm(); static bool isMinttyTerm();
static bool isLinuxTerm(); static bool isLinuxTerm();
static bool isScreenTerm(); static bool isScreenTerm();
static bool isTmuxTerm(); static bool isTmuxTerm();
static bool isInputDataPending(); static bool isInputDataPending();
static bool isNewFont(); static bool isNewFont();
static bool isUTF8(); static bool isUTF8();
static bool isUTF8_linux_terminal(); static bool isUTF8_linux_terminal();
// Mutators // Mutators
static bool setCursorOptimisation (bool); static bool setCursorOptimisation (bool);
static void setXTermDefaultColors (bool); static void setXTermDefaultColors (bool);
static void setConsoleCursor (fc::consoleCursorStyle, bool); static void setConsoleCursor (fc::consoleCursorStyle, bool);
static void setTTY (termios&); static void setTTY (termios&);
static void noHardwareEcho(); static void noHardwareEcho();
static bool setRawMode (bool); static bool setRawMode (bool);
static bool setRawMode(); static bool setRawMode();
static bool unsetRawMode(); static bool unsetRawMode();
static bool setCookedMode(); static bool setCookedMode();
static bool setUTF8 (bool); static bool setUTF8 (bool);
static bool setUTF8(); static bool setUTF8();
static bool unsetUTF8(); static bool unsetUTF8();
static bool setNonBlockingInput (bool); static bool setNonBlockingInput (bool);
static bool setNonBlockingInput(); static bool setNonBlockingInput();
static bool unsetNonBlockingInput(); static bool unsetNonBlockingInput();
// Methods // Methods
static int parseKeyString (char[], int, timeval*); static int parseKeyString (char[], int, timeval*);
static bool& unprocessedInput(); static bool& unprocessedInput();
static bool setVGAFont(); static bool setVGAFont();
static bool setNewFont(); static bool setNewFont();
static bool setOldFont(); static bool setOldFont();
static char* moveCursor (int, int, int, int); static char* moveCursor (int, int, int, int);
static void printMoveDurations(); static void printMoveDurations();
static char* enableCursor(); static char* enableCursor();
static char* disableCursor(); static char* disableCursor();
static void detectTermSize(); static void detectTermSize();
static void setTermSize (int, int); static void setTermSize (int, int);
static void setKDECursor (fc::kdeKonsoleCursorShape); static void setKDECursor (fc::kdeKonsoleCursorShape);
static FString* getXTermFont(); static const FString* getXTermFont();
static FString* getXTermTitle(); static const FString* getXTermTitle();
static const FString getXTermColorName (int); static const FString getXTermColorName (int);
static void setXTermCursorStyle (fc::xtermCursorStyle); static void setXTermCursorStyle (fc::xtermCursorStyle);
static void setXTermTitle (const FString&); static void setXTermTitle (const FString&);
static void setXTermForeground (const FString&); static void setXTermForeground (const FString&);
static void setXTermBackground (const FString&); static void setXTermBackground (const FString&);
static void setXTermCursorColor (const FString&); static void setXTermCursorColor (const FString&);
static void setXTermMouseForeground (const FString&); static void setXTermMouseForeground (const FString&);
static void setXTermMouseBackground (const FString&); static void setXTermMouseBackground (const FString&);
static void setXTermHighlightBackground (const FString&); static void setXTermHighlightBackground (const FString&);
static void setXTermDefaults(); static void setXTermDefaults();
static void resetXTermColors(); static void resetXTermColors();
static void resetXTermForeground(); static void resetXTermForeground();
static void resetXTermBackground(); static void resetXTermBackground();
static void resetXTermCursorColor(); static void resetXTermCursorColor();
static void resetXTermMouseForeground(); static void resetXTermMouseForeground();
static void resetXTermMouseBackground(); static void resetXTermMouseBackground();
static void resetXTermHighlightBackground(); static void resetXTermHighlightBackground();
static void resetXTermDefaults(); static void resetXTermDefaults();
static void saveColorMap(); static void saveColorMap();
static void resetColorMap(); static void resetColorMap();
static void setPalette (short, int, int, int); static void setPalette (short, int, int, int);
static void setBeep (int, int); static void setBeep (int, int);
static void resetBeep(); static void resetBeep();
static void beep(); static void beep();
static void setEncoding (std::string); static void setEncoding (std::string);
static std::string getEncoding(); static std::string getEncoding();
static bool scrollTermForward(); static bool scrollTermForward();
static bool scrollTermReverse(); static bool scrollTermReverse();
static const FString getAnswerbackMsg(); static const FString getAnswerbackMsg();
static const FString getSecDA(); static const FString getSecDA();
// function pointer -> static function // function pointer -> static function
static int (*Fputchar)(int); static int (*Fputchar)(int);
static void putstringf (const char*, ...) static void putstringf (const char* const, ...)
#if defined(__clang__) #if defined(__clang__)
__attribute__((__format__ (__printf__, 1, 2))) __attribute__((__format__ (__printf__, 1, 2)))
#elif defined(__GNUC__) #elif defined(__GNUC__)
__attribute__ ((format (printf, 1, 2))) __attribute__ ((format (printf, 1, 2)))
#endif #endif
; ;
static void putstring (const char*, int = 1); static void putstring (const char* const, int = 1);
static int putchar_ASCII (register int); static int putchar_ASCII (register int);
static int putchar_UTF8 (register int); static int putchar_UTF8 (register int);
static int UTF8decode (const char[]); static int UTF8decode (const char[]);
protected: protected:
// Methods // Methods
static void init_consoleCharMap(); static void init_consoleCharMap();
static bool charEncodable (uInt); static bool charEncodable (uInt);
static uInt charEncode (uInt); static uInt charEncode (uInt);
static uInt charEncode (uInt, fc::encoding); static uInt charEncode (uInt, fc::encoding);
static char* changeAttribute ( char_data*& static char* changeAttribute ( char_data*&
, char_data*& ); , char_data*& );
static bool hasChangedTermSize(); static bool hasChangedTermSize();
static void changeTermSizeFinished(); static void changeTermSizeFinished();
static void xtermMouse (bool); static void xtermMouse (bool);
static void enableXTermMouse(); static void enableXTermMouse();
static void disableXTermMouse(); static void disableXTermMouse();
#ifdef F_HAVE_LIBGPM #ifdef F_HAVE_LIBGPM
static bool gpmMouse (bool); static bool gpmMouse (bool);
static bool enableGpmMouse(); static bool enableGpmMouse();
static bool disableGpmMouse(); static bool disableGpmMouse();
static bool isGpmMouseEnabled(); static bool isGpmMouseEnabled();
#endif // F_HAVE_LIBGPM #endif // F_HAVE_LIBGPM
static FPoint& getMousePos(); static FPoint& getMousePos();
static void setMousePos (FPoint&); static void setMousePos (FPoint&);
static void setMousePos (short, short); static void setMousePos (short, short);
// Data Members // Data Members
static int stdin_no; static int stdin_no;
static int stdout_no; static int stdout_no;
static int erase_ch_length; static int erase_ch_length;
static int repeat_char_length; static int repeat_char_length;
static int clr_bol_length; static int clr_bol_length;
static int clr_eol_length; static int clr_eol_length;
static int cursor_addres_lengths; static int cursor_addres_lengths;
static bool NewFont; static bool NewFont;
static bool VGAFont; static bool VGAFont;
static bool no_shadow_character; static bool no_shadow_character;
static bool no_half_block_character; static bool no_half_block_character;
static bool cursor_optimisation; static bool cursor_optimisation;
static bool xterm_default_colors; static bool xterm_default_colors;
static fc::encoding Encoding; static fc::encoding Encoding;
static char exit_message[8192]; static char exit_message[8192];
private: private:
// Typedefs // Typedefs
@ -288,40 +288,40 @@ class FTerm
FTerm& operator = (const FTerm&); FTerm& operator = (const FTerm&);
// Inquiries // Inquiries
static int isConsole(); static int isConsole();
// Methods // Methods
static uInt16 getInputStatusRegisterOne(); static uInt16 getInputStatusRegisterOne();
static uChar readAttributeController (uChar); static uChar readAttributeController (uChar);
static void writeAttributeController (uChar, uChar); static void writeAttributeController (uChar, uChar);
static uChar getAttributeMode(); static uChar getAttributeMode();
static void setAttributeMode (uChar); static void setAttributeMode (uChar);
static int setBlinkAsIntensity (bool); static int setBlinkAsIntensity (bool);
static int getFramebuffer_bpp(); static int getFramebuffer_bpp();
static int openConsole(); static int openConsole();
static int closeConsole(); static int closeConsole();
static void identifyTermType(); static void identifyTermType();
static void storeTTYsettings(); static void storeTTYsettings();
static void restoreTTYsettings(); static void restoreTTYsettings();
static int getScreenFont(); static int getScreenFont();
static int setScreenFont (uChar*, uInt, uInt, uInt, bool = false); static int setScreenFont (uChar*, uInt, uInt, uInt, bool = false);
static int setUnicodeMap (struct unimapdesc*); static int setUnicodeMap (struct unimapdesc*);
static int getUnicodeMap (); static int getUnicodeMap ();
static void init_console(); static void init_console();
static uInt getBaudRate (const struct termios*); static uInt getBaudRate (const struct termios*);
static char* init_256colorTerminal(); static char* init_256colorTerminal();
static char* parseAnswerbackMsg (char*&); static char* parseAnswerbackMsg (char*&);
static char* parseSecDA (char*&); static char* parseSecDA (char*&);
static void oscPrefix(); static void oscPrefix();
static void oscPostfix(); static void oscPostfix();
static void init_alt_charset(); static void init_alt_charset();
static void init_pc_charset(); static void init_pc_charset();
static void init_termcaps(); static void init_termcaps();
static void init_encoding(); static void init_encoding();
void init(); void init();
void finish(); void finish();
static uInt cp437_to_unicode (uChar); static uInt cp437_to_unicode (uChar);
static void signal_handler (int); static void signal_handler (int);
// Data Members // Data Members
static std::map <uChar,uChar>* vt100_alt_char; static std::map <uChar,uChar>* vt100_alt_char;

View File

@ -35,7 +35,7 @@ FTextView::~FTextView() // destructor
// public methods of FTextView // public methods of FTextView
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString FTextView::getText() const const FString FTextView::getText() const
{ {
uInt len, rows, idx; uInt len, rows, idx;
@ -670,8 +670,8 @@ void FTextView::draw()
if ( hasFocus() && getStatusBar() ) if ( hasFocus() && getStatusBar() )
{ {
FString msg = getStatusbarMessage(); const FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage(); const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
{ {

View File

@ -58,38 +58,38 @@ class FTextView : public FWidget
~FTextView(); ~FTextView();
// Accessors // Accessors
const char* getClassName() const; const char* getClassName() const;
uInt getColumns() const; uInt getColumns() const;
uInt getRows() const; uInt getRows() const;
FString getText() const; const FString getText() const;
stringLines getLines() const; stringLines getLines() const;
// Mutators // Mutators
void setGeometry (int, int, int, int, bool = true); void setGeometry (int, int, int, int, bool = true);
void setPosition (int); void setPosition (int);
void setText (const FString&); void setText (const FString&);
// Methods // Methods
void hide(); void hide();
void append (const FString&); void append (const FString&);
void insert (const FString&, int); void insert (const FString&, int);
void replaceRange (const FString&, int, int); void replaceRange (const FString&, int, int);
void deleteRange (int, int); void deleteRange (int, int);
void deleteLine (int); void deleteLine (int);
void clear(); void clear();
// Event handlers // Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
void onMouseMove (FMouseEvent*); void onMouseMove (FMouseEvent*);
void onWheel (FWheelEvent*); void onWheel (FWheelEvent*);
void onFocusIn (FFocusEvent*); void onFocusIn (FFocusEvent*);
void onFocusOut (FFocusEvent*); void onFocusOut (FFocusEvent*);
protected: protected:
// Method // Method
void adjustSize(); void adjustSize();
private: private:
// Disable copy constructor // Disable copy constructor
@ -99,14 +99,14 @@ class FTextView : public FWidget
FTextView& operator = (const FTextView&); FTextView& operator = (const FTextView&);
// Methods // Methods
void init(); void init();
void draw(); void draw();
void drawText(); void drawText();
void processChanged(); void processChanged();
// Callback methods // Callback methods
void cb_VBarChange (FWidget*, data_ptr); void cb_VBarChange (FWidget*, data_ptr);
void cb_HBarChange (FWidget*, data_ptr); void cb_HBarChange (FWidget*, data_ptr);
// Data Members // Data Members
stringLines data; stringLines data;

View File

@ -146,8 +146,8 @@ bool FToggleButton::setFocus (bool on)
if ( getStatusBar() ) if ( getStatusBar() )
{ {
FString msg = getStatusbarMessage(); const FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage(); const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
getStatusBar()->setMessage(msg); getStatusBar()->setMessage(msg);
@ -184,7 +184,7 @@ bool FToggleButton::setChecked (bool on)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FToggleButton::setText (FString txt) void FToggleButton::setText (const FString txt)
{ {
text = txt; text = txt;
setWidth(button_width + int(text.getLength())); setWidth(button_width + int(text.getLength()));
@ -456,8 +456,8 @@ void FToggleButton::draw()
if ( isFocus && getStatusBar() ) if ( isFocus && getStatusBar() )
{ {
FString msg = getStatusbarMessage(); const FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage(); const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
{ {

View File

@ -62,20 +62,6 @@ void FToolTip::setText (const FString& txt)
calculateDimensions(); calculateDimensions();
} }
//----------------------------------------------------------------------
void FToolTip::setText (const std::string& txt)
{
FString message_text(txt);
setText (message_text);
}
//----------------------------------------------------------------------
void FToolTip::setText (const char* txt)
{
FString message_text(txt);
setText (message_text);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FToolTip::draw() void FToolTip::draw()
{ {

View File

@ -59,8 +59,6 @@ class FToolTip : public FWindow
// Mutators // Mutators
void setText (const FString&); void setText (const FString&);
void setText (const std::string&);
void setText (const char*);
// Methods // Methods
virtual void draw(); virtual void draw();

View File

@ -404,7 +404,7 @@ int FVTerm::print (FString& s)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FVTerm::print (term_area* area, FString& s) int FVTerm::print (term_area* area, const FString& s)
{ {
assert ( ! s.isNull() ); assert ( ! s.isNull() );
register int len = 0; register int len = 0;
@ -2654,12 +2654,12 @@ int FVTerm::appendLowerRight (char_data*& screen_char)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::appendOutputBuffer (std::string& s) inline void FVTerm::appendOutputBuffer (std::string& s)
{ {
const char* c_string = s.c_str(); const char* const& c_string = s.c_str();
tputs (c_string, 1, appendOutputBuffer); tputs (c_string, 1, appendOutputBuffer);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::appendOutputBuffer (const char* s) inline void FVTerm::appendOutputBuffer (const char* const& s)
{ {
tputs (s, 1, appendOutputBuffer); tputs (s, 1, appendOutputBuffer);
} }

View File

@ -264,7 +264,7 @@ class FVTerm : public FObject, public FTerm
int print (const std::string&); int print (const std::string&);
int print (term_area*, const std::string&); int print (term_area*, const std::string&);
int print (FString&); int print (FString&);
int print (term_area*, FString&); int print (term_area*, const FString&);
int print (int); int print (int);
int print (term_area*, int); int print (term_area*, int);
FVTerm& print(); FVTerm& print();
@ -392,7 +392,7 @@ class FVTerm : public FObject, public FTerm
static void appendAttributes (char_data*&); static void appendAttributes (char_data*&);
static int appendLowerRight (char_data*&); static int appendLowerRight (char_data*&);
static void appendOutputBuffer (std::string&); static void appendOutputBuffer (std::string&);
static void appendOutputBuffer (const char*); static void appendOutputBuffer (const char* const&);
static int appendOutputBuffer (int); static int appendOutputBuffer (int);
// Data Members // Data Members

View File

@ -301,7 +301,7 @@ void FWidget::setOpenMenu (FWidget* obj)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::setStatusbarMessage (FString msg) void FWidget::setStatusbarMessage (const FString msg)
{ {
statusbar_message = msg; statusbar_message = msg;
} }
@ -874,7 +874,7 @@ bool FWidget::close()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::addCallback ( FString cb_signal void FWidget::addCallback ( const FString cb_signal
, FCallback cb_handler , FCallback cb_handler
, data_ptr data ) , data_ptr data )
{ {
@ -884,7 +884,7 @@ void FWidget::addCallback ( FString cb_signal
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::addCallback ( FString cb_signal void FWidget::addCallback ( const FString cb_signal
, FWidget* cb_instance , FWidget* cb_instance
, FMemberCallback cb_handler , FMemberCallback cb_handler
, data_ptr data ) , data_ptr data )
@ -946,7 +946,7 @@ inline void FWidget::delCallbacks()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::emitCallback (FString emit_signal) void FWidget::emitCallback (const FString emit_signal)
{ {
// member function pointer // member function pointer
if ( ! member_callback_objects.empty() ) if ( ! member_callback_objects.empty() )

View File

@ -166,7 +166,7 @@ class FWidget : public FVTerm
static void setClickedWidget (FWidget*); static void setClickedWidget (FWidget*);
static void setMoveSizeWidget (FWidget*); static void setMoveSizeWidget (FWidget*);
static void setOpenMenu (FWidget*); static void setOpenMenu (FWidget*);
virtual void setStatusbarMessage (FString); virtual void setStatusbarMessage (const FString);
bool setVisible(); bool setVisible();
virtual bool setEnable (bool); virtual bool setEnable (bool);
virtual bool setEnable(); virtual bool setEnable();
@ -240,17 +240,17 @@ class FWidget : public FVTerm
int numOfFocusableChildren(); int numOfFocusableChildren();
virtual bool close(); virtual bool close();
void clearStatusbarMessage(); void clearStatusbarMessage();
void addCallback ( FString void addCallback ( const FString
, FCallback , FCallback
, data_ptr = null ); , data_ptr = null );
void addCallback ( FString void addCallback ( const FString
, FWidget* , FWidget*
, FMemberCallback , FMemberCallback
, data_ptr = null ); , data_ptr = null );
void delCallback (FCallback); void delCallback (FCallback);
void delCallback (FWidget*); void delCallback (FWidget*);
void delCallbacks(); void delCallbacks();
void emitCallback (FString); void emitCallback (const FString);
void addAccelerator (int); void addAccelerator (int);
virtual void addAccelerator (int, FWidget*); virtual void addAccelerator (int, FWidget*);
void delAccelerator (); void delAccelerator ();

View File

@ -18,6 +18,7 @@ noinst_PROGRAMS = \
term-attributes \ term-attributes \
transparent \ transparent \
keyboard \ keyboard \
mouse \
timer \ timer \
scrollview \ scrollview \
windows \ windows \
@ -36,6 +37,7 @@ watch_SOURCES = watch.cpp
term_attributes_SOURCES = term-attributes.cpp term_attributes_SOURCES = term-attributes.cpp
transparent_SOURCES = transparent.cpp transparent_SOURCES = transparent.cpp
keyboard_SOURCES = keyboard.cpp keyboard_SOURCES = keyboard.cpp
mouse_SOURCES = mouse.cpp
timer_SOURCES = timer.cpp timer_SOURCES = timer.cpp
scrollview_SOURCES = scrollview.cpp scrollview_SOURCES = scrollview.cpp
windows_SOURCES = windows.cpp windows_SOURCES = windows.cpp

View File

@ -86,8 +86,8 @@ noinst_PROGRAMS = hello$(EXEEXT) dialog$(EXEEXT) input-dialog$(EXEEXT) \
choice$(EXEEXT) opti-move$(EXEEXT) string-operations$(EXEEXT) \ choice$(EXEEXT) opti-move$(EXEEXT) string-operations$(EXEEXT) \
mandelbrot$(EXEEXT) calculator$(EXEEXT) watch$(EXEEXT) \ mandelbrot$(EXEEXT) calculator$(EXEEXT) watch$(EXEEXT) \
term-attributes$(EXEEXT) transparent$(EXEEXT) \ term-attributes$(EXEEXT) transparent$(EXEEXT) \
keyboard$(EXEEXT) timer$(EXEEXT) scrollview$(EXEEXT) \ keyboard$(EXEEXT) mouse$(EXEEXT) timer$(EXEEXT) \
windows$(EXEEXT) menu$(EXEEXT) ui$(EXEEXT) scrollview$(EXEEXT) windows$(EXEEXT) menu$(EXEEXT) ui$(EXEEXT)
subdir = test subdir = test
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(top_srcdir)/depcomp
@ -131,6 +131,9 @@ mandelbrot_LDADD = $(LDADD)
am_menu_OBJECTS = menu.$(OBJEXT) am_menu_OBJECTS = menu.$(OBJEXT)
menu_OBJECTS = $(am_menu_OBJECTS) menu_OBJECTS = $(am_menu_OBJECTS)
menu_LDADD = $(LDADD) menu_LDADD = $(LDADD)
am_mouse_OBJECTS = mouse.$(OBJEXT)
mouse_OBJECTS = $(am_mouse_OBJECTS)
mouse_LDADD = $(LDADD)
am_opti_move_OBJECTS = opti-move.$(OBJEXT) am_opti_move_OBJECTS = opti-move.$(OBJEXT)
opti_move_OBJECTS = $(am_opti_move_OBJECTS) opti_move_OBJECTS = $(am_opti_move_OBJECTS)
opti_move_LDADD = $(LDADD) opti_move_LDADD = $(LDADD)
@ -194,15 +197,15 @@ am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 = am__v_CXXLD_1 =
SOURCES = $(calculator_SOURCES) $(choice_SOURCES) $(dialog_SOURCES) \ SOURCES = $(calculator_SOURCES) $(choice_SOURCES) $(dialog_SOURCES) \
$(hello_SOURCES) $(input_dialog_SOURCES) $(keyboard_SOURCES) \ $(hello_SOURCES) $(input_dialog_SOURCES) $(keyboard_SOURCES) \
$(mandelbrot_SOURCES) $(menu_SOURCES) $(opti_move_SOURCES) \ $(mandelbrot_SOURCES) $(menu_SOURCES) $(mouse_SOURCES) \
$(scrollview_SOURCES) $(string_operations_SOURCES) \ $(opti_move_SOURCES) $(scrollview_SOURCES) \
$(term_attributes_SOURCES) $(timer_SOURCES) \ $(string_operations_SOURCES) $(term_attributes_SOURCES) \
$(transparent_SOURCES) $(ui_SOURCES) $(watch_SOURCES) \ $(timer_SOURCES) $(transparent_SOURCES) $(ui_SOURCES) \
$(windows_SOURCES) $(watch_SOURCES) $(windows_SOURCES)
DIST_SOURCES = $(calculator_SOURCES) $(choice_SOURCES) \ DIST_SOURCES = $(calculator_SOURCES) $(choice_SOURCES) \
$(dialog_SOURCES) $(hello_SOURCES) $(input_dialog_SOURCES) \ $(dialog_SOURCES) $(hello_SOURCES) $(input_dialog_SOURCES) \
$(keyboard_SOURCES) $(mandelbrot_SOURCES) $(menu_SOURCES) \ $(keyboard_SOURCES) $(mandelbrot_SOURCES) $(menu_SOURCES) \
$(opti_move_SOURCES) $(scrollview_SOURCES) \ $(mouse_SOURCES) $(opti_move_SOURCES) $(scrollview_SOURCES) \
$(string_operations_SOURCES) $(term_attributes_SOURCES) \ $(string_operations_SOURCES) $(term_attributes_SOURCES) \
$(timer_SOURCES) $(transparent_SOURCES) $(ui_SOURCES) \ $(timer_SOURCES) $(transparent_SOURCES) $(ui_SOURCES) \
$(watch_SOURCES) $(windows_SOURCES) $(watch_SOURCES) $(windows_SOURCES)
@ -366,6 +369,7 @@ watch_SOURCES = watch.cpp
term_attributes_SOURCES = term-attributes.cpp term_attributes_SOURCES = term-attributes.cpp
transparent_SOURCES = transparent.cpp transparent_SOURCES = transparent.cpp
keyboard_SOURCES = keyboard.cpp keyboard_SOURCES = keyboard.cpp
mouse_SOURCES = mouse.cpp
timer_SOURCES = timer.cpp timer_SOURCES = timer.cpp
scrollview_SOURCES = scrollview.cpp scrollview_SOURCES = scrollview.cpp
windows_SOURCES = windows.cpp windows_SOURCES = windows.cpp
@ -447,6 +451,10 @@ menu$(EXEEXT): $(menu_OBJECTS) $(menu_DEPENDENCIES) $(EXTRA_menu_DEPENDENCIES)
@rm -f menu$(EXEEXT) @rm -f menu$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(menu_OBJECTS) $(menu_LDADD) $(LIBS) $(AM_V_CXXLD)$(CXXLINK) $(menu_OBJECTS) $(menu_LDADD) $(LIBS)
mouse$(EXEEXT): $(mouse_OBJECTS) $(mouse_DEPENDENCIES) $(EXTRA_mouse_DEPENDENCIES)
@rm -f mouse$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(mouse_OBJECTS) $(mouse_LDADD) $(LIBS)
opti-move$(EXEEXT): $(opti_move_OBJECTS) $(opti_move_DEPENDENCIES) $(EXTRA_opti_move_DEPENDENCIES) opti-move$(EXEEXT): $(opti_move_OBJECTS) $(opti_move_DEPENDENCIES) $(EXTRA_opti_move_DEPENDENCIES)
@rm -f opti-move$(EXEEXT) @rm -f opti-move$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(opti_move_OBJECTS) $(opti_move_LDADD) $(LIBS) $(AM_V_CXXLD)$(CXXLINK) $(opti_move_OBJECTS) $(opti_move_LDADD) $(LIBS)
@ -497,6 +505,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyboard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyboard.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mandelbrot.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mandelbrot.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mouse.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opti-move.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opti-move.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scrollview.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scrollview.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string-operations.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string-operations.Po@am__quote@

View File

@ -201,7 +201,7 @@ Calc::Calc (FWidget* parent)
{ {
clearInfixOperator(); clearInfixOperator();
const wchar_t* button_text[Calc::NUM_OF_BUTTONS] = const wchar_t* const button_text[Calc::NUM_OF_BUTTONS] =
{ {
L"&Sin", L"&Sin",
L"&Cos", L"&Cos",

View File

@ -49,7 +49,6 @@ class scrollview : public FScrollView
}; };
#pragma pack(pop) #pragma pack(pop)
#include "fcheckbox.h"
//---------------------------------------------------------------------- //----------------------------------------------------------------------
scrollview::scrollview (FWidget* parent) scrollview::scrollview (FWidget* parent)
: FScrollView(parent) : FScrollView(parent)