FObject has received the iterator child access methods begin() and end()
This commit is contained in:
parent
37f8ee81c9
commit
4df0418aee
|
@ -1,3 +1,7 @@
|
||||||
|
2017-09-17 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* FObject has received the iterator child access methods
|
||||||
|
begin() and end()
|
||||||
|
|
||||||
2017-09-15 Markus Gans <guru.mail@muenster.de>
|
2017-09-15 Markus Gans <guru.mail@muenster.de>
|
||||||
* Fix byte access in data type char_data
|
* Fix byte access in data type char_data
|
||||||
|
|
||||||
|
|
|
@ -1044,11 +1044,11 @@ bool FApplication::processAccelerator (const FWidget*& widget)
|
||||||
&& widget->accelerator_list
|
&& widget->accelerator_list
|
||||||
&& ! widget->accelerator_list->empty() )
|
&& ! widget->accelerator_list->empty() )
|
||||||
{
|
{
|
||||||
FWidget::Accelerators::const_iterator iter, end;
|
FWidget::Accelerators::const_iterator iter, last;
|
||||||
iter = widget->accelerator_list->begin();
|
iter = widget->accelerator_list->begin();
|
||||||
end = widget->accelerator_list->end();
|
last = widget->accelerator_list->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( quit_now || app_exit_loop )
|
if ( quit_now || app_exit_loop )
|
||||||
break;
|
break;
|
||||||
|
@ -1918,7 +1918,7 @@ void FApplication::processResizeEvent()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FApplication::processTimerEvent()
|
int FApplication::processTimerEvent()
|
||||||
{
|
{
|
||||||
FObject::TimerList::iterator iter, end;
|
FObject::TimerList::iterator iter, last;
|
||||||
timeval currentTime;
|
timeval currentTime;
|
||||||
int activated = 0;
|
int activated = 0;
|
||||||
|
|
||||||
|
@ -1934,9 +1934,9 @@ int FApplication::processTimerEvent()
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
iter = timer_list->begin();
|
iter = timer_list->begin();
|
||||||
end = timer_list->end();
|
last = timer_list->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( ! (*iter).id
|
if ( ! (*iter).id
|
||||||
|| ! (*iter).object
|
|| ! (*iter).object
|
||||||
|
|
|
@ -126,11 +126,11 @@ bool FButtonGroup::hasFocusedButton() const
|
||||||
if ( buttonlist.empty() )
|
if ( buttonlist.empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
constFObjectIterator iter, end;
|
constFObjectIterator iter, last;
|
||||||
iter = buttonlist.begin();
|
iter = buttonlist.begin();
|
||||||
end = buttonlist.end();
|
last = buttonlist.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||||
|
|
||||||
|
@ -149,11 +149,11 @@ bool FButtonGroup::hasCheckedButton() const
|
||||||
if ( buttonlist.empty() )
|
if ( buttonlist.empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
constFObjectIterator iter, end;
|
constFObjectIterator iter, last;
|
||||||
iter = buttonlist.begin();
|
iter = buttonlist.begin();
|
||||||
end = buttonlist.end();
|
last = buttonlist.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||||
|
|
||||||
|
@ -177,11 +177,11 @@ void FButtonGroup::hide()
|
||||||
|
|
||||||
if ( ! buttonlist.empty() )
|
if ( ! buttonlist.empty() )
|
||||||
{
|
{
|
||||||
constFObjectIterator iter, end;
|
constFObjectIterator iter, last;
|
||||||
iter = buttonlist.begin();
|
iter = buttonlist.begin();
|
||||||
end = buttonlist.end();
|
last = buttonlist.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||||
toggle_button->hide();
|
toggle_button->hide();
|
||||||
|
@ -325,11 +325,11 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
||||||
{
|
{
|
||||||
if ( hasCheckedButton() && ! buttonlist.empty() )
|
if ( hasCheckedButton() && ! buttonlist.empty() )
|
||||||
{
|
{
|
||||||
constFObjectIterator iter, end;
|
constFObjectIterator iter, last;
|
||||||
iter = buttonlist.begin();
|
iter = buttonlist.begin();
|
||||||
end = buttonlist.end();
|
last = buttonlist.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
||||||
void FButtonGroup::cb_buttonToggled (FWidget* widget, data_ptr)
|
void FButtonGroup::cb_buttonToggled (FWidget* widget, data_ptr)
|
||||||
{
|
{
|
||||||
FToggleButton* button = static_cast<FToggleButton*>(widget);
|
FToggleButton* button = static_cast<FToggleButton*>(widget);
|
||||||
constFObjectIterator iter, end;
|
constFObjectIterator iter, last;
|
||||||
|
|
||||||
if ( ! button->isChecked() )
|
if ( ! button->isChecked() )
|
||||||
return;
|
return;
|
||||||
|
@ -398,9 +398,9 @@ void FButtonGroup::cb_buttonToggled (FWidget* widget, data_ptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
iter = buttonlist.begin();
|
iter = buttonlist.begin();
|
||||||
end = buttonlist.end();
|
last = buttonlist.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||||
|
|
||||||
|
@ -600,11 +600,11 @@ void FButtonGroup::directFocus()
|
||||||
|
|
||||||
if ( hasCheckedButton() && ! buttonlist.empty() )
|
if ( hasCheckedButton() && ! buttonlist.empty() )
|
||||||
{
|
{
|
||||||
constFObjectIterator iter, end;
|
constFObjectIterator iter, last;
|
||||||
iter = buttonlist.begin();
|
iter = buttonlist.begin();
|
||||||
end = buttonlist.end();
|
last = buttonlist.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||||
|
|
||||||
|
|
|
@ -249,11 +249,11 @@ void FDialog::setPos (int x, int y, bool)
|
||||||
if ( window_list && ! window_list->empty() )
|
if ( window_list && ! window_list->empty() )
|
||||||
{
|
{
|
||||||
bool overlaid = false;
|
bool overlaid = false;
|
||||||
widgetList::const_iterator iter, end;
|
widgetList::const_iterator iter, last;
|
||||||
iter = window_list->begin();
|
iter = window_list->begin();
|
||||||
end = window_list->end();
|
last = window_list->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( overlaid )
|
if ( overlaid )
|
||||||
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
||||||
|
@ -335,11 +335,11 @@ void FDialog::setSize (int w, int h, bool adjust)
|
||||||
if ( window_list && ! window_list->empty() )
|
if ( window_list && ! window_list->empty() )
|
||||||
{
|
{
|
||||||
bool overlaid = false;
|
bool overlaid = false;
|
||||||
widgetList::const_iterator iter, end;
|
widgetList::const_iterator iter, last;
|
||||||
iter = window_list->begin();
|
iter = window_list->begin();
|
||||||
end = window_list->end();
|
last = window_list->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( overlaid )
|
if ( overlaid )
|
||||||
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
||||||
|
@ -949,11 +949,11 @@ void FDialog::onWindowRaised (FEvent*)
|
||||||
// handle always-on-top windows
|
// handle always-on-top windows
|
||||||
if ( always_on_top_list && ! always_on_top_list->empty() )
|
if ( always_on_top_list && ! always_on_top_list->empty() )
|
||||||
{
|
{
|
||||||
widgetList::const_iterator iter, end;
|
widgetList::const_iterator iter, last;
|
||||||
iter = always_on_top_list->begin();
|
iter = always_on_top_list->begin();
|
||||||
end = always_on_top_list->end();
|
last = always_on_top_list->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -964,7 +964,7 @@ void FDialog::onWindowRaised (FEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onWindowLowered (FEvent*)
|
void FDialog::onWindowLowered (FEvent*)
|
||||||
{
|
{
|
||||||
widgetList::const_iterator iter, end;
|
widgetList::const_iterator iter, last;
|
||||||
|
|
||||||
if ( ! window_list )
|
if ( ! window_list )
|
||||||
return;
|
return;
|
||||||
|
@ -973,9 +973,9 @@ void FDialog::onWindowLowered (FEvent*)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
iter = window_list->begin();
|
iter = window_list->begin();
|
||||||
end = window_list->end();
|
last = window_list->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
||||||
++iter;
|
++iter;
|
||||||
|
|
|
@ -346,11 +346,11 @@ int FFileDialog::readDir()
|
||||||
|
|
||||||
if ( ! dir_entries.empty() )
|
if ( ! dir_entries.empty() )
|
||||||
{
|
{
|
||||||
std::vector<dir_entry>::const_iterator iter, end;
|
std::vector<dir_entry>::const_iterator iter, last;
|
||||||
iter = dir_entries.begin();
|
iter = dir_entries.begin();
|
||||||
end = dir_entries.end();
|
last = dir_entries.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter).type == DT_DIR )
|
if ( (*iter).type == DT_DIR )
|
||||||
filebrowser->insert(FString((*iter).name), fc::SquareBrackets);
|
filebrowser->insert(FString((*iter).name), fc::SquareBrackets);
|
||||||
|
@ -612,16 +612,16 @@ inline bool FFileDialog::pattern_match ( const char* const pattern
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::clear()
|
void FFileDialog::clear()
|
||||||
{
|
{
|
||||||
std::vector<dir_entry>::const_iterator iter, end;
|
std::vector<dir_entry>::const_iterator iter, last;
|
||||||
|
|
||||||
if ( dir_entries.empty() )
|
if ( dir_entries.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// delete all directory entries;
|
// delete all directory entries;
|
||||||
iter = dir_entries.begin();
|
iter = dir_entries.begin();
|
||||||
end = dir_entries.end();
|
last = dir_entries.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
std::free ((*iter).name);
|
std::free ((*iter).name);
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -637,11 +637,11 @@ int FFileDialog::numOfDirs()
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
std::vector<dir_entry>::const_iterator iter, end;
|
std::vector<dir_entry>::const_iterator iter, last;
|
||||||
iter = dir_entries.begin();
|
iter = dir_entries.begin();
|
||||||
end = dir_entries.end();
|
last = dir_entries.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter).type == DT_DIR && std::strcmp((*iter).name, ".") != 0 )
|
if ( (*iter).type == DT_DIR && std::strcmp((*iter).name, ".") != 0 )
|
||||||
n++;
|
n++;
|
||||||
|
@ -685,13 +685,13 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
else if ( ! dir_entries.empty() )
|
else if ( ! dir_entries.empty() )
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
std::vector<dir_entry>::const_iterator iter, end;
|
std::vector<dir_entry>::const_iterator iter, last;
|
||||||
const char* const baseName = \
|
const char* const baseName = \
|
||||||
basename(const_cast<char*>(lastdir.c_str()));
|
basename(const_cast<char*>(lastdir.c_str()));
|
||||||
iter = dir_entries.begin();
|
iter = dir_entries.begin();
|
||||||
end = dir_entries.end();
|
last = dir_entries.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( std::strcmp((*iter).name, baseName) == 0 )
|
if ( std::strcmp((*iter).name, baseName) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -777,12 +777,12 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
||||||
|
|
||||||
if ( ! dir_entries.empty() )
|
if ( ! dir_entries.empty() )
|
||||||
{
|
{
|
||||||
std::vector<dir_entry>::const_iterator iter, end;
|
std::vector<dir_entry>::const_iterator iter, last;
|
||||||
const FString& input = filename->getText().trim();
|
const FString& input = filename->getText().trim();
|
||||||
iter = dir_entries.begin();
|
iter = dir_entries.begin();
|
||||||
end = dir_entries.end();
|
last = dir_entries.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter).name && input && ! input.isNull()
|
if ( (*iter).name && input && ! input.isNull()
|
||||||
&& std::strcmp((*iter).name, input) == 0
|
&& std::strcmp((*iter).name, input) == 0
|
||||||
|
|
|
@ -1372,7 +1372,7 @@ void FListBox::drawLabel()
|
||||||
void FListBox::drawList()
|
void FListBox::drawList()
|
||||||
{
|
{
|
||||||
FString element;
|
FString element;
|
||||||
uInt start, end, inc_len;
|
uInt start, num, inc_len;
|
||||||
bool isFocus;
|
bool isFocus;
|
||||||
listBoxItems::iterator iter;
|
listBoxItems::iterator iter;
|
||||||
|
|
||||||
|
@ -1381,11 +1381,11 @@ void FListBox::drawList()
|
||||||
|
|
||||||
isFocus = ((flags & fc::focus) != 0);
|
isFocus = ((flags & fc::focus) != 0);
|
||||||
start = 0;
|
start = 0;
|
||||||
end = uInt(getHeight() - 2);
|
num = uInt(getHeight() - 2);
|
||||||
inc_len = inc_search.getLength();
|
inc_len = inc_search.getLength();
|
||||||
|
|
||||||
if ( end > getCount() )
|
if ( num > getCount() )
|
||||||
end = getCount();
|
num = getCount();
|
||||||
|
|
||||||
if ( last_yoffset >= 0
|
if ( last_yoffset >= 0
|
||||||
&& last_yoffset == yoffset
|
&& last_yoffset == yoffset
|
||||||
|
@ -1395,12 +1395,12 @@ void FListBox::drawList()
|
||||||
uInt last_pos = uInt(current - yoffset) - 1;
|
uInt last_pos = uInt(current - yoffset) - 1;
|
||||||
uInt current_pos = uInt(last_current - yoffset) - 1;
|
uInt current_pos = uInt(last_current - yoffset) - 1;
|
||||||
start = std::min(last_pos, current_pos);
|
start = std::min(last_pos, current_pos);
|
||||||
end = std::max(last_pos, current_pos) + 1;
|
num = std::max(last_pos, current_pos) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
iter = index2iterator(int(start) + yoffset);
|
iter = index2iterator(int(start) + yoffset);
|
||||||
|
|
||||||
for (uInt y = start; y < end; y++)
|
for (uInt y = start; y < num; y++)
|
||||||
{
|
{
|
||||||
bool serach_mark = false;
|
bool serach_mark = false;
|
||||||
bool lineHasBrackets = hasBrackets(iter);
|
bool lineHasBrackets = hasBrackets(iter);
|
||||||
|
|
|
@ -118,7 +118,7 @@ void FListViewItem::setText (int column, const FString& text)
|
||||||
FObject::FObjectIterator FListViewItem::insert (FListViewItem* child)
|
FObject::FObjectIterator FListViewItem::insert (FListViewItem* child)
|
||||||
{
|
{
|
||||||
// Add a FListViewItem as child element
|
// Add a FListViewItem as child element
|
||||||
if ( ! child || ! hasChildren() )
|
if ( ! child )
|
||||||
return FObjectIterator(0);
|
return FObjectIterator(0);
|
||||||
|
|
||||||
return appendItem(child);
|
return appendItem(child);
|
||||||
|
@ -174,8 +174,7 @@ FObject::FObjectIterator FListViewItem::appendItem (FListViewItem* child)
|
||||||
{
|
{
|
||||||
expandable = true;
|
expandable = true;
|
||||||
addChild (child);
|
addChild (child);
|
||||||
FObjectList children = getChildren();
|
return --FObject::end();
|
||||||
return --children.end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -203,10 +202,9 @@ int FListViewItem::getVisibleLines()
|
||||||
return visible_lines;
|
return visible_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
FObjectList children = this->getChildren();
|
constFObjectIterator iter = FObject::begin();
|
||||||
constFObjectIterator iter = children.begin();
|
|
||||||
|
|
||||||
while ( iter != children.end() )
|
while ( iter != FObject::end() )
|
||||||
{
|
{
|
||||||
FListViewItem* child = static_cast<FListViewItem*>(*iter);
|
FListViewItem* child = static_cast<FListViewItem*>(*iter);
|
||||||
visible_lines += child->getVisibleLines();
|
visible_lines += child->getVisibleLines();
|
||||||
|
|
|
@ -174,6 +174,8 @@ class FListView : public FWidget
|
||||||
FObjectIterator insert ( const std::vector<long>&
|
FObjectIterator insert ( const std::vector<long>&
|
||||||
, data_ptr
|
, data_ptr
|
||||||
, FObjectIterator );
|
, FObjectIterator );
|
||||||
|
FObjectIterator beginOfList();
|
||||||
|
FObjectIterator endOfList();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
void onKeyPress (FKeyEvent*);
|
||||||
|
@ -322,6 +324,14 @@ inline FObject::FObjectIterator
|
||||||
, FObjectIterator parent_iter )
|
, FObjectIterator parent_iter )
|
||||||
{ return insert (cols, 0, parent_iter); }
|
{ return insert (cols, 0, parent_iter); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FObject::FObjectIterator FListView::beginOfList()
|
||||||
|
{ return itemlist.begin(); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FObject::FObjectIterator FListView::endOfList()
|
||||||
|
{ return itemlist.end(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FObject::FObjectIterator FListView::index2iterator (int index)
|
inline FObject::FObjectIterator FListView::index2iterator (int index)
|
||||||
{
|
{
|
||||||
|
@ -333,6 +343,14 @@ inline FObject::FObjectIterator FListView::index2iterator (int index)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListView::nextElement (FObjectIterator& iter)
|
inline void FListView::nextElement (FObjectIterator& iter)
|
||||||
{
|
{
|
||||||
|
FListViewItem* item = static_cast<FListViewItem*>(*iter);
|
||||||
|
|
||||||
|
if ( item->isExpandable() )
|
||||||
|
{
|
||||||
|
//iter = item->begin();
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
else
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,17 +293,17 @@ void FMenu::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! item_list.empty() )
|
if ( ! item_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
FMenu* show_sub_menu = 0;
|
FMenu* show_sub_menu = 0;
|
||||||
bool focus_changed = false;
|
bool focus_changed = false;
|
||||||
FPoint mouse_pos;
|
FPoint mouse_pos;
|
||||||
|
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
mouse_pos = ev->getPos();
|
mouse_pos = ev->getPos();
|
||||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1, x2, y, mouse_x, mouse_y;
|
int x1, x2, y, mouse_x, mouse_y;
|
||||||
x1 = (*iter)->getX();
|
x1 = (*iter)->getX();
|
||||||
|
@ -401,14 +401,14 @@ void FMenu::onMouseUp (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! item_list.empty() )
|
if ( ! item_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
FPoint mouse_pos;
|
FPoint mouse_pos;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
mouse_pos = ev->getPos();
|
mouse_pos = ev->getPos();
|
||||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1, x2, y;
|
int x1, x2, y;
|
||||||
x1 = (*iter)->getX();
|
x1 = (*iter)->getX();
|
||||||
|
@ -480,7 +480,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( mouse_down && ! item_list.empty() )
|
if ( mouse_down && ! item_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
FMenu* smenu = 0;
|
FMenu* smenu = 0;
|
||||||
bool focus_changed = false;
|
bool focus_changed = false;
|
||||||
bool mouse_over_menu = false;
|
bool mouse_over_menu = false;
|
||||||
|
@ -492,7 +492,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
FPoint mouse_pos;
|
FPoint mouse_pos;
|
||||||
|
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
mouse_pos = ev->getPos();
|
mouse_pos = ev->getPos();
|
||||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
mouse_over_menubar = true;
|
mouse_over_menubar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1, x2, y, mouse_x, mouse_y;
|
int x1, x2, y, mouse_x, mouse_y;
|
||||||
x1 = (*iter)->getX();
|
x1 = (*iter)->getX();
|
||||||
|
@ -710,7 +710,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
void FMenu::cb_menuitem_toggled (FWidget* widget, data_ptr)
|
void FMenu::cb_menuitem_toggled (FWidget* widget, data_ptr)
|
||||||
{
|
{
|
||||||
FMenuItem* menuitem = static_cast<FMenuItem*>(widget);
|
FMenuItem* menuitem = static_cast<FMenuItem*>(widget);
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
|
|
||||||
if ( ! has_checkable_items )
|
if ( ! has_checkable_items )
|
||||||
return;
|
return;
|
||||||
|
@ -722,9 +722,9 @@ void FMenu::cb_menuitem_toggled (FWidget* widget, data_ptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter) != menuitem
|
if ( (*iter) != menuitem
|
||||||
&& (*iter)->isChecked()
|
&& (*iter)->isChecked()
|
||||||
|
@ -819,13 +819,13 @@ void FMenu::init(FWidget* parent)
|
||||||
void FMenu::calculateDimensions()
|
void FMenu::calculateDimensions()
|
||||||
{
|
{
|
||||||
int item_X, item_Y, adjust_X;
|
int item_X, item_Y, adjust_X;
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
max_item_width = 10; // minimum width
|
max_item_width = 10; // minimum width
|
||||||
|
|
||||||
// find the maximum item width
|
// find the maximum item width
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
uInt item_width = (*iter)->getTextLength() + 2;
|
uInt item_width = (*iter)->getTextLength() + 2;
|
||||||
int accel_key = (*iter)->accel_key;
|
int accel_key = (*iter)->accel_key;
|
||||||
|
@ -860,7 +860,7 @@ void FMenu::calculateDimensions()
|
||||||
item_X = 1;
|
item_X = 1;
|
||||||
item_Y = 1;
|
item_Y = 1;
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
(*iter)->setGeometry (item_X, item_Y, int(max_item_width), 1);
|
(*iter)->setGeometry (item_X, item_Y, int(max_item_width), 1);
|
||||||
|
|
||||||
|
@ -880,11 +880,11 @@ void FMenu::calculateDimensions()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::adjustItems()
|
void FMenu::adjustItems()
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator end, iter;
|
std::vector<FMenuItem*>::const_iterator last, iter;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->hasMenu() )
|
if ( (*iter)->hasMenu() )
|
||||||
{
|
{
|
||||||
|
@ -1034,11 +1034,11 @@ FMenu* FMenu::superMenuAt (int x, int y)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::selectNextItem()
|
bool FMenu::selectNextItem()
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->isSelected() )
|
if ( (*iter)->isSelected() )
|
||||||
{
|
{
|
||||||
|
@ -1084,9 +1084,9 @@ bool FMenu::selectNextItem()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::selectPrevItem()
|
bool FMenu::selectPrevItem()
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, begin;
|
std::vector<FMenuItem*>::const_iterator iter, first;
|
||||||
iter = item_list.end();
|
iter = item_list.end();
|
||||||
begin = item_list.begin();
|
first = item_list.begin();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -1127,7 +1127,7 @@ bool FMenu::selectPrevItem()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( iter != begin );
|
while ( iter != first );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1144,11 +1144,11 @@ void FMenu::keypressMenuBar (FKeyEvent*& ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::hotkeyMenu (FKeyEvent*& ev)
|
bool FMenu::hotkeyMenu (FKeyEvent*& ev)
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->hasHotkey() )
|
if ( (*iter)->hasHotkey() )
|
||||||
{
|
{
|
||||||
|
@ -1242,16 +1242,16 @@ void FMenu::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::drawItems()
|
void FMenu::drawItems()
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
|
|
||||||
if ( has_checkable_items )
|
if ( has_checkable_items )
|
||||||
c = 1;
|
c = 1;
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->isSeparator() )
|
if ( (*iter)->isSeparator() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -169,16 +169,16 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! item_list.empty() )
|
if ( ! item_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
int mouse_x, mouse_y;
|
int mouse_x, mouse_y;
|
||||||
bool focus_changed = false;
|
bool focus_changed = false;
|
||||||
|
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1, x2;
|
int x1, x2;
|
||||||
x1 = (*iter)->getX();
|
x1 = (*iter)->getX();
|
||||||
|
@ -255,13 +255,13 @@ void FMenuBar::onMouseUp (FMouseEvent* ev)
|
||||||
if ( ! item_list.empty() )
|
if ( ! item_list.empty() )
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y;
|
int mouse_x, mouse_y;
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1, x2;
|
int x1, x2;
|
||||||
x1 = (*iter)->getX();
|
x1 = (*iter)->getX();
|
||||||
|
@ -338,19 +338,19 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( mouse_down && ! item_list.empty() )
|
if ( mouse_down && ! item_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
int mouse_x, mouse_y;
|
int mouse_x, mouse_y;
|
||||||
bool mouse_over_menubar = false;
|
bool mouse_over_menubar = false;
|
||||||
bool focus_changed = false;
|
bool focus_changed = false;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( getTermGeometry().contains(ev->getTermPos()) )
|
if ( getTermGeometry().contains(ev->getTermPos()) )
|
||||||
mouse_over_menubar = true;
|
mouse_over_menubar = true;
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1, x2;
|
int x1, x2;
|
||||||
x1 = (*iter)->getX();
|
x1 = (*iter)->getX();
|
||||||
|
@ -506,12 +506,12 @@ void FMenuBar::calculateDimensions()
|
||||||
{
|
{
|
||||||
int item_X = 1;
|
int item_X = 1;
|
||||||
int item_Y = 1;
|
int item_Y = 1;
|
||||||
std::vector<FMenuItem*>::const_iterator end, iter;
|
std::vector<FMenuItem*>::const_iterator last, iter;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
|
|
||||||
// find the maximum item width
|
// find the maximum item width
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
uInt len = (*iter)->getTextLength();
|
uInt len = (*iter)->getTextLength();
|
||||||
int item_width = int(len + 2);
|
int item_width = int(len + 2);
|
||||||
|
@ -532,11 +532,11 @@ void FMenuBar::calculateDimensions()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenuBar::selectNextItem()
|
bool FMenuBar::selectNextItem()
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->isSelected() )
|
if ( (*iter)->isSelected() )
|
||||||
{
|
{
|
||||||
|
@ -597,9 +597,9 @@ bool FMenuBar::selectNextItem()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenuBar::selectPrevItem()
|
bool FMenuBar::selectPrevItem()
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, begin;
|
std::vector<FMenuItem*>::const_iterator iter, first;
|
||||||
iter = item_list.end();
|
iter = item_list.end();
|
||||||
begin = item_list.begin();
|
first = item_list.begin();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -655,7 +655,7 @@ bool FMenuBar::selectPrevItem()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( iter != begin );
|
while ( iter != first );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -663,11 +663,11 @@ bool FMenuBar::selectPrevItem()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->isEnabled() )
|
if ( (*iter)->isEnabled() )
|
||||||
{
|
{
|
||||||
|
@ -756,7 +756,7 @@ void FMenuBar::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::drawItems()
|
void FMenuBar::drawItems()
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
int screenWidth;
|
int screenWidth;
|
||||||
int x = 1;
|
int x = 1;
|
||||||
screenWidth = getColumnNumber();
|
screenWidth = getColumnNumber();
|
||||||
|
@ -770,9 +770,9 @@ void FMenuBar::drawItems()
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
wchar_t* src;
|
wchar_t* src;
|
||||||
wchar_t* dest;
|
wchar_t* dest;
|
||||||
|
@ -922,11 +922,11 @@ void FMenuBar::adjustItems()
|
||||||
{
|
{
|
||||||
int item_X = 1;
|
int item_X = 1;
|
||||||
int item_Y = 1;
|
int item_Y = 1;
|
||||||
std::vector<FMenuItem*>::const_iterator end, iter;
|
std::vector<FMenuItem*>::const_iterator last, iter;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
end = item_list.end();
|
last = item_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
// get item width
|
// get item width
|
||||||
int item_width = (*iter)->getWidth();
|
int item_width = (*iter)->getWidth();
|
||||||
|
|
|
@ -728,7 +728,7 @@ void FMenuItem::init (FWidget* parent)
|
||||||
, this );
|
, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
this->addCallback
|
addCallback // for this element
|
||||||
(
|
(
|
||||||
"deactivate",
|
"deactivate",
|
||||||
F_METHOD_CALLBACK (parent, &FMenuBar::cb_item_deactivated)
|
F_METHOD_CALLBACK (parent, &FMenuBar::cb_item_deactivated)
|
||||||
|
@ -789,8 +789,8 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
||||||
|
|
||||||
if ( dialog_list && ! dialog_list->empty() )
|
if ( dialog_list && ! dialog_list->empty() )
|
||||||
{
|
{
|
||||||
widgetList::const_iterator iter, begin;
|
widgetList::const_iterator iter, first;
|
||||||
iter = begin = dialog_list->begin();
|
iter = first = dialog_list->begin();
|
||||||
|
|
||||||
while ( iter != dialog_list->end() && *iter )
|
while ( iter != dialog_list->end() && *iter )
|
||||||
{
|
{
|
||||||
|
@ -799,7 +799,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
FMenuItem* win_item;
|
FMenuItem* win_item;
|
||||||
int n = int(std::distance(begin, iter));
|
int n = int(std::distance(first, iter));
|
||||||
// get the dialog title
|
// get the dialog title
|
||||||
const FString& name = win->getText();
|
const FString& name = win->getText();
|
||||||
|
|
||||||
|
|
|
@ -79,14 +79,14 @@ FObject::~FObject() // destructor
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete children objects
|
// delete children objects
|
||||||
FObjectList children = this->getChildren();
|
if ( hasChildren() )
|
||||||
|
|
||||||
if ( ! children.empty() )
|
|
||||||
{
|
{
|
||||||
constFObjectIterator iter;
|
constFObjectIterator iter, last;
|
||||||
iter = children.begin();
|
FObjectList delete_list = children_list;
|
||||||
|
iter = delete_list.begin();
|
||||||
|
last = delete_list.end();
|
||||||
|
|
||||||
while ( iter != children.end() )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
delete (*iter);
|
delete (*iter);
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -100,14 +100,14 @@ FObject* FObject::getChild (int index) const
|
||||||
{
|
{
|
||||||
index--;
|
index--;
|
||||||
|
|
||||||
if ( children_list.empty() )
|
if ( ! hasChildren() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( index < 0 || index >= numOfChildren() )
|
if ( index < 0 || index >= numOfChildren() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
constFObjectIterator iter;
|
constFObjectIterator iter;
|
||||||
iter = children_list.begin();
|
iter = begin();
|
||||||
std::advance (iter, index);
|
std::advance (iter, index);
|
||||||
return *iter;
|
return *iter;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ void FObject::delChild (FObject* obj)
|
||||||
if ( ! obj )
|
if ( ! obj )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! children_list.empty() )
|
if ( hasChildren() )
|
||||||
{
|
{
|
||||||
obj->removeParent();
|
obj->removeParent();
|
||||||
children_list.remove(obj);
|
children_list.remove(obj);
|
||||||
|
@ -183,7 +183,7 @@ void FObject::getCurrentTime (timeval* time)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FObject::addTimer (int interval)
|
int FObject::addTimer (int interval)
|
||||||
{
|
{
|
||||||
FObject::TimerList::iterator iter, end;
|
FObject::TimerList::iterator iter, last;
|
||||||
timeval time_interval;
|
timeval time_interval;
|
||||||
timeval currentTime;
|
timeval currentTime;
|
||||||
int id = 1;
|
int id = 1;
|
||||||
|
@ -207,9 +207,9 @@ int FObject::addTimer (int interval)
|
||||||
if ( ! timer_list->empty() )
|
if ( ! timer_list->empty() )
|
||||||
{
|
{
|
||||||
iter = timer_list->begin();
|
iter = timer_list->begin();
|
||||||
end = timer_list->end();
|
last = timer_list->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter).id == id )
|
if ( (*iter).id == id )
|
||||||
{
|
{
|
||||||
|
@ -233,9 +233,9 @@ int FObject::addTimer (int interval)
|
||||||
|
|
||||||
// insert in list sorted by timeout
|
// insert in list sorted by timeout
|
||||||
iter = timer_list->begin();
|
iter = timer_list->begin();
|
||||||
end = timer_list->end();
|
last = timer_list->end();
|
||||||
|
|
||||||
while ( iter != end && (*iter).timeout < t.timeout )
|
while ( iter != last && (*iter).timeout < t.timeout )
|
||||||
++iter;
|
++iter;
|
||||||
|
|
||||||
timer_list->insert (iter, t);
|
timer_list->insert (iter, t);
|
||||||
|
@ -247,19 +247,19 @@ int FObject::addTimer (int interval)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FObject::delTimer (int id)
|
bool FObject::delTimer (int id)
|
||||||
{
|
{
|
||||||
FObject::TimerList::iterator iter, end;
|
FObject::TimerList::iterator iter, last;
|
||||||
|
|
||||||
if ( id <= 0 || id > int(timer_list->size()) )
|
if ( id <= 0 || id > int(timer_list->size()) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
timer_modify_lock = true;
|
timer_modify_lock = true;
|
||||||
iter = timer_list->begin();
|
iter = timer_list->begin();
|
||||||
end = timer_list->end();
|
last = timer_list->end();
|
||||||
|
|
||||||
while ( iter != end && (*iter).id != id )
|
while ( iter != last && (*iter).id != id )
|
||||||
++iter;
|
++iter;
|
||||||
|
|
||||||
if ( iter != end )
|
if ( iter != last )
|
||||||
{
|
{
|
||||||
timer_list->erase(iter);
|
timer_list->erase(iter);
|
||||||
timer_modify_lock = false;
|
timer_modify_lock = false;
|
||||||
|
|
|
@ -50,6 +50,10 @@ class FObject
|
||||||
FObject* getChild (int) const;
|
FObject* getChild (int) const;
|
||||||
const FObjectList& getChildren() const;
|
const FObjectList& getChildren() const;
|
||||||
int numOfChildren() const;
|
int numOfChildren() const;
|
||||||
|
FObjectIterator begin();
|
||||||
|
FObjectIterator end();
|
||||||
|
constFObjectIterator begin() const;
|
||||||
|
constFObjectIterator end() const;
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool hasParent() const;
|
bool hasParent() const;
|
||||||
|
@ -124,6 +128,22 @@ inline const FObject::FObjectList& FObject::getChildren() const
|
||||||
inline int FObject::numOfChildren() const
|
inline int FObject::numOfChildren() const
|
||||||
{ return int(children_list.size()); }
|
{ return int(children_list.size()); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FObject::FObjectIterator FObject::begin()
|
||||||
|
{ return children_list.begin(); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FObject::FObjectIterator FObject::end()
|
||||||
|
{ return children_list.end(); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FObject::constFObjectIterator FObject::begin() const
|
||||||
|
{ return children_list.begin(); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FObject::constFObjectIterator FObject::end() const
|
||||||
|
{ return children_list.end(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FObject::hasParent() const
|
inline bool FObject::hasParent() const
|
||||||
{ return has_parent; }
|
{ return has_parent; }
|
||||||
|
|
|
@ -45,7 +45,7 @@ void FRadioMenuItem::init (FWidget* parent)
|
||||||
if ( menu_ptr )
|
if ( menu_ptr )
|
||||||
menu_ptr->has_checkable_items = true;
|
menu_ptr->has_checkable_items = true;
|
||||||
|
|
||||||
this->addCallback
|
addCallback // for this element
|
||||||
(
|
(
|
||||||
"toggled",
|
"toggled",
|
||||||
F_METHOD_CALLBACK (parent, &FMenu::cb_menuitem_toggled)
|
F_METHOD_CALLBACK (parent, &FMenu::cb_menuitem_toggled)
|
||||||
|
|
|
@ -154,11 +154,11 @@ bool FStatusBar::hasActivatedKey()
|
||||||
{
|
{
|
||||||
if ( ! key_list.empty() )
|
if ( ! key_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FStatusKey*>::const_iterator iter, end;
|
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||||
iter = key_list.begin();
|
iter = key_list.begin();
|
||||||
end = key_list.end();
|
last = key_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->isActivated() )
|
if ( (*iter)->isActivated() )
|
||||||
return true;
|
return true;
|
||||||
|
@ -348,11 +348,11 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! key_list.empty() )
|
if ( ! key_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FStatusKey*>::const_iterator iter, end;
|
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||||
iter = key_list.begin();
|
iter = key_list.begin();
|
||||||
end = key_list.end();
|
last = key_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
(*iter)->unsetMouseFocus();
|
(*iter)->unsetMouseFocus();
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -370,12 +370,12 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! key_list.empty() )
|
if ( ! key_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FStatusKey*>::const_iterator iter, end;
|
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||||
int X = 1;
|
int X = 1;
|
||||||
iter = key_list.begin();
|
iter = key_list.begin();
|
||||||
end = key_list.end();
|
last = key_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1, x2, mouse_x, mouse_y, kname_len, txt_length;
|
int x1, x2, mouse_x, mouse_y, kname_len, txt_length;
|
||||||
|
|
||||||
|
@ -416,12 +416,12 @@ void FStatusBar::onMouseUp (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! key_list.empty() )
|
if ( ! key_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FStatusKey*>::const_iterator iter, end;
|
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||||
int X = 1;
|
int X = 1;
|
||||||
iter = key_list.begin();
|
iter = key_list.begin();
|
||||||
end = key_list.end();
|
last = key_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1, x2, kname_len, txt_length;
|
int x1, x2, kname_len, txt_length;
|
||||||
x1 = X;
|
x1 = X;
|
||||||
|
@ -462,13 +462,13 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( mouse_down && ! key_list.empty() )
|
if ( mouse_down && ! key_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FStatusKey*>::const_iterator iter, end;
|
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||||
bool focus_changed = false;
|
bool focus_changed = false;
|
||||||
int X = 1;
|
int X = 1;
|
||||||
iter = key_list.begin();
|
iter = key_list.begin();
|
||||||
end = key_list.end();
|
last = key_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1, x2, mouse_x, mouse_y, kname_len, txt_length;
|
int x1, x2, mouse_x, mouse_y, kname_len, txt_length;
|
||||||
x1 = X;
|
x1 = X;
|
||||||
|
@ -511,13 +511,13 @@ void FStatusBar::cb_statuskey_activated (FWidget* widget, data_ptr)
|
||||||
{
|
{
|
||||||
if ( ! key_list.empty() )
|
if ( ! key_list.empty() )
|
||||||
{
|
{
|
||||||
std::vector<FStatusKey*>::const_iterator iter, end;
|
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||||
FStatusKey* statuskey = static_cast<FStatusKey*>(widget);
|
FStatusKey* statuskey = static_cast<FStatusKey*>(widget);
|
||||||
|
|
||||||
iter = key_list.begin();
|
iter = key_list.begin();
|
||||||
end = key_list.end();
|
last = key_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter) != statuskey && (*iter)->isActivated() )
|
if ( (*iter) != statuskey && (*iter)->isActivated() )
|
||||||
(*iter)->unsetActive();
|
(*iter)->unsetActive();
|
||||||
|
@ -562,7 +562,7 @@ void FStatusBar::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::drawKeys()
|
void FStatusBar::drawKeys()
|
||||||
{
|
{
|
||||||
std::vector<FStatusKey*>::const_iterator iter, end;
|
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||||
int screenWidth;
|
int screenWidth;
|
||||||
|
|
||||||
screenWidth = getColumnNumber();
|
screenWidth = getColumnNumber();
|
||||||
|
@ -580,9 +580,9 @@ void FStatusBar::drawKeys()
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
iter = key_list.begin();
|
iter = key_list.begin();
|
||||||
end = key_list.end();
|
last = key_list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int kname_len = int(getKeyName((*iter)->getKey()).getLength());
|
int kname_len = int(getKeyName((*iter)->getKey()).getLength());
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
stringLines::iterator iter;
|
stringLines::iterator iter;
|
||||||
stringLines text_split;
|
stringLines text_split;
|
||||||
FString s;
|
FString s;
|
||||||
uLong end;
|
uLong num;
|
||||||
|
|
||||||
if ( pos < 0 || pos >= int(getRows()) )
|
if ( pos < 0 || pos >= int(getRows()) )
|
||||||
pos = int(getRows());
|
pos = int(getRows());
|
||||||
|
@ -197,9 +197,9 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
|
|
||||||
iter = data.begin();
|
iter = data.begin();
|
||||||
text_split = s.split("\r\n");
|
text_split = s.split("\r\n");
|
||||||
end = text_split.size();
|
num = text_split.size();
|
||||||
|
|
||||||
for (uInt i = 0; i < end; i++)
|
for (uInt i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
uInt len;
|
uInt len;
|
||||||
text_split[i] = text_split[i].removeBackspaces()
|
text_split[i] = text_split[i].removeBackspaces()
|
||||||
|
@ -239,24 +239,24 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::replaceRange (const FString& str, int start, int end)
|
void FTextView::replaceRange (const FString& str, int from, int to)
|
||||||
{
|
{
|
||||||
stringLines::iterator iter;
|
stringLines::iterator iter;
|
||||||
|
|
||||||
if ( start > end )
|
if ( from > to )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( start < 0 || start >= int(getRows()) )
|
if ( from < 0 || from >= int(getRows()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( end < 0 || end >= int(getRows()) )
|
if ( to < 0 || to >= int(getRows()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
iter = data.begin();
|
iter = data.begin();
|
||||||
data.erase (iter + start, iter + end + 1);
|
data.erase (iter + from, iter + to + 1);
|
||||||
|
|
||||||
if ( ! str.isNull() )
|
if ( ! str.isNull() )
|
||||||
insert(str, start);
|
insert(str, from);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -740,23 +740,22 @@ void FTextView::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::drawText()
|
void FTextView::drawText()
|
||||||
{
|
{
|
||||||
uInt start, end;
|
uInt num;
|
||||||
|
|
||||||
if ( data.empty() || getHeight() <= 2 || getWidth() <= 2 )
|
if ( data.empty() || getHeight() <= 2 || getWidth() <= 2 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
start = 0;
|
num = uInt(getHeight() + nf_offset - 2);
|
||||||
end = uInt(getHeight() + nf_offset - 2);
|
|
||||||
|
|
||||||
if ( end > getRows() )
|
if ( num > getRows() )
|
||||||
end = getRows();
|
num = getRows();
|
||||||
|
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
for (uInt y = start; y < end; y++)
|
for (uInt y = 0; y < num; y++)
|
||||||
{
|
{
|
||||||
uInt i, len;
|
uInt i, len;
|
||||||
FString line;
|
FString line;
|
||||||
|
|
|
@ -140,8 +140,8 @@ inline const FTextView::stringLines& FTextView::getLines() const
|
||||||
{ return data; }
|
{ return data; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FTextView::deleteRange (int start, int end)
|
inline void FTextView::deleteRange (int from, int to)
|
||||||
{ replaceRange (FString(), start, end); }
|
{ replaceRange (FString(), from, to); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FTextView::deleteLine (int pos)
|
inline void FTextView::deleteLine (int pos)
|
||||||
|
|
|
@ -277,7 +277,7 @@ void FVTerm::delPreprocessingHandler (FVTerm* instance)
|
||||||
if ( ! print_area || print_area->preprocessing_call.empty() )
|
if ( ! print_area || print_area->preprocessing_call.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FPreprocessing::iterator iter, end;
|
FPreprocessing::iterator iter;
|
||||||
iter = print_area->preprocessing_call.begin();
|
iter = print_area->preprocessing_call.begin();
|
||||||
|
|
||||||
while ( iter != print_area->preprocessing_call.end() )
|
while ( iter != print_area->preprocessing_call.end() )
|
||||||
|
@ -820,7 +820,7 @@ bool FVTerm::isChildPrintArea() const
|
||||||
|
|
||||||
if ( p_obj
|
if ( p_obj
|
||||||
&& p_obj->child_print_area
|
&& p_obj->child_print_area
|
||||||
&& p_obj->child_print_area == this->print_area )
|
&& p_obj->child_print_area == print_area )
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
164
src/fwidget.cpp
164
src/fwidget.cpp
|
@ -121,7 +121,7 @@ FWidget::~FWidget() // destructor
|
||||||
|
|
||||||
// finish the program
|
// finish the program
|
||||||
if ( rootObject == this )
|
if ( rootObject == this )
|
||||||
this->finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,16 +167,16 @@ FWidget* FWidget::getFocusWidget() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FWidget* FWidget::getFirstFocusableWidget (FObjectList children)
|
FWidget* FWidget::getFirstFocusableWidget (FObjectList list)
|
||||||
{
|
{
|
||||||
if ( children.empty() )
|
if ( list.empty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
constFObjectIterator iter, end;
|
constFObjectIterator iter, last;
|
||||||
iter = children.begin();
|
iter = list.begin();
|
||||||
end = children.end();
|
last = list.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->isWidget() )
|
if ( (*iter)->isWidget() )
|
||||||
{
|
{
|
||||||
|
@ -193,14 +193,14 @@ FWidget* FWidget::getFirstFocusableWidget (FObjectList children)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FWidget* FWidget::getLastFocusableWidget (FObjectList children)
|
FWidget* FWidget::getLastFocusableWidget (FObjectList list)
|
||||||
{
|
{
|
||||||
if ( children.empty() )
|
if ( list.empty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
constFObjectIterator iter, begin;
|
constFObjectIterator iter, first;
|
||||||
begin = children.begin();
|
first = list.begin();
|
||||||
iter = children.end();
|
iter = list.end();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -214,7 +214,7 @@ FWidget* FWidget::getLastFocusableWidget (FObjectList children)
|
||||||
if ( child->isEnabled() && child->acceptFocus() )
|
if ( child->isEnabled() && child->acceptFocus() )
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
while ( iter != begin );
|
while ( iter != first );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -838,14 +838,11 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
|
||||||
{
|
{
|
||||||
if ( p && p->hasChildren() )
|
if ( p && p->hasChildren() )
|
||||||
{
|
{
|
||||||
FObjectList children;
|
constFObjectIterator iter, last;
|
||||||
constFObjectIterator iter, end;
|
iter = p->begin();
|
||||||
|
last = p->end();
|
||||||
|
|
||||||
children = p->getChildren();
|
while ( iter != last )
|
||||||
iter = children.begin();
|
|
||||||
end = children.end();
|
|
||||||
|
|
||||||
while ( iter != end )
|
|
||||||
{
|
{
|
||||||
if ( ! (*iter)->isWidget() )
|
if ( ! (*iter)->isWidget() )
|
||||||
{
|
{
|
||||||
|
@ -874,18 +871,16 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FWidget::numOfFocusableChildren()
|
int FWidget::numOfFocusableChildren()
|
||||||
{
|
{
|
||||||
FObjectList children;
|
constFObjectIterator iter, last;
|
||||||
constFObjectIterator iter, end;
|
|
||||||
|
|
||||||
if ( ! this->hasChildren() )
|
if ( ! hasChildren() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int num = 0;
|
int num = 0;
|
||||||
children = this->getChildren();
|
iter = FObject::begin();
|
||||||
iter = children.begin();
|
last = FObject::end();
|
||||||
end = children.end();
|
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->isWidget() )
|
if ( (*iter)->isWidget() )
|
||||||
{
|
{
|
||||||
|
@ -1022,11 +1017,11 @@ void FWidget::emitCallback (const FString& emit_signal)
|
||||||
// function pointer
|
// function pointer
|
||||||
if ( ! callback_objects.empty() )
|
if ( ! callback_objects.empty() )
|
||||||
{
|
{
|
||||||
CallbackObjects::const_iterator iter, end;
|
CallbackObjects::const_iterator iter, last;
|
||||||
iter = callback_objects.begin();
|
iter = callback_objects.begin();
|
||||||
end = callback_objects.end();
|
last = callback_objects.end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( iter->cb_signal == emit_signal )
|
if ( iter->cb_signal == emit_signal )
|
||||||
{
|
{
|
||||||
|
@ -1108,11 +1103,11 @@ void FWidget::redraw()
|
||||||
|
|
||||||
if ( window_list && ! window_list->empty() )
|
if ( window_list && ! window_list->empty() )
|
||||||
{
|
{
|
||||||
widgetList::const_iterator iter, end;
|
widgetList::const_iterator iter, last;
|
||||||
iter = window_list->begin();
|
iter = window_list->begin();
|
||||||
end = window_list->end();
|
last = window_list->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter)->isVisible() )
|
if ( (*iter)->isVisible() )
|
||||||
{
|
{
|
||||||
|
@ -1131,16 +1126,13 @@ void FWidget::redraw()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// draw child elements
|
// draw child elements
|
||||||
if ( this->hasChildren() )
|
if ( hasChildren() )
|
||||||
{
|
{
|
||||||
FObjectList children;
|
constFObjectIterator iter, last;
|
||||||
constFObjectIterator iter, end;
|
iter = FObject::begin();
|
||||||
|
last = FObject::end();
|
||||||
|
|
||||||
children = this->getChildren();
|
while ( iter != last )
|
||||||
iter = children.begin();
|
|
||||||
end = children.end();
|
|
||||||
|
|
||||||
while ( iter != end )
|
|
||||||
{
|
{
|
||||||
if ( (*iter)->isWidget() )
|
if ( (*iter)->isWidget() )
|
||||||
{
|
{
|
||||||
|
@ -1229,16 +1221,13 @@ void FWidget::show()
|
||||||
draw();
|
draw();
|
||||||
shown = true;
|
shown = true;
|
||||||
|
|
||||||
if ( this->hasChildren() )
|
if ( hasChildren() )
|
||||||
{
|
{
|
||||||
FObjectList children;
|
constFObjectIterator iter, last;
|
||||||
constFObjectIterator iter, end;
|
iter = FObject::begin();
|
||||||
|
last = FObject::end();
|
||||||
|
|
||||||
children = this->getChildren();
|
while ( iter != last )
|
||||||
iter = children.begin();
|
|
||||||
end = children.end();
|
|
||||||
|
|
||||||
while ( iter != end )
|
|
||||||
{
|
{
|
||||||
if ( (*iter)->isWidget() )
|
if ( (*iter)->isWidget() )
|
||||||
{
|
{
|
||||||
|
@ -1288,17 +1277,15 @@ void FWidget::hide()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FWidget::focusFirstChild()
|
bool FWidget::focusFirstChild()
|
||||||
{
|
{
|
||||||
FObjectList children;
|
constFObjectIterator iter, last;
|
||||||
constFObjectIterator iter, end;
|
|
||||||
|
|
||||||
if ( ! this->hasChildren() )
|
if ( ! hasChildren() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
children = this->getChildren();
|
iter = FObject::begin();
|
||||||
iter = children.begin();
|
last = FObject::end();
|
||||||
end = children.end();
|
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( ! (*iter)->isWidget() )
|
if ( ! (*iter)->isWidget() )
|
||||||
{
|
{
|
||||||
|
@ -1334,15 +1321,13 @@ bool FWidget::focusFirstChild()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FWidget::focusLastChild()
|
bool FWidget::focusLastChild()
|
||||||
{
|
{
|
||||||
FObjectList children;
|
constFObjectIterator iter, first;
|
||||||
constFObjectIterator iter, begin;
|
|
||||||
|
|
||||||
if ( ! this->hasChildren() )
|
if ( ! hasChildren() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
children = this->getChildren();
|
iter = FObject::end();
|
||||||
iter = children.end();
|
first = FObject::begin();
|
||||||
begin = children.begin();
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -1368,7 +1353,7 @@ bool FWidget::focusLastChild()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( iter != begin );
|
while ( iter != first );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1823,16 +1808,13 @@ void FWidget::adjustSize()
|
||||||
getTermY() - 2 + getHeight() - padding.bottom
|
getTermY() - 2 + getHeight() - padding.bottom
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( this->hasChildren() )
|
if ( hasChildren() )
|
||||||
{
|
{
|
||||||
FObjectList children;
|
constFObjectIterator iter, last;
|
||||||
constFObjectIterator iter, end;
|
iter = FObject::begin();
|
||||||
|
last = FObject::end();
|
||||||
|
|
||||||
children = this->getChildren();
|
while ( iter != last )
|
||||||
iter = children.begin();
|
|
||||||
end = children.end();
|
|
||||||
|
|
||||||
while ( iter != end )
|
|
||||||
{
|
{
|
||||||
if ( (*iter)->isWidget() )
|
if ( (*iter)->isWidget() )
|
||||||
{
|
{
|
||||||
|
@ -1857,11 +1839,11 @@ void FWidget::adjustSizeGlobal()
|
||||||
|
|
||||||
if ( window_list && ! window_list->empty() )
|
if ( window_list && ! window_list->empty() )
|
||||||
{
|
{
|
||||||
widgetList::const_iterator iter, end;
|
widgetList::const_iterator iter, last;
|
||||||
iter = window_list->begin();
|
iter = window_list->begin();
|
||||||
end = window_list->end();
|
last = window_list->end();
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
(*iter)->adjustSize();
|
(*iter)->adjustSize();
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -1881,14 +1863,11 @@ bool FWidget::focusNextChild()
|
||||||
|
|
||||||
if ( parent->hasChildren() && parent->numOfFocusableChildren() > 1 )
|
if ( parent->hasChildren() && parent->numOfFocusableChildren() > 1 )
|
||||||
{
|
{
|
||||||
FObjectList children;
|
FObjectIterator iter, last;
|
||||||
FObjectIterator iter, end;
|
iter = parent->begin();
|
||||||
|
last = parent->end();
|
||||||
|
|
||||||
children = parent->getChildren();
|
while ( iter != last )
|
||||||
iter = children.begin();
|
|
||||||
end = children.end();
|
|
||||||
|
|
||||||
while ( iter != end )
|
|
||||||
{
|
{
|
||||||
if ( ! (*iter)->isWidget() )
|
if ( ! (*iter)->isWidget() )
|
||||||
{
|
{
|
||||||
|
@ -1908,8 +1887,8 @@ bool FWidget::focusNextChild()
|
||||||
{
|
{
|
||||||
++next_element;
|
++next_element;
|
||||||
|
|
||||||
if ( next_element == children.end() )
|
if ( next_element == parent->end() )
|
||||||
next_element = children.begin();
|
next_element = parent->begin();
|
||||||
|
|
||||||
if ( ! (*next_element)->isWidget() )
|
if ( ! (*next_element)->isWidget() )
|
||||||
continue;
|
continue;
|
||||||
|
@ -1948,7 +1927,7 @@ bool FWidget::focusNextChild()
|
||||||
|
|
||||||
if ( in.isAccepted() )
|
if ( in.isAccepted() )
|
||||||
{
|
{
|
||||||
this->redraw();
|
redraw();
|
||||||
next->redraw();
|
next->redraw();
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
flush_out();
|
flush_out();
|
||||||
|
@ -1975,12 +1954,9 @@ bool FWidget::focusPrevChild()
|
||||||
|
|
||||||
if ( parent->hasChildren() && parent->numOfFocusableChildren() > 1 )
|
if ( parent->hasChildren() && parent->numOfFocusableChildren() > 1 )
|
||||||
{
|
{
|
||||||
FObjectList children;
|
FObjectIterator iter, first;
|
||||||
FObjectIterator iter, begin;
|
iter = parent->end();
|
||||||
|
first = parent->begin();
|
||||||
children = parent->getChildren();
|
|
||||||
iter = children.end();
|
|
||||||
begin = children.begin();
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -2005,8 +1981,8 @@ bool FWidget::focusPrevChild()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( prev_element == children.begin() )
|
if ( prev_element == parent->begin() )
|
||||||
prev_element = children.end();
|
prev_element = parent->end();
|
||||||
|
|
||||||
--prev_element;
|
--prev_element;
|
||||||
prev = static_cast<FWidget*>(*prev_element);
|
prev = static_cast<FWidget*>(*prev_element);
|
||||||
|
@ -2043,7 +2019,7 @@ bool FWidget::focusPrevChild()
|
||||||
|
|
||||||
if ( in.isAccepted() )
|
if ( in.isAccepted() )
|
||||||
{
|
{
|
||||||
this->redraw();
|
redraw();
|
||||||
prev->redraw();
|
prev->redraw();
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
flush_out();
|
flush_out();
|
||||||
|
@ -2053,7 +2029,7 @@ bool FWidget::focusPrevChild()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( iter != begin );
|
while ( iter != first );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,9 +80,11 @@ Treeview::Treeview (FWidget* parent)
|
||||||
listView->insert (line);
|
listView->insert (line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FObjectIterator iter_africa = listView->beginOfList();
|
||||||
std::string egypt[3] = { "Egypt", "94,666,000", "87" };
|
std::string egypt[3] = { "Egypt", "94,666,000", "87" };
|
||||||
std::vector<FString> egypt_line (&egypt[0], &egypt[0] + 3);
|
std::vector<FString> egypt_line (&egypt[0], &egypt[0] + 3);
|
||||||
FObjectIterator iter_africa = listView->insert (egypt_line);
|
//FObjectIterator iter_africa = listView->insert (egypt_line);
|
||||||
listView->insert (egypt_line, iter_africa);
|
listView->insert (egypt_line, iter_africa);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ ProgressDialog::ProgressDialog (FWidget* parent)
|
||||||
, more()
|
, more()
|
||||||
, quit()
|
, quit()
|
||||||
{
|
{
|
||||||
setGeometry (int((this->getParentWidget()->getWidth() - 40) / 2), 7, 40, 10);
|
setGeometry (int((getParentWidget()->getWidth() - 40) / 2), 7, 40, 10);
|
||||||
setText("Progress bar");
|
setText("Progress bar");
|
||||||
//setModal();
|
//setModal();
|
||||||
|
|
||||||
|
@ -823,9 +823,9 @@ void MyDialog::cb_updateNumber (FWidget* widget, data_ptr data)
|
||||||
FListBox* list = static_cast<FListBox*>(widget);
|
FListBox* list = static_cast<FListBox*>(widget);
|
||||||
FLabel* num = static_cast<FLabel*>(data);
|
FLabel* num = static_cast<FLabel*>(data);
|
||||||
int select_num = 0;
|
int select_num = 0;
|
||||||
uInt end = list->getCount();
|
uInt count = list->getCount();
|
||||||
|
|
||||||
for (uInt n = 1; n <= end; n++)
|
for (uInt n = 1; n <= count; n++)
|
||||||
if ( list->isSelected(int(n)) )
|
if ( list->isSelected(int(n)) )
|
||||||
select_num++;
|
select_num++;
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,7 @@ void Window::activateWindow (FDialog* win)
|
||||||
void Window::adjustSize()
|
void Window::adjustSize()
|
||||||
{
|
{
|
||||||
int w, h, X, Y, dx, dy;
|
int w, h, X, Y, dx, dy;
|
||||||
std::vector<win_data*>::const_iterator iter, begin;
|
std::vector<win_data*>::const_iterator iter, first;
|
||||||
w = getRootWidget()->getWidth();
|
w = getRootWidget()->getWidth();
|
||||||
h = getRootWidget()->getHeight();
|
h = getRootWidget()->getHeight();
|
||||||
X = int(1 + (w - 40) / 2);
|
X = int(1 + (w - 40) / 2);
|
||||||
|
@ -368,14 +368,14 @@ void Window::adjustSize()
|
||||||
Y = 2;
|
Y = 2;
|
||||||
|
|
||||||
setPos (X, Y);
|
setPos (X, Y);
|
||||||
iter = begin = windows.begin();
|
iter = first = windows.begin();
|
||||||
|
|
||||||
while ( iter != windows.end() )
|
while ( iter != windows.end() )
|
||||||
{
|
{
|
||||||
if ( (*iter)->is_open )
|
if ( (*iter)->is_open )
|
||||||
{
|
{
|
||||||
int x, y, n;
|
int x, y, n;
|
||||||
n = int(std::distance(begin, iter));
|
n = int(std::distance(first, iter));
|
||||||
x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
|
x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
|
||||||
y = dy + 11 + int(n / 3) * 3;
|
y = dy + 11 + int(n / 3) * 3;
|
||||||
(*iter)->dgl->setPos (x, y);
|
(*iter)->dgl->setPos (x, y);
|
||||||
|
@ -408,8 +408,8 @@ void Window::onClose (FCloseEvent* ev)
|
||||||
void Window::cb_createWindows (FWidget*, data_ptr)
|
void Window::cb_createWindows (FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
int w, h, dx, dy;
|
int w, h, dx, dy;
|
||||||
std::vector<win_data*>::const_iterator iter, begin;
|
std::vector<win_data*>::const_iterator iter, first;
|
||||||
iter = begin = windows.begin();
|
iter = first = windows.begin();
|
||||||
w = getRootWidget()->getWidth();
|
w = getRootWidget()->getWidth();
|
||||||
h = getRootWidget()->getHeight();
|
h = getRootWidget()->getHeight();
|
||||||
dx = (w > 80) ? (w - 80) / 2 : 0;
|
dx = (w > 80) ? (w - 80) / 2 : 0;
|
||||||
|
@ -425,7 +425,7 @@ void Window::cb_createWindows (FWidget*, data_ptr)
|
||||||
win_dat->dgl = win;
|
win_dat->dgl = win;
|
||||||
win_dat->is_open = true;
|
win_dat->is_open = true;
|
||||||
win->setText(*(win_dat)->title);
|
win->setText(*(win_dat)->title);
|
||||||
n = int(std::distance(begin, iter));
|
n = int(std::distance(first, iter));
|
||||||
x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
|
x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
|
||||||
y = dy + 11 + int(n / 3) * 3;
|
y = dy + 11 + int(n / 3) * 3;
|
||||||
win->setGeometry (x, y, 20, 8);
|
win->setGeometry (x, y, 20, 8);
|
||||||
|
@ -453,9 +453,9 @@ void Window::cb_closeWindows (FWidget*, data_ptr)
|
||||||
if ( ! dialog_list || dialog_list->empty() )
|
if ( ! dialog_list || dialog_list->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
widgetList::const_iterator iter, begin;
|
widgetList::const_iterator iter, first;
|
||||||
iter = dialog_list->end();
|
iter = dialog_list->end();
|
||||||
begin = dialog_list->begin();
|
first = dialog_list->begin();
|
||||||
activateWindow(this);
|
activateWindow(this);
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -465,7 +465,7 @@ void Window::cb_closeWindows (FWidget*, data_ptr)
|
||||||
if ( (*iter) != this )
|
if ( (*iter) != this )
|
||||||
(*iter)->close();
|
(*iter)->close();
|
||||||
}
|
}
|
||||||
while ( iter != begin );
|
while ( iter != first );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue