当前位置: 首页>>代码示例>>C++>>正文


C++ Fl_Scroll::children方法代码示例

本文整理汇总了C++中Fl_Scroll::children方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Scroll::children方法的具体用法?C++ Fl_Scroll::children怎么用?C++ Fl_Scroll::children使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fl_Scroll的用法示例。


在下文中一共展示了Fl_Scroll::children方法的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();
}
开发者ID:rzr,项目名称:giada,代码行数:31,代码来源:ge_mixed.cpp

示例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();
}
开发者ID:monocasual,项目名称:giada,代码行数:61,代码来源:resizerBar.cpp


注:本文中的Fl_Scroll::children方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。