Пример #1
0
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
0
/*
  Called everytime we click the refresh button. This will request all participants
  and update the UI.
 */ 
void SelectorGUI::update(){
  int x = 40;
  int y = 10;
  int dy = 20; 
  int i = 0;
  int len = 0;
  
  swindow->clear();
  swindow->redraw();
  swindow->begin();
  
  len = GetParticipants(pList);
  
  for(i; i < len; i ++){
    ssrcList[i] = (char*)pList[i].ssrc;
    Fl_Check_Button* b = new Fl_Check_Button(x, y, 300, 30, pList[i].name);
    b->callback(static_selectCB, (void*) pList[i].ssrc);
    b->type(102);
    y = y + dy;
  }
  swindow->end();
  swindow->redraw();
}
Пример #3
0
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();
}