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>
* Corrects directly the input cursor position on window moving

View File

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

View File

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

View File

@ -17,21 +17,7 @@ FCheckMenuItem::FCheckMenuItem (FWidget* parent)
}
//----------------------------------------------------------------------
FCheckMenuItem::FCheckMenuItem (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)
FCheckMenuItem::FCheckMenuItem (const FString& txt, FWidget* parent)
: FMenuItem(txt, parent)
{
init (parent);

View File

@ -48,9 +48,7 @@ class FCheckMenuItem : public FMenuItem
public:
// Constructors
explicit FCheckMenuItem (FWidget* = 0);
FCheckMenuItem (FString&, FWidget* = 0);
FCheckMenuItem (const std::string&, FWidget* = 0);
FCheckMenuItem (const char*, FWidget* = 0);
FCheckMenuItem (const FString&, FWidget* = 0);
// Destructor
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)
{
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()
{ }

View File

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

View File

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

View File

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

View File

@ -108,8 +108,8 @@ bool FLineEdit::setFocus (bool on)
if ( getStatusBar() )
{
FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage();
const FString msg = getStatusbarMessage();
const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != 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;
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->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;
adjustLabel();
@ -734,8 +734,8 @@ void FLineEdit::draw()
if ( isFocus && getStatusBar() )
{
FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage();
const FString msg = getStatusbarMessage();
const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg )
{

View File

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

View File

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

View File

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

View File

@ -25,35 +25,7 @@ FMenu::FMenu(FWidget* parent)
}
//----------------------------------------------------------------------
FMenu::FMenu (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)
FMenu::FMenu (const FString& txt, FWidget* parent)
: FWindow(parent)
, item(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);
@ -650,8 +622,8 @@ void FMenu::onMouseMove (FMouseEvent* ev)
// Mouse is over border or separator
if ( getStatusBar() )
{
FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage();
const FString msg = getStatusbarMessage();
const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg )
{

View File

@ -53,9 +53,7 @@ class FMenu : public FWindow, public FMenuList
public:
// Constructor
explicit FMenu (FWidget* = 0);
FMenu (FString&, FWidget* = 0);
FMenu (const std::string&, FWidget* = 0);
FMenu (const char*, FWidget* = 0);
FMenu (const FString&, FWidget* = 0);
// Destructor
virtual ~FMenu();
@ -75,11 +73,9 @@ class FMenu : public FWindow, public FMenuList
bool setMenuWidget (bool);
bool setMenuWidget();
bool unsetMenuWidget();
void setStatusbarMessage (FString);
void setStatusbarMessage (const FString);
void setMenu (FMenu*);
void setText (FString&);
void setText (const std::string&);
void setText (const char*);
void setText (const FString&);
// Inquiries
bool isEnabled() const;
@ -212,15 +208,7 @@ inline void FMenu::setMenu (FMenu* m)
{ item->setMenu(m); }
//----------------------------------------------------------------------
inline void FMenu::setText (FString& txt)
{ item->setText(txt); }
//----------------------------------------------------------------------
inline void FMenu::setText (const std::string& txt)
{ item->setText(txt); }
//----------------------------------------------------------------------
inline void FMenu::setText (const char* txt)
inline void FMenu::setText (const FString& 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)
, text(txt)
, selected(false)
@ -55,87 +55,7 @@ FMenuItem::FMenuItem (FString& txt, FWidget* parent)
}
//----------------------------------------------------------------------
FMenuItem::FMenuItem (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(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)
FMenuItem::FMenuItem (int k, const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, selected(false)
@ -238,8 +158,8 @@ bool FMenuItem::setFocus (bool on)
if ( getStatusBar() )
{
FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage();
const FString msg = getStatusbarMessage();
const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != 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_length = text.getLength();
@ -288,19 +208,6 @@ void FMenuItem::setText (FString& txt)
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)
@ -847,7 +754,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
{
int n = int(std::distance(begin, iter));
// get the dialog title
FString name = win->getText();
const FString name = win->getText();
// create a new dialog list item
FMenuItem* win_item = new FMenuItem (name, winmenu);

View File

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

View File

@ -5,7 +5,7 @@
#include "fmessagebox.h"
static const char* button_text[] =
static const char* const button_text[] =
{
0,
"&OK",
@ -153,20 +153,6 @@ void FMessageBox::setHeadline (const FString& headline)
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)
{
@ -183,20 +169,6 @@ void FMessageBox::setText (const FString& txt)
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
, const FString& caption

View File

@ -89,14 +89,10 @@ class FMessageBox : public FDialog
// Mutator
void setTitlebarText (const FString&);
void setHeadline (const FString&);
void setHeadline (const std::string&);
void setHeadline (const char*);
bool setCenterText(bool);
bool setCenterText();
bool unsetCenterText();
void setText (const FString&);
void setText (const std::string&);
void setText (const char*);
// Methods
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)
{
init();

View File

@ -17,21 +17,7 @@ FRadioMenuItem::FRadioMenuItem (FWidget* parent)
}
//----------------------------------------------------------------------
FRadioMenuItem::FRadioMenuItem (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)
FRadioMenuItem::FRadioMenuItem (const FString& txt, FWidget* parent)
: FMenuItem(txt, parent)
{
init (parent);

View File

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

View File

@ -22,31 +22,7 @@ FStatusKey::FStatusKey(FWidget* parent)
}
//----------------------------------------------------------------------
FStatusKey::FStatusKey (int k, 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)
FStatusKey::FStatusKey (int k, const FString& txt, FWidget* parent)
: FWidget(parent)
, key(k)
, text(txt)
@ -167,25 +143,11 @@ FStatusBar::~FStatusBar()
// public methods of FStatusBar
//----------------------------------------------------------------------
void FStatusBar::setMessage (FString& mgs)
void FStatusBar::setMessage (const FString& 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()
{

View File

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

View File

@ -4,7 +4,7 @@
#include "fstring.h"
// 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";
//----------------------------------------------------------------------

View File

@ -326,7 +326,7 @@ class FString
static const uInt FWDBUFFER = 15;
static const uInt INPBUFFER = 200;
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
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++)
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 )
{
@ -846,7 +846,7 @@ FString* FTerm::getXTermFont()
}
//----------------------------------------------------------------------
FString* FTerm::getXTermTitle()
const FString* FTerm::getXTermTitle()
{
if ( kde_konsole )
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 );
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);
}
@ -1881,7 +1881,7 @@ int FTerm::closeConsole()
void FTerm::identifyTermType()
{
// 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 )
{

View File

@ -109,7 +109,7 @@ class FTerm
static termios getTTY();
static int getLineNumber();
static int getColumnNumber();
static FString getKeyName (int);
static const FString getKeyName (int);
static modifier_key& getModifierKey();
static char* getTermType();
static char* getTermName();
@ -176,8 +176,8 @@ class FTerm
static void detectTermSize();
static void setTermSize (int, int);
static void setKDECursor (fc::kdeKonsoleCursorShape);
static FString* getXTermFont();
static FString* getXTermTitle();
static const FString* getXTermFont();
static const FString* getXTermTitle();
static const FString getXTermColorName (int);
static void setXTermCursorStyle (fc::xtermCursorStyle);
static void setXTermTitle (const FString&);
@ -215,14 +215,14 @@ class FTerm
// function pointer -> static function
static int (*Fputchar)(int);
static void putstringf (const char*, ...)
static void putstringf (const char* const, ...)
#if defined(__clang__)
__attribute__((__format__ (__printf__, 1, 2)))
#elif defined(__GNUC__)
__attribute__ ((format (printf, 1, 2)))
#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_UTF8 (register int);
static int UTF8decode (const char[]);

View File

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

View File

@ -61,7 +61,7 @@ class FTextView : public FWidget
const char* getClassName() const;
uInt getColumns() const;
uInt getRows() const;
FString getText() const;
const FString getText() const;
stringLines getLines() const;
// Mutators

View File

@ -146,8 +146,8 @@ bool FToggleButton::setFocus (bool on)
if ( getStatusBar() )
{
FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage();
const FString msg = getStatusbarMessage();
const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != 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;
setWidth(button_width + int(text.getLength()));
@ -456,8 +456,8 @@ void FToggleButton::draw()
if ( isFocus && getStatusBar() )
{
FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage();
const FString msg = getStatusbarMessage();
const FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg )
{

View File

@ -62,20 +62,6 @@ void FToolTip::setText (const FString& txt)
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()
{

View File

@ -59,8 +59,6 @@ class FToolTip : public FWindow
// Mutators
void setText (const FString&);
void setText (const std::string&);
void setText (const char*);
// Methods
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() );
register int len = 0;
@ -2654,12 +2654,12 @@ int FVTerm::appendLowerRight (char_data*& screen_char)
//----------------------------------------------------------------------
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);
}
//----------------------------------------------------------------------
inline void FVTerm::appendOutputBuffer (const char* s)
inline void FVTerm::appendOutputBuffer (const char* const& s)
{
tputs (s, 1, appendOutputBuffer);
}

View File

@ -264,7 +264,7 @@ class FVTerm : public FObject, public FTerm
int print (const std::string&);
int print (term_area*, const std::string&);
int print (FString&);
int print (term_area*, FString&);
int print (term_area*, const FString&);
int print (int);
int print (term_area*, int);
FVTerm& print();
@ -392,7 +392,7 @@ class FVTerm : public FObject, public FTerm
static void appendAttributes (char_data*&);
static int appendLowerRight (char_data*&);
static void appendOutputBuffer (std::string&);
static void appendOutputBuffer (const char*);
static void appendOutputBuffer (const char* const&);
static int appendOutputBuffer (int);
// 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;
}
@ -874,7 +874,7 @@ bool FWidget::close()
}
//----------------------------------------------------------------------
void FWidget::addCallback ( FString cb_signal
void FWidget::addCallback ( const FString cb_signal
, FCallback cb_handler
, 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
, FMemberCallback cb_handler
, 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
if ( ! member_callback_objects.empty() )

View File

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

View File

@ -18,6 +18,7 @@ noinst_PROGRAMS = \
term-attributes \
transparent \
keyboard \
mouse \
timer \
scrollview \
windows \
@ -36,6 +37,7 @@ watch_SOURCES = watch.cpp
term_attributes_SOURCES = term-attributes.cpp
transparent_SOURCES = transparent.cpp
keyboard_SOURCES = keyboard.cpp
mouse_SOURCES = mouse.cpp
timer_SOURCES = timer.cpp
scrollview_SOURCES = scrollview.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) \
mandelbrot$(EXEEXT) calculator$(EXEEXT) watch$(EXEEXT) \
term-attributes$(EXEEXT) transparent$(EXEEXT) \
keyboard$(EXEEXT) timer$(EXEEXT) scrollview$(EXEEXT) \
windows$(EXEEXT) menu$(EXEEXT) ui$(EXEEXT)
keyboard$(EXEEXT) mouse$(EXEEXT) timer$(EXEEXT) \
scrollview$(EXEEXT) windows$(EXEEXT) menu$(EXEEXT) ui$(EXEEXT)
subdir = test
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
@ -131,6 +131,9 @@ mandelbrot_LDADD = $(LDADD)
am_menu_OBJECTS = menu.$(OBJEXT)
menu_OBJECTS = $(am_menu_OBJECTS)
menu_LDADD = $(LDADD)
am_mouse_OBJECTS = mouse.$(OBJEXT)
mouse_OBJECTS = $(am_mouse_OBJECTS)
mouse_LDADD = $(LDADD)
am_opti_move_OBJECTS = opti-move.$(OBJEXT)
opti_move_OBJECTS = $(am_opti_move_OBJECTS)
opti_move_LDADD = $(LDADD)
@ -194,15 +197,15 @@ am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
SOURCES = $(calculator_SOURCES) $(choice_SOURCES) $(dialog_SOURCES) \
$(hello_SOURCES) $(input_dialog_SOURCES) $(keyboard_SOURCES) \
$(mandelbrot_SOURCES) $(menu_SOURCES) $(opti_move_SOURCES) \
$(scrollview_SOURCES) $(string_operations_SOURCES) \
$(term_attributes_SOURCES) $(timer_SOURCES) \
$(transparent_SOURCES) $(ui_SOURCES) $(watch_SOURCES) \
$(windows_SOURCES)
$(mandelbrot_SOURCES) $(menu_SOURCES) $(mouse_SOURCES) \
$(opti_move_SOURCES) $(scrollview_SOURCES) \
$(string_operations_SOURCES) $(term_attributes_SOURCES) \
$(timer_SOURCES) $(transparent_SOURCES) $(ui_SOURCES) \
$(watch_SOURCES) $(windows_SOURCES)
DIST_SOURCES = $(calculator_SOURCES) $(choice_SOURCES) \
$(dialog_SOURCES) $(hello_SOURCES) $(input_dialog_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) \
$(timer_SOURCES) $(transparent_SOURCES) $(ui_SOURCES) \
$(watch_SOURCES) $(windows_SOURCES)
@ -366,6 +369,7 @@ watch_SOURCES = watch.cpp
term_attributes_SOURCES = term-attributes.cpp
transparent_SOURCES = transparent.cpp
keyboard_SOURCES = keyboard.cpp
mouse_SOURCES = mouse.cpp
timer_SOURCES = timer.cpp
scrollview_SOURCES = scrollview.cpp
windows_SOURCES = windows.cpp
@ -447,6 +451,10 @@ menu$(EXEEXT): $(menu_OBJECTS) $(menu_DEPENDENCIES) $(EXTRA_menu_DEPENDENCIES)
@rm -f menu$(EXEEXT)
$(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)
@rm -f opti-move$(EXEEXT)
$(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)/mandelbrot.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)/scrollview.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();
const wchar_t* button_text[Calc::NUM_OF_BUTTONS] =
const wchar_t* const button_text[Calc::NUM_OF_BUTTONS] =
{
L"&Sin",
L"&Cos",

View File

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