Example #1
0
static void 
Resize(Widget w)
{
    XmIconBoxWidget ibw = (XmIconBoxWidget) w;

    CalcCellSizes(w, NULL, TRUE, FALSE, 
		  &(XmIconBox_cell_width(ibw)), &(XmIconBox_cell_height(ibw)));
    PlaceChildren(w, NULL);
}
Example #2
0
void CSystemControlModel::InitializeChildren( std::shared_ptr<IBaseExprModel> initChild )
{
	CRect childRect = CRect( 0, 0, 0, rect.GetHeight( ) );
	if( initChild ) {
		children.push_back( initChild );
		children[0]->SetParent( shared_from_this() );
    children[0]->UpdateDepth();
	} else {
		children.push_back( std::make_shared<CExprControlModel>( childRect, std::weak_ptr<IBaseExprModel>( shared_from_this() ) ) );
    children[0]->InitializeChildren();
	}

  children.push_back( std::make_shared<CExprControlModel>( childRect, std::weak_ptr<IBaseExprModel>( shared_from_this() ) ) );
  children[1]->InitializeChildren();

	Resize();
	PlaceChildren();
}
Example #3
0
void CFracControlModel::InitializeChildren( std::shared_ptr<IBaseExprModel> initChild /*= 0 */ )
{
	CRect childRect = CRect( 0, 0, 0, rect.GetHeight( ) );
	if( initChild ) {
		firstChild = initChild;
		firstChild->SetParent( shared_from_this() );
		firstChild->UpdateDepth();
	} else {
		firstChild = std::make_shared<CExprControlModel>( childRect, std::weak_ptr<IBaseExprModel>( shared_from_this() ) );
		firstChild->InitializeChildren();
	}

	secondChild = std::make_shared<CExprControlModel>( childRect, std::weak_ptr<IBaseExprModel>( shared_from_this() ) );
	secondChild->InitializeChildren();

	Resize();
	PlaceChildren();
}
Example #4
0
/*ARGSUSED*/
static Boolean 
SetValues(Widget current, Widget request, Widget set,
	  ArgList args, Cardinal * num_args)
{
    XmIconBoxWidget old_ibw = (XmIconBoxWidget) current;
    XmIconBoxWidget set_ibw = (XmIconBoxWidget) set;

    if ((XmIconBox_min_v_cells(old_ibw) != XmIconBox_min_v_cells(set_ibw))           ||
	(XmIconBox_min_h_cells(old_ibw) != XmIconBox_min_h_cells(set_ibw))           ||
	(XmIconBox_min_cell_width(old_ibw) != XmIconBox_min_cell_width(set_ibw))     ||
	(XmIconBox_min_cell_height(old_ibw) != XmIconBox_min_cell_height(set_ibw))   ||
	(XmIconBox_v_margin(old_ibw) != XmIconBox_v_margin(set_ibw))                 ||
	(XmIconBox_h_margin(old_ibw) != XmIconBox_h_margin(set_ibw)) ) 
    {
	CalcCellSizes(set, NULL, FALSE, FALSE, 
		      &(XmIconBox_cell_width(set_ibw)), &(XmIconBox_cell_height(set_ibw)));
	PlaceChildren(set, NULL);
    }

    return(FALSE);
}
Example #5
0
/*ARGSUSED*/
static XtGeometryResult
GeometryManager(Widget w, XtWidgetGeometry * request, 
		XtWidgetGeometry * result)
{
    Dimension cwidth, cheight;
    XmIconBoxWidget ibw = (XmIconBoxWidget) XtParent(w);
    IconInfo * info = GetIconInfo(w);
    Boolean w_req = (request->request_mode & CWWidth);
    Boolean h_req = (request->request_mode & CWHeight);
    Boolean x_req = (request->request_mode & CWX);
    Boolean y_req = (request->request_mode & CWY);

    if (!(request->request_mode & (CWWidth | CWHeight | CWX | CWY)))
	return(XtGeometryNo);
    
    result->request_mode = 0;

    if (w_req || h_req) {
	CalcCellSizes((Widget) ibw, w, FALSE, TRUE, &cwidth, &cheight);

	if(w_req)
	    ASSIGN_MAX(cwidth, request->width);
	else
	    ASSIGN_MAX(cwidth, w->core.width);
	
	if(h_req)
	    ASSIGN_MAX(cheight, request->height);
	else
	    ASSIGN_MAX(cheight, w->core.height);

	/*
	 * Do not allow an x, y width and height request at the same time.
	 * since it is unclear what this would mean.  I want to place the
	 * widget in the cell the center of it is over.  With a multiple
	 * request like this is it tough to find out which cell to use
	 * since there are two reasonable values for height and width.
	 */

	result->x = w->core.x;
	result->y = w->core.y;
	result->width  = cwidth;
	result->height = cheight;
	result->request_mode |= CWX | CWY | CWHeight | CWWidth;
    }
    else if ( x_req || y_req ) {
	Position x, y;
	short cell_x, cell_y;

	if (x_req) 
	    x = request->x;
	else
	    x = w->core.x;

	if (y_req)
	    y = request->y;
	else
	    y = w->core.y;

	FindNearestCellLocation((Widget) ibw, &x, &y);

	GetCellFromXY((Widget) ibw, x, y, &cell_x, &cell_y);
	if (XmIconBoxIsCellEmpty((Widget) ibw, cell_x, cell_y, w)) {
	    result->x = x;
	    result->y = y;
	    result->request_mode |= CWX | CWY;
	}
	else			/* Cell is full, return NO. */
	    return(XtGeometryNo);
    }

    if (((request->x == result->x) || !x_req) &&
	((request->y == result->y) || !y_req) &&
	((request->width == result->width) || !w_req) &&
	((request->height == result->height) || !h_req))
    {
	if (request->request_mode & 
	    (CWBorderWidth | CWStackMode | CWSibling)) 
	{
	    return(XtGeometryAlmost);
	}

	if (request->request_mode & XtCWQueryOnly) 
	    return(XtGeometryYes);

	if (w_req || h_req) {
	    if (w_req) 
		info->pref_width = w->core.width = request->width;

	    if (h_req)
		info->pref_height = w->core.height = request->height;
	}
	else {
	    /*
	     * NOTE: We are assuming here that the cell height/width
	     * did not change.  This is valid because this code is
	     * only executed if w_req and h_req are false.
	     */

	    GetCellFromXY((Widget) ibw, result->x, result->y, 
			  &(info->cell_x), &(info->cell_y));
	}
	    
	CalcCellSizes((Widget) ibw, NULL, FALSE, FALSE, 
		      &(XmIconBox_cell_width(ibw)), &(XmIconBox_cell_height(ibw)));

	PlaceChildren((Widget) ibw, w);
	return(XtGeometryYes);
    }

    info->pref_width = info->pref_height = 0; /* invalidate cache. */

    if (((request->x == result->x) || !x_req)         ||
	((request->y == result->y) || !y_req)         ||
	((request->width == result->width) || !w_req) ||
	((request->height == result->height) || !h_req))
    {
	return(XtGeometryAlmost);
    }
    else 
	return(XtGeometryNo);
}
Example #6
0
bool GuiContainer::AddControl(GuiControl* control) {
	mControls.push_back(control);
	PlaceChildren();
	return true;
}
Example #7
0
void GuiContainer::SetDimension(const Vector2D dimension) {
	GuiControl::SetDimension(dimension);
	PlaceChildren();
}
Example #8
0
void GuiContainer::SetPosition(const Vector2D position) {
	GuiControl::SetPosition(position);
	PlaceChildren();
}
Example #9
0
void GuiContainer::SetPosition(const float x, const float y) {
	GuiControl::SetPosition(x,y);
	PlaceChildren();
}