Ejemplo n.º 1
0
BSize
BStatusBar::PreferredSize()
{
    float width, height;
    GetPreferredSize(&width, &height);

    return BLayoutUtils::ComposeSize(ExplicitPreferredSize(),
                                     BSize(width, height));
}
Ejemplo n.º 2
0
//: Called if the target was resized.
// Resizes this if it's broader than the target.
void CMDITitleView::TargetResized(float width, float height)
{
	float preferredWidth, preferredHeight;
	
	GetPreferredSize(&preferredWidth, &preferredHeight);

	CMDIClientView *client = dynamic_cast<CMDIClientView *>(Parent());
	client->ResizeViewTo(this, preferredWidth, preferredHeight);
}
Ejemplo n.º 3
0
BSize
BStatusBar::MaxSize()
{
    float width, height;
    GetPreferredSize(&width, &height);

    return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
                                     BSize(B_SIZE_UNLIMITED, height));
}
Ejemplo n.º 4
0
SMTPConfigView::SMTPConfigView(MailAddonSettings& settings,
	BMailAccountSettings& accountSettings)
	:
	BMailProtocolConfigView(B_MAIL_PROTOCOL_HAS_AUTH_METHODS
		| B_MAIL_PROTOCOL_HAS_USERNAME | B_MAIL_PROTOCOL_HAS_PASSWORD
		| B_MAIL_PROTOCOL_HAS_HOSTNAME
#ifdef USE_SSL
		| B_MAIL_PROTOCOL_HAS_FLAVORS
#endif
		)
{
#if defined(USE_SSL) || defined(B_COLLECTING_CATKEYS)
	static const char* kUnencryptedStr = B_TRANSLATE_MARK("Unencrypted");
	static const char* kSSLStr = B_TRANSLATE_MARK("SSL");
	static const char* kSTARTTLSStr = B_TRANSLATE_MARK("STARTTLS");
#endif

#ifdef USE_SSL
	AddFlavor(B_TRANSLATE_NOCOLLECT(kUnencryptedStr));
	AddFlavor(B_TRANSLATE(kSSLStr));
	AddFlavor(B_TRANSLATE(kSTARTTLSStr));
#endif

	AddAuthMethod(B_TRANSLATE("None"), false);
	AddAuthMethod(B_TRANSLATE("ESMTP"));
	AddAuthMethod(B_TRANSLATE("POP3 before SMTP"), false);

	BTextControl *control = (BTextControl *)(FindView("host"));
	control->SetLabel(B_TRANSLATE("SMTP server:"));

	// Reset the dividers after changing one
	float widestLabel = 0;
	for (int32 i = CountChildren(); i-- > 0;) {
		if (BTextControl *text = dynamic_cast<BTextControl *>(ChildAt(i)))
			widestLabel = MAX(widestLabel,text->StringWidth(text->Label()) + 5);
	}
	for (int32 i = CountChildren(); i-- > 0;) {
		if (BTextControl *text = dynamic_cast<BTextControl *>(ChildAt(i)))
			text->SetDivider(widestLabel);
	}

	BMenuField *field = (BMenuField *)(FindView("auth_method"));
	field->SetDivider(widestLabel);

	SetTo(settings);

	fFileView = new BMailFileConfigView(B_TRANSLATE("Destination:"), "path",
		false, BPrivate::default_mail_out_directory().Path());
	fFileView->SetTo(&settings.Settings(), NULL);
	AddChild(fFileView);
	float w, h;
	BMailProtocolConfigView::GetPreferredSize(&w, &h);
	fFileView->MoveBy(0, h - 10);
	GetPreferredSize(&w, &h);
	ResizeTo(w, h);
}
Ejemplo n.º 5
0
ButtonElement::ButtonElement(UIBox frame, TNodePtr node, const char *name, const char *label, t_button_mode mode)
			  : BButton(frame,name,label,NULL,B_FOLLOW_NONE,B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_NAVIGABLE) , UIElement(frame,node)
{
	buttonMode = mode;
	
	float width, height;
	GetPreferredSize(&width,&height);
	frame.SetRightBottom(BPoint(frame.LeftTop().x + width, frame.LeftTop().y + height));
	ResizeToPreferred();
}
Ejemplo n.º 6
0
/*! \brief Resizes the control to its preferred size.
*/
void
BOptionPopUp::ResizeToPreferred()
{
	float width, height;
	GetPreferredSize(&width, &height);
	ResizeTo(width, height);
	
	float newWidth = fMenuField->StringWidth(BControl::Label());
	fMenuField->SetDivider(newWidth + kLabelSpace);
}
Ejemplo n.º 7
0
void
TWindow::ResizeWindow(int32 hPixelCount, int32 vPixelCount)
{
	fHPixelCount = hPixelCount;
	fVPixelCount = vPixelCount;

	float width, height;
	GetPreferredSize(&width, &height);

	ResizeTo(width, height);
}
Ejemplo n.º 8
0
/*------------------------------------------------------------------------------*\
	( )
		-	
\*------------------------------------------------------------------------------*/
void BmCheckControl::_InitSize()
{
	ResizeToPreferred();
	float width, height;
	GetPreferredSize(&width, &height);
	// if there's no label, just use the space required for the checkbox
	if (Label() == NULL)
		ct_mpm = minimax(17, int(height), 17, int(height));
	else
		ct_mpm = minimax(int(width), int(height), 1E5, int(height));
}
BRadioButton::BRadioButton(BRect frame, const char* name, const char* label,
		BMessage* message, uint32 resizMask, uint32 flags)
	: BControl(frame, name, label, message, resizMask, flags | B_FRAME_EVENTS),
	  fOutlined(false)
{
	// Resize to minimum height if needed for BeOS compatibility
	float minHeight;
	GetPreferredSize(NULL, &minHeight);
	if (Bounds().Height() < minHeight)
		ResizeTo(Bounds().Width(), minHeight);
}
Ejemplo n.º 10
0
void
TWindow::RemoveCrossHair()
{
	fFatBits->RemoveCrossHair();

	//	crosshair info needs to be removed
	//	window resizes accordingly
	float width;
	float height;
	GetPreferredSize(&width, &height);
	ResizeTo(width, height);
}
Ejemplo n.º 11
0
void
ELayoutItem::ResizeToPreferred()
{
	float w = -1, h = -1;
	GetPreferredSize(&w, &h);
	if(w < 0) w = fFrame.Width();
	if(h < 0) h = fFrame.Height();
	if(w == fFrame.Width() && h == fFrame.Height()) return;

	ERect iFrame = fFrame;
	euint32 iMode = fResizingMode;

	if((iMode & E_FOLLOW_H_CENTER) && (iMode & E_FOLLOW_LEFT_RIGHT) != E_FOLLOW_LEFT_RIGHT)
	{
		float centerX = fFrame.Center().x;
		iFrame.left = centerX - w / 2.f;
		iFrame.right = centerX + w / 2.f;
	}
	else if((iMode & E_FOLLOW_LEFT_RIGHT) != E_FOLLOW_LEFT_RIGHT)
	{
		if(iMode & E_FOLLOW_RIGHT)
			iFrame.left = iFrame.right - w;
		else
			iFrame.right = iFrame.left + w;
	}

	if((iMode & E_FOLLOW_V_CENTER) && (iMode & E_FOLLOW_TOP_BOTTOM) != E_FOLLOW_TOP_BOTTOM)
	{
		float centerY = fFrame.Center().y;
		iFrame.top = centerY - h / 2.f;
		iFrame.bottom = centerY + h / 2.f;
	}
	else if((iMode & E_FOLLOW_TOP_BOTTOM) != E_FOLLOW_TOP_BOTTOM)
	{
		if(iMode & E_FOLLOW_BOTTOM)
			iFrame.top = iFrame.bottom - h;
		else
			iFrame.bottom = iFrame.top + h;
	}

	if(iFrame == fFrame) return;

	bool saveUpdating = fUpdating;
	ERect oldFrame = fFrame;

	fUpdating = true;
	MoveAndResizeTo(iFrame.LeftTop(), iFrame.Width(), iFrame.Height());
	fUpdating = saveUpdating;

	if(fUpdating || fContainer == NULL || fHidden || (oldFrame.IsValid() == false && fFrame.IsValid() == false)) return;
	for(ELayoutItem *item = this; item != NULL; item = item->NextSibling()) item->UpdateVisibleRegion();
	fContainer->Invalidate(oldFrame | fFrame);
}
Ejemplo n.º 12
0
void
PathBox::ResizeToPreferred(void)
{
	float w,h;
	GetPreferredSize(&w,&h);
	ResizeTo(w,h);
	fPathControl->ResizeToPreferred();
	fBrowseButton->ResizeToPreferred();
	fPathControl->ResizeTo(fBrowseButton->Frame().left - 10, fPathControl->Bounds().Height());
//	fBrowseButton->MoveTo(fPathControl->Frame().right + 10, 0);
//	fBrowseButton->MoveTo(Bounds().right - 10 - fBrowseButton, 0);
}
Ejemplo n.º 13
0
void
BStringView::ResizeToPreferred()
{
	float width, height;
	GetPreferredSize(&width, &height);

	// Resize the width only for B_ALIGN_LEFT (if its large enough already, that is)
	if (Bounds().Width() > width && Alignment() != B_ALIGN_LEFT)
		width = Bounds().Width();

	BView::ResizeTo(width, height);
}
Ejemplo n.º 14
0
void
TTimeView::ResizeToPreferred()
{
	float width, height;
	float oldWidth = Bounds().Width(), oldHeight = Bounds().Height();

	GetPreferredSize(&width, &height);
	if (height != oldHeight || width != oldWidth) {
		ResizeTo(width, height);
		MoveBy(oldWidth - width, 0);
		fNeedToUpdate = true;
	}
}
Ejemplo n.º 15
0
void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas)
{
    gfx::Size ps = GetPreferredSize();
    gfx::CanvasSkia scale_canvas(ps.width(), ps.height(), false);
    SkBitmap& bitmap_device = const_cast<SkBitmap&>(
                                  skia::GetTopDevice(scale_canvas)->accessBitmap(true));
    bitmap_device.eraseARGB(0, 0, 0, 0);

    int tab_height = renderer_bounds_.back().height();
    scale_canvas.FillRectInt(kDraggedTabBorderColor, 0,
                             tab_height - kDragFrameBorderSize,
                             ps.width(), ps.height() - tab_height);
    int image_x = kDragFrameBorderSize;
    int image_y = tab_height;
    int image_w = ps.width() - kTwiceDragFrameBorderSize;
    int image_h = contents_size_.height();
    scale_canvas.FillRectInt(SK_ColorBLACK, image_x, image_y, image_w, image_h);
    photobooth_->PaintScreenshotIntoCanvas(
        &scale_canvas,
        gfx::Rect(image_x, image_y, image_w, image_h));
    for(size_t i=0; i<renderers_.size(); ++i)
    {
        renderers_[i]->Paint(&scale_canvas);
    }

    SkIRect subset;
    subset.set(0, 0, ps.width(), ps.height());
    SkBitmap mipmap = scale_canvas.ExtractBitmap();
    mipmap.buildMipMap(true);

    SkShader* bitmap_shader =
        SkShader::CreateBitmapShader(mipmap, SkShader::kClamp_TileMode,
                                     SkShader::kClamp_TileMode);

    SkMatrix shader_scale;
    shader_scale.setScale(kScalingFactor, kScalingFactor);
    bitmap_shader->setLocalMatrix(shader_scale);

    SkPaint paint;
    paint.setShader(bitmap_shader);
    paint.setAntiAlias(true);
    bitmap_shader->unref();

    SkRect rc;
    rc.fLeft = 0;
    rc.fTop = 0;
    rc.fRight = SkIntToScalar(ps.width());
    rc.fBottom = SkIntToScalar(ps.height());
    canvas->AsCanvasSkia()->drawRect(rc, paint);
}
Ejemplo n.º 16
0
void
BBox::ResizeToPreferred()
{
	float width, height;
	GetPreferredSize(&width, &height);

	// make sure the box don't get smaller than it already is
	if (width < Bounds().Width())
		width = Bounds().Width();
	if (height < Bounds().Height())
		height = Bounds().Height();

	BView::ResizeTo(width, height);
}
Ejemplo n.º 17
0
void DraggedTabView::Layout()
{
    int max_width = GetPreferredSize().width();
    for(size_t i=0; i<renderers_.size(); ++i)
    {
        gfx::Rect bounds = renderer_bounds_[i];
        bounds.set_y(0);
        if(base::i18n::IsRTL())
        {
            bounds.set_x(max_width - bounds.x() - bounds.width());
        }
        renderers_[i]->SetBoundsRect(bounds);
    }
}
Ejemplo n.º 18
0
void
BStatusBar::AttachedToWindow()
{
    // resize so that the height fits
    float width, height;
    GetPreferredSize(&width, &height);
    ResizeTo(Bounds().Width(), height);

    SetViewColor(B_TRANSPARENT_COLOR);

    AdoptParentColors();

    fTextDivider = Bounds().Width();

    if ((fInternalFlags & kCustomBarColor) == 0)
        fBarColor = ui_color(B_STATUS_BAR_COLOR);
}
HRESULT ui::UIRadioButtonGroup::CreateDeviceDependentResources(graphics::D3DInteropHelper *pD3DInteropHelper,
                                                               ID2D1RenderTarget *pRenderTarget) {
  CHK_WARN_HRESULT(UIContainer::CreateDeviceDependentResources(pD3DInteropHelper, pRenderTarget));
  FLOAT y = 0.0f;
  for (size_t i = 0; i < GetNumberOfElements(); ++i) {
    auto radioButton = std::dynamic_pointer_cast<UIRadioButton>(GetElement(i));
    UISize size = radioButton->GetPreferredSize();
#ifdef DEBUG_UIRADIOBUTTONGROUP
    LOG(SEVERITY_LEVEL_DEBUG) << L"preferred size = " << size;
#endif
    radioButton->SetBounds(0.0f, y, GetWidth(), size.height);
    y += radioButton->GetHeight() + MARGIN_BUTTONS;
  }
  ui::UIRectangle bounds = GetBounds();
  if (bounds.height < y) {
    bounds.height = y;
    SetBounds(bounds);
  }
  return S_OK;
}
Ejemplo n.º 20
0
void
BStatusBar::SetBarHeight(float barHeight)
{
    float oldHeight = BarHeight();

    fCustomBarHeight = true;
    fBarHeight = barHeight;

    if (barHeight == oldHeight)
        return;

    // resize so that the height fits
    if ((Flags() & B_SUPPORTS_LAYOUT) != 0)
        InvalidateLayout();
    else {
        float width, height;
        GetPreferredSize(&width, &height);
        ResizeTo(Bounds().Width(), height);
    }
}
Ejemplo n.º 21
0
/*------------------------------------------------------------------------------*\
	( )
		-	
\*------------------------------------------------------------------------------*/
void BmTextControl::InitSize( const char* label, int32 fixedTextLen, 
										int32 minTextLen, BmMenuControllerBase* popup) {
	ResizeToPreferred();
	BRect b = Bounds();
	float divPos = 0;
	if (label)
		divPos = StringWidth(label) + (mLabelIsMenu ? 27 : 3);
	inherited::SetDivider( divPos);
	BFont font;
	mTextView->GetFont( &font);
	if (fixedTextLen) {
		mTextView->SetMaxBytes( fixedTextLen);
		float width = divPos + font.StringWidth("W")*float(fixedTextLen);
		ct_mpm = minimax( int(width), int(b.Height()+4), int(width), 
								int(b.Height()+4));
	} else {
		if (minTextLen)
			ct_mpm = minimax( int(divPos + font.StringWidth("W")*float(minTextLen)), 
									int(b.Height()+4), 100000, int(b.Height()+4));
		else
			ct_mpm = minimax( int(divPos + font.StringWidth("W")*10), 
									int(b.Height()+4), 100000, int(b.Height()+4));
	}
	if (mLabelIsMenu) {
		float width, height;
		GetPreferredSize( &width, &height);
//		if (!popup)
//			popup = new BmMenuControllerBase( label, true, false);
		if (BeamOnDano)
			mMenuField 
				= new BMenuField( BRect( 2,2,Divider(),height), NULL, label,
										popup, true, B_FOLLOW_NONE, B_WILL_DRAW);
		else
			mMenuField 
				= new BMenuField( BRect( 2,0,Divider(),height), NULL, label,
										popup, true, B_FOLLOW_NONE, B_WILL_DRAW);
		mMenuField->SetDivider( 0);
		AddChild( mMenuField);
	}
	SetModificationMessage( new BMessage(BM_TEXTFIELD_MODIFIED));
}
Ejemplo n.º 22
0
void DraggedTabView::MoveTo(const gfx::Point& screen_point)
{
    int x;
    if(base::i18n::IsRTL())
    {
        // On RTL locales, a dragged tab (when it is not attached to a tab strip)
        // is rendered using a right-to-left orientation so we should calculate the
        // window position differently.
        gfx::Size ps = GetPreferredSize();
        x = screen_point.x() + ScaleValue(mouse_tab_offset_.x() - ps.width());
    }
    else
    {
        x = screen_point.x() - ScaleValue(mouse_tab_offset_.x());
    }
    int y = screen_point.y() - ScaleValue(mouse_tab_offset_.y());

    // TODO(beng): make this cross-platform
    int show_flags = container_->IsVisible() ? SWP_NOZORDER : SWP_SHOWWINDOW;
    SetWindowPos(container_->GetNativeView(), HWND_TOP, x, y, 0, 0,
                 SWP_NOSIZE | SWP_NOACTIVATE | show_flags);
}
Ejemplo n.º 23
0
TBRect TBWindow::GetResizeToFitContentRect(RESIZE_FIT fit)
{
	PreferredSize ps = GetPreferredSize();
	int new_w = ps.pref_w;
	int new_h = ps.pref_h;
	if (fit == RESIZE_FIT_MINIMAL)
	{
		new_w = ps.min_w;
		new_h = ps.min_h;
	}
	else if (fit == RESIZE_FIT_CURRENT_OR_NEEDED)
	{
		new_w = CLAMP(GetRect().w, ps.min_w, ps.max_w);
		new_h = CLAMP(GetRect().h, ps.min_h, ps.max_h);
	}
	if (GetParent())
	{
		new_w = MIN(new_w, GetParent()->GetRect().w);
		new_h = MIN(new_h, GetParent()->GetRect().h);
	}
	return TBRect(GetRect().x, GetRect().y, new_w, new_h);
}
Ejemplo n.º 24
0
void
BStatusBar::AttachedToWindow()
{
	// resize so that the height fits
	float width, height;
	GetPreferredSize(&width, &height);
	ResizeTo(Bounds().Width(), height);

	SetViewColor(B_TRANSPARENT_COLOR);
	rgb_color lowColor = B_TRANSPARENT_COLOR;

	BView* parent = Parent();
	if (parent != NULL)
		lowColor = parent->ViewColor();

	if (lowColor == B_TRANSPARENT_COLOR)
		lowColor = ui_color(B_PANEL_BACKGROUND_COLOR);

	SetLowColor(lowColor);

	fTextDivider = Bounds().Width();
}
Ejemplo n.º 25
0
void
WonderBrushView::AttachedToWindow()
{
	// Hack for DataTranslations which doesn't resize visible area to requested by view
	// which makes some parts of bigger than usual translationviews out of visible area
	// so if it was loaded to DataTranslations resize window if needed
	BWindow *window = Window();
	if (!strcmp(window->Name(), "DataTranslations")) {
		BView *view = Parent();
		if (view) {
			BRect frame = view->Frame();
			float x, y;
			GetPreferredSize(&x, &y);
			if (frame.Width() < x || (frame.Height() - 48) < y) {
				x -= frame.Width();
				y -= frame.Height() - 48;
				if (x < 0) x = 0;
				if (y < 0) y = 0;

				// DataTranslations has main view called "Background"
				// change it's resizing mode so it will always resize with window
				// also make sure view will be redrawed after resize
				view = window->FindView("Background");
				if (view) {
					view->SetResizingMode(B_FOLLOW_ALL);
					view->SetFlags(B_FULL_UPDATE_ON_RESIZE);
				}

				// The same with "Info..." button, except redrawing, which isn't needed
				view = window->FindView("Info" B_UTF8_ELLIPSIS);
				if (view)
					view->SetResizingMode(B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);

				window->ResizeBy( x, y);
			}
		}
	}
}
Ejemplo n.º 26
0
TSliderComponent::TSliderComponent(const char *AComponentName, const char *AClassName, BRect AFrame, TComponent *AFatherComponent):
BSlider(AFrame,AComponentName,AComponentName,NULL,0,100),TComponentKindaView(AComponentName,AClassName,this)
{
	float largeur,hauteur;

	FParent = AFatherComponent;
	FCodeGenerator = new TSliderCodeGenerator(this,true);
	FPropertyList->AddProperty(PROP_NAME,AComponentName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_CLASSNAME,AClassName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_LABEL,AComponentName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);

	FPropertyList->AddProperty(PROP_MIN,"0",PROP_TYPE_FLOAT,false,true,"",PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_MAX,"100",PROP_TYPE_FLOAT,false,true,"",PROP_GENERAL_GROUP);

	FPropertyList->AddProperty(PROP_THUMB,"B_BLOCK_THUMB",PROP_TYPE_FLOAT,true,false,
								"B_BLOCK_THUMB;B_TRIANGLE_THUMB",
								PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_MESSAGE,"NULL",PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);

	FPropertyList->AddProperty(PROP_RESIZING_MODE,"B_FOLLOW_LEFT | B_FOLLOW_TOP",PROP_TYPE_FLOAT,true,false,
								"B_FOLLOW_LEFT;B_FOLLOW_RIGHT;B_FOLLOW_LEFT_RIGHT;B_FOLLOW_H_CENTER;B_FOLLOW_TOP;B_FOLLOW_BOTTOM;B_FOLLOW_TOP_BOTTOM;B_FOLLOW_V_CENTER;B_FOLLOW_ALL_SIDES;B_FOLLOW_NONE",
								PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_FLAGS,"B_NAVIGABLE | B_WILL_DRAW",PROP_TYPE_FLOAT,true,false,
								"B_WILL_DRAW;B_PULSE_NEEDED;B_FRAME_EVENTS;B_FULL_UPDATE_ON_RESIZE;B_NAVIGABLE;B_NAVIGABLE_JUMP;B_SUBPIXEL_PRECISE",
								PROP_POSITION_GROUP);

	GetPreferredSize(&largeur,&hauteur);
	ResizeTo(largeur,hauteur);
	AFrame = Frame();	
	FPropertyList->AddProperty(PROP_TOP,FloatToStr(AFrame.top),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_LEFT,FloatToStr(AFrame.left),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_RIGHT,FloatToStr(AFrame.right),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_BOTTOM,FloatToStr(AFrame.bottom),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);

	FHandler = this; // on fait pointer le FHandler interne du TCOmponent dont on a besoin dans TComponentItem.
	FElement = this;
//	Show(); 
}
TTextControlComponent::TTextControlComponent(const char *AComponentName,const char *AClassName, BRect AFrame, TComponent *AFatherComponent):
BTextControl(AFrame,AComponentName,NULL,"Some Text",NULL,B_FOLLOW_LEFT | B_FOLLOW_TOP,B_FRAME_EVENTS | B_WILL_DRAW | B_NAVIGABLE),TComponentKindaView(AComponentName,AClassName,this)
{
	float largeur,hauteur;
	FHandler = this;
	FParent = AFatherComponent;
	FCodeGenerator = new TTextControlCodeGenerator(this,true);
	FPropertyList->AddProperty(PROP_NAME,AComponentName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_CLASSNAME,AClassName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	if (Label()==NULL) 
	{
		FPropertyList->AddProperty(PROP_LABEL,"",PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	}
	else
		FPropertyList->AddProperty(PROP_LABEL,Label(),PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_MESSAGE,"NULL",PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);

	FPropertyList->AddProperty(PROP_RESIZING_MODE,"B_FOLLOW_LEFT | B_FOLLOW_TOP",PROP_TYPE_FLOAT,true,false,
								"B_FOLLOW_LEFT;B_FOLLOW_RIGHT;B_FOLLOW_LEFT_RIGHT;B_FOLLOW_H_CENTER;B_FOLLOW_TOP;B_FOLLOW_BOTTOM;B_FOLLOW_TOP_BOTTOM;B_FOLLOW_V_CENTER;B_FOLLOW_ALL_SIDES;B_FOLLOW_NONE",
								PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_FLAGS,"B_NAVIGABLE | B_WILL_DRAW",PROP_TYPE_FLOAT,true,false,
								"B_WILL_DRAW;B_PULSE_NEEDED;B_FRAME_EVENTS;B_FULL_UPDATE_ON_RESIZE;B_NAVIGABLE;B_NAVIGABLE_JUMP;B_SUBPIXEL_PRECISE",
								PROP_POSITION_GROUP);

	FPropertyList->AddProperty(PROP_TEXT,Text(),PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);

	GetPreferredSize(&largeur,&hauteur);
	ResizeTo(largeur,hauteur);

	AFrame = Frame();	
	FPropertyList->AddProperty(PROP_TOP,FloatToStr(AFrame.top),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_LEFT,FloatToStr(AFrame.left),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_RIGHT,FloatToStr(AFrame.right),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_BOTTOM,FloatToStr(AFrame.bottom),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);

}
Ejemplo n.º 28
0
void wxToolWindow::OnMotion( wxMouseEvent& event )
{
    if ( !mResizeStarted )
    {
        for( size_t i = 0; i != mButtons.Count(); ++i )
            mButtons[i]->OnMotion( wxPoint( event.m_x, event.m_y ) );

        SetHintCursor( HitTestWindow( event ) );
        return;
    }

    wxPoint pos;
    GetScrMousePos( event, pos );

    if ( mCursorType == HITS_WND_TITLE )
    {
        int w,h;
        GetSize( &w, &h );

        SetSize( mInitialRect.x + pos.x - mDragOrigin.x,
                 mInitialRect.y + pos.y - mDragOrigin.y,
                 w,h, 0 );
    }

    else
    {
        wxPoint delta( pos.x - mDragOrigin.x, pos.y - mDragOrigin.y );

        wxRect newRect;

        wxSize minDim = GetMinimalWndDim();

        CalcResizedRect( newRect, delta, minDim );

        wxSize borderDim( ( mWndHorizGap + mClntHorizGap )*2,
                          ( mWndVertGap  + mClntVertGap  )*2 + mTitleHeight );

        wxSize preferred = GetPreferredSize( wxSize( newRect.width  - borderDim.x,
                                             newRect.height - borderDim.y ) );

        preferred.x += borderDim.x;
        preferred.y += borderDim.y;

        //CalcResizedRect( newRect, delta, preferred );

        wxRect finalRect = newRect;

        AdjustRectPos( newRect, preferred, finalRect );

        if ( mRealTimeUpdatesOn )
        {
            SetSize( finalRect.x, finalRect.y,
                     finalRect.width, finalRect.height, 0 );
        }
        else
        {
            DrawHintRect( mPrevHintRect );
            DrawHintRect( finalRect );

            ::wxLogTrace(wxT("wxToolWindow"),wxT("%d,%d / %d,%d\n"), finalRect.x, finalRect.y, finalRect.width, finalRect.height);
        }

        mPrevHintRect = finalRect;
    }
}
Ejemplo n.º 29
0
 //-----------------------------------------------------------
 //-----------------------------------------------------------
 Core::Vector2 SpriteComponent::GetSize() const
 {
     Core::Vector2 preferredSize = GetPreferredSize();
     return m_sizePolicyDelegate(m_originalSize, preferredSize);
 }
Ejemplo n.º 30
0
gfx::Size DraggedTabView::PreferredContainerSize()
{
    gfx::Size ps = GetPreferredSize();
    return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height()));
}