本文整理汇总了C++中Fl_Scroll::child方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Scroll::child方法的具体用法?C++ Fl_Scroll::child怎么用?C++ Fl_Scroll::child使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Scroll
的用法示例。
在下文中一共展示了Fl_Scroll::child方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleDrag
void gResizerBar::HandleDrag(int diff) {
Fl_Scroll *grp = (Fl_Scroll*)parent();
int top = y();
int bot = y()+h();
// First pass: find widget directly above us with common edge
// Possibly clamp 'diff' if widget would get too small..
for (int t=0; t<grp->children(); t++) {
Fl_Widget *w = grp->child(t);
if ((w->y()+w->h()) == top) { // found widget directly above?
if ((w->h()+diff) < min_h) diff = w->h() - min_h; // clamp
w->resize(w->x(), w->y(), w->w(), w->h()+diff); // change height
break; // done with first pass
}
}
// Second pass: find widgets below us, move based on clamped diff
for (int t=0; t<grp->children(); t++) {
Fl_Widget *w = grp->child(t);
if (w->y() >= bot) // found widget below us?
w->resize(w->x(), w->y()+diff, w->w(), w->h()); // change position
}
// Change our position last
resize(x(),y()+diff,w(),h());
grp->init_sizes();
grp->redraw();
}
示例2: handleDrag
void geResizerBar::handleDrag(int diff)
{
Fl_Scroll* grp = static_cast<Fl_Scroll*>(parent());
int top;
int bot;
if (m_type == VERTICAL) {
top = y();
bot = y()+h();
}
else {
top = x();
bot = x()+w();
}
// First pass: find widget directly above us with common edge
// Possibly clamp 'diff' if widget would get too small..
for (int t=0; t<grp->children(); t++) {
Fl_Widget* wd = grp->child(t);
if (m_type == VERTICAL) {
if ((wd->y()+wd->h()) == top) { // found widget directly above?
if ((wd->h()+diff) < m_minSize)
diff = wd->h() - m_minSize; // clamp
wd->resize(wd->x(), wd->y(), wd->w(), wd->h()+diff); // change height
break; // done with first pass
}
}
else {
if ((wd->x()+wd->w()) == top) { // found widget directly above?
if ((wd->w()+diff) < m_minSize)
diff = wd->w() - m_minSize; // clamp
wd->resize(wd->x(), wd->y(), wd->w()+diff, wd->h()); // change height
break; // done with first pass
}
}
}
// Second pass: find widgets below us, move based on clamped diff
for (int t=0; t<grp->children(); t++) {
Fl_Widget* wd = grp->child(t);
if (m_type == VERTICAL) {
if (wd->y() >= bot) // found widget below us?
wd->resize(wd->x(), wd->y()+diff, wd->w(), wd->h()); // change position
}
else {
if (wd->x() >= bot)
wd->resize(wd->x()+diff, wd->y(), wd->w(), wd->h());
}
}
// Change our position last
if (m_type == VERTICAL)
resize(x(), y()+diff, w(), h());
else
resize(x()+diff, y(), w(), h());
grp->init_sizes();
grp->redraw();
}