本文整理汇总了C++中ResizeTo函数的典型用法代码示例。如果您正苦于以下问题:C++ ResizeTo函数的具体用法?C++ ResizeTo怎么用?C++ ResizeTo使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ResizeTo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResizeTo
void
TwoStateDrawButton::ResizeToPreferred()
{
if (fUpOne)
ResizeTo(fUpOne->Bounds().Width(), fUpOne->Bounds().Height());
else if (fDownOne)
ResizeTo(fDownOne->Bounds().Width(), fDownOne->Bounds().Height());
else if (fUpTwo)
ResizeTo(fUpTwo->Bounds().Width(),fUpTwo->Bounds().Height());
else if (fDownTwo)
ResizeTo(fDownTwo->Bounds().Width(), fDownTwo->Bounds().Height());
else if (fDisabledOne)
ResizeTo(fDisabledOne->Bounds().Width(), fDisabledOne->Bounds().Height());
else if(fDisabledTwo)
ResizeTo(fDisabledTwo->Bounds().Width(), fDisabledTwo->Bounds().Height());
}
示例2: Frame
void ColumnListView::CreateContainer(bool horizontal, bool vertical, border_style border,
uint32 ResizingMode, uint32 flags)
{
BRect ViewFrame = Frame();
BRect LabelsFrame = fColumnLabelView->Frame();
fScrollView = new CLVContainerView(NULL,this,ResizingMode,flags,horizontal,vertical,border);
BRect NewFrame = Frame();
//Resize the main view to make room for the CLVColumnLabelView
ResizeTo(ViewFrame.right-ViewFrame.left,ViewFrame.bottom-LabelsFrame.bottom-1.0);
MoveTo(NewFrame.left,NewFrame.top+(LabelsFrame.bottom-LabelsFrame.top+1.0));
fColumnLabelView->MoveTo(NewFrame.left,NewFrame.top);
//Add the ColumnLabelView
fScrollView->AddChild(fColumnLabelView);
//Remove and re-add the BListView so that it will draw after the CLVColumnLabelView
fScrollView->RemoveChild(this);
fScrollView->AddChild(this);
fFillerView = NULL;
}
示例3: BView
PictureView::PictureView(const char* name, const char* filename, uint32 flags)
: BView(name, flags),
fBitmap(NULL),
fWidth(0.0f),
fHeight(0.0f)
{
// Set transparent
SetViewColor(B_TRANSPARENT_COLOR);
// Try to get the image
fBitmap = BTranslationUtils::GetBitmap(filename);
if (fBitmap) {
BRect frame(fBitmap->Bounds());
fWidth = frame.Width();
fHeight = frame.Height();
} else
return;
ResizeTo(fWidth, fHeight);
}
示例4: Window
void ClientAgent::Show(void)
{
Window()->PostMessage(M_STATUS_CLEAR);
this->fMsgr.SendMessage(M_STATUS_ADDITEMS);
BMessage statusMsg(M_CW_UPDATE_STATUS);
statusMsg.AddPointer("item", fAgentWinItem);
statusMsg.AddInt32("status", WIN_NORMAL_BIT);
statusMsg.AddBool("hidden", false);
Window()->PostMessage(&statusMsg);
const BRect* agentRect(dynamic_cast<ClientWindow*>(Window())->AgentRect());
if (*agentRect != Frame()) {
ResizeTo(agentRect->Width(), agentRect->Height());
MoveTo(agentRect->left, agentRect->top);
}
// make RunView recalculate itself
fText->Show();
BView::Show();
}
示例5: BControl
BTextControl::BTextControl(BRect frame, const char *name, const char *label,
const char *text, BMessage *message, uint32 mask,
uint32 flags)
: BControl(frame, name, label, message, mask, flags | B_FRAME_EVENTS)
{
InitData(label, text);
BRect bounds(Bounds());
font_height fh;
GetFontHeight(&fh);
float height = (float)ceil(fh.ascent + fh.descent + fh.leading);
float lineHeight = fText->LineHeight(0);
ResizeTo(bounds.Width(), height + 8);
BRect textBounds(fText->Bounds());
fText->ResizeTo(textBounds.Width(), lineHeight + 4);
fText->MoveBy(0, (bounds.Height() - height) / 2.0f);
}
示例6: Lock
void
Controller::AddControlPanel(Panel *p)
{
Lock();
BRect wrect = Bounds();
int len = wrect.bottom - wrect.top;
int wid = wrect.right - wrect.left;
wrect = p->Bounds();
if (debug_ctl)
fprintf(dbfp, "my size %d %d panel(%g,%g,%g,%g)\n",
len, wid, wrect.left,wrect.top,wrect.right,wrect.bottom);
p->MoveTo(MARGIN, len-MARGIN);
backView->AddChild(p);
len += (wrect.bottom - wrect.top);
wid = Max(wid, wrect.right - wrect.left + 2*MARGIN);
ResizeTo(wid,len);
backView->MoveTo(0,0);
Unlock();
}
示例7: r
void
ShowImageWindow::WindowRedimension(BBitmap *pbitmap)
{
BScreen screen;
if (!screen.IsValid())
return;
BRect r(pbitmap->Bounds());
float width = r.Width() + 2 * PEN_SIZE + B_V_SCROLL_BAR_WIDTH;
float height = r.Height() + 2 * PEN_SIZE + 1 + fBar->Frame().Height() +
B_H_SCROLL_BAR_HEIGHT;
BRect frame = screen.Frame();
const float windowBorder = 5;
// dimensions so that window does not reach outside of screen
float maxWidth = frame.Width() + 1 - windowBorder - Frame().left;
float maxHeight = frame.Height() + 1 - windowBorder - Frame().top;
// We have to check size limits manually, otherwise
// menu bar will be too short for small images.
float minW, maxW, minH, maxH;
GetSizeLimits(&minW, &maxW, &minH, &maxH);
if (maxWidth > maxW)
maxWidth = maxW;
if (maxHeight > maxH)
maxHeight = maxH;
if (width < minW)
width = minW;
if (height < minH)
height = minH;
if (width > maxWidth)
width = maxWidth;
if (height > maxHeight)
height = maxHeight;
ResizeTo(width, height);
}
示例8: Bounds
// _UpdateFrame
void
IconOptionsControl::_UpdateFrame()
{
if (fLayoutData->label_layout_item && fLayoutData->icon_bar_layout_item) {
BRect labelFrame = fLayoutData->label_layout_item->Frame();
BRect iconFrame = fLayoutData->icon_bar_layout_item->Frame();
BSize oldSize = Bounds().Size();
fLayout->SetInsets(iconFrame.left, 0, 0, 0);
// update our frame
MoveTo(labelFrame.left, min_c(labelFrame.top, iconFrame.top));
ResizeTo(labelFrame.Width() + iconFrame.Width(),
max_c(labelFrame.Height(), iconFrame.Height()));
// If the size changes, ResizeTo() will trigger a relayout, otherwise
// we need to do that explicitly.
if (Bounds().Size() != oldSize)
Relayout();
}
}
示例9: GetPreferredSize
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();
}
示例10: StatusWindow
StatusWindow(const char* text)
:
BWindow(BRect(0, 0, 10, 10), B_TRANSLATE("status"), B_MODAL_WINDOW_LOOK,
B_MODAL_APP_WINDOW_FEEL, B_NO_WORKSPACE_ACTIVATION | B_NOT_ZOOMABLE
| B_AVOID_FRONT | B_NOT_RESIZABLE)
{
BView* rootView = new BView(Bounds(), "root", B_FOLLOW_ALL,
B_WILL_DRAW);
AddChild(rootView);
rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
float spacing = be_control_look->DefaultItemSpacing();
BALMLayout* layout = new BALMLayout(spacing);
rootView->SetLayout(layout);
layout->SetInset(spacing);
BStringView* string = new BStringView("text", text);
layout->AddView(string, layout->Left(), layout->Top(), layout->Right(),
layout->Bottom());
BSize min = layout->MinSize();
ResizeTo(min.Width(), min.Height());
CenterOnScreen();
}
示例11: D_INTERNAL
void
RouteWindow::_constrainToScreen()
{
D_INTERNAL(("RouteWindow::_constrainToScreen()\n"));
BScreen screen(this);
BRect screenRect = screen.Frame();
BRect windowRect = Frame();
// if the window is outside the screen rect
// move it to the default position
if (!screenRect.Intersects(windowRect)) {
windowRect.OffsetTo(screenRect.LeftTop());
MoveTo(windowRect.LeftTop());
windowRect = Frame();
}
// if the window is larger than the screen rect
// resize it to fit at each side
if (!screenRect.Contains(windowRect)) {
if (windowRect.left < screenRect.left) {
windowRect.left = screenRect.left + 5.0;
MoveTo(windowRect.LeftTop());
windowRect = Frame();
}
if (windowRect.top < screenRect.top) {
windowRect.top = screenRect.top + 5.0;
MoveTo(windowRect.LeftTop());
windowRect = Frame();
}
if (windowRect.right > screenRect.right) {
windowRect.right = screenRect.right - 5.0;
}
if (windowRect.bottom > screenRect.bottom) {
windowRect.bottom = screenRect.bottom - 5.0;
}
ResizeTo(windowRect.Width(), windowRect.Height());
}
}
示例12: Frame
void
ShowImageWindow::_ToggleFullScreen()
{
BRect frame;
fFullScreen = !fFullScreen;
if (fFullScreen) {
BScreen screen;
fWindowFrame = Frame();
frame = screen.Frame();
frame.top -= fBar->Bounds().Height() + 1;
frame.right += B_V_SCROLL_BAR_WIDTH;
frame.bottom += B_H_SCROLL_BAR_HEIGHT;
SetFlags(Flags() | B_NOT_RESIZABLE | B_NOT_MOVABLE);
Activate();
// make the window frontmost
} else {
frame = fWindowFrame;
SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
}
fToolBar->SetActionVisible(MSG_FULL_SCREEN, fFullScreen);
_SetToolBarVisible(!fFullScreen && fShowToolBar);
_SetToolBarBorder(!fFullScreen);
MoveTo(frame.left, frame.top);
ResizeTo(frame.Width(), frame.Height());
fImageView->SetHideIdlingCursor(fFullScreen);
fImageView->SetShowCaption(fFullScreen && fShowCaption);
Layout(false);
// We need to manually relayout here, as the views are layouted
// asynchronously, and FitToBounds() would still have the wrong size
fImageView->FitToBounds();
}
示例13: BWindow
ColorPicker::ColorPicker(BLooper * target) : BWindow(BRect(50, 75, 100 + (CP_COL_WIDTH * 32), 120 + (CP_COL_WIDTH * 8)), str(STR_SET_COLORS), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE), _target(target), _whichColor(0)
{
const float margin = 5.0f;
const float topRowHeight = 25.0f;
_colControl = new BColorControl(BPoint(margin, margin+topRowHeight+margin), B_CELLS_32x8, CP_COL_WIDTH, "color_picker", new BMessage(CP_COL_UPDATE));
ResizeTo(_colControl->Frame().right+margin, _colControl->Frame().bottom+margin);
BView * view = new BView(Bounds(), NULL, B_FOLLOW_ALL, 0);
AddChild(view);
view->SetViewColor(BeBackgroundGrey);
const BRect & bounds = view->Bounds();
float revertWidth = view->StringWidth(str(STR_REVERT))+10.0f;
BRect revertBounds(bounds.right-(revertWidth+margin), margin, bounds.right-margin, margin+topRowHeight);
view->AddChild(_revert = new BButton(revertBounds, NULL, str(STR_REVERT), new BMessage(CP_BUTTON_REVERT)));
float defaultWidth = view->StringWidth(str(STR_DEFAULT))+10.0f;
BRect defaultBounds(revertBounds.left-(margin+defaultWidth), revertBounds.top, revertBounds.left-margin, revertBounds.bottom);
view->AddChild(_default = new BButton(defaultBounds, NULL, str(STR_DEFAULT), new BMessage(CP_BUTTON_DEFAULT)));
view->AddChild(_sampleView = new BView(BRect(margin, margin, margin+topRowHeight, margin+topRowHeight), NULL, B_FOLLOW_TOP|B_FOLLOW_LEFT, B_WILL_DRAW));
_colorMenu = new BMenu("");
_colorMenu->SetLabelFromMarked(true);
for (int i=0; i<NUM_COLORS; i++)
{
BMessage * msg = new BMessage(CP_SELECTION_CHANGED);
msg->AddInt32("which", i);
BMenuItem * mi = new BMenuItem(str(STR_COLOR_BG+i), msg);
_colorMenu->AddItem(mi);
if (i==0) mi->SetMarked(true);
}
view->AddChild(new BMenuField(BRect(margin+topRowHeight+margin, margin, revertBounds.left-margin, revertBounds.bottom), NULL, NULL, _colorMenu));
view->AddChild(_colControl);
BMessage initMsg(CP_INIT);
PostMessage(&initMsg);
}
示例14: BSlider
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();
}
示例15: BWindow
VolumeWindow::VolumeWindow(BRect frame, bool dontBeep, int32 volumeWhich)
: BWindow(frame, "VolumeWindow", B_BORDERED_WINDOW_LOOK,
B_FLOATING_ALL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_WILL_ACCEPT_FIRST_CLICK
| B_AUTO_UPDATE_SIZE_LIMITS, 0),
fUpdatedCount(0)
{
SetLayout(new BGroupLayout(B_HORIZONTAL));
BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL);
layout->SetInsets(5, 5, 5, 5);
BBox* box = new BBox("sliderbox");
box->SetLayout(layout);
box->SetBorder(B_PLAIN_BORDER);
AddChild(box);
BSlider* slider = new VolumeControl(volumeWhich, !dontBeep,
new BMessage(kMsgVolumeChanged));
slider->SetModificationMessage(new BMessage(kMsgVolumeUpdate));
box->AddChild(slider);
slider->SetTarget(this);
ResizeTo(300, 50);
// Make sure it's not outside the screen.
const int32 kMargin = 3;
BRect windowRect = Frame();
BRect screenFrame(BScreen(B_MAIN_SCREEN_ID).Frame());
if (screenFrame.right < windowRect.right + kMargin)
MoveBy(- kMargin - windowRect.right + screenFrame.right, 0);
if (screenFrame.bottom < windowRect.bottom + kMargin)
MoveBy(0, - kMargin - windowRect.bottom + screenFrame.bottom);
if (screenFrame.left > windowRect.left - kMargin)
MoveBy(kMargin + screenFrame.left - windowRect.left, 0);
if (screenFrame.top > windowRect.top - kMargin)
MoveBy(0, kMargin + screenFrame.top - windowRect.top);
}