本文整理汇总了C++中BScrollView::Bounds方法的典型用法代码示例。如果您正苦于以下问题:C++ BScrollView::Bounds方法的具体用法?C++ BScrollView::Bounds怎么用?C++ BScrollView::Bounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BScrollView
的用法示例。
在下文中一共展示了BScrollView::Bounds方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Window
// Stuff we can only do when the main view is attached to a window
void
OutputFormatView::AttachedToWindow()
{
// Get the window and lock it
the_window = Window();
the_window->Lock();
// Set some size limits on the window
the_window->SetSizeLimits(
200.0,
32767.0,
Bounds().Height() - scroll_view->Bounds().Height() + 50.0,
32767.0);
// Set the target for messages sent to this view
list_view->SetTarget(this);
the_button->SetTarget(this);
// Make the list view the keyboard focus
list_view->MakeFocus();
// Select the first item in the list,
// and make its config view show up
if (list_view->CountItems() > 0)
list_view->Select(0);
else
the_button->SetEnabled(false);
// Unlock the window
the_window->Unlock();
// Call the base class
BView::AttachedToWindow();
}
示例2: BWindow
AddOnListInfo::AddOnListInfo(BRect frame,BView *mother)
: BWindow(frame,"DontWorryWindow",B_BORDERED_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,B_AVOID_FOCUS ),
_motherMessenger(mother)
{
CPreferences prefs(PREF_FILE_NAME,PREF_PATH_NAME);
BRect listRect = Bounds();
BScrollView *scrollinfo;
BView *scrollHBar;
float scrollHsize;
_lastClass = NULL;
_typeRequested = -1;
// initialisees les images
prefs.Load();
_classesBitmap = prefs.GetBitmap("classes");
_metodesBitmap = prefs.GetBitmap("metodes");
_variablesBitmap = prefs.GetBitmap("variables");
_privateBitmap = prefs.GetBitmap("private");
_protectedBitmap = prefs.GetBitmap("protected");
_virtualBitmap = prefs.GetBitmap("virtual");
listRect.right -= 15;
listRect.bottom -=15;
_listOfInfos = new AddOnListView(listRect);
scrollinfo = new BScrollView("scroll-info",_listOfInfos,B_FOLLOW_ALL_SIDES,0,true,true);
// deplace la scroll bar du bas
scrollHBar = scrollinfo->FindView("_HSB_");
scrollHBar->ResizeBy(-70,0);
scrollHBar->MoveBy(70,0);
scrollHsize = (scrollHBar->Bounds()).Height()+1;
listRect = scrollinfo->Bounds();
_progress = new AddOnProgressView(BRect(2,listRect.bottom-scrollHsize,70,listRect.bottom-1));
scrollinfo->AddChild(_progress);
AddChild(scrollinfo);
// place le focus sur la liste
_listOfInfos->MakeFocus(true);
// envoyer le pointer de la fenetre a la vue pour les deplacement
BMessage moveMsg(MOVE_WINDOW_PTR);
moveMsg.AddPointer(WINDOW_RESULT_PTR,this);
_motherMessenger.SendMessage(&moveMsg);
}
示例3: Bounds
void
PBox::AttachedToWindow(){
//calc font height (for nice control size)
font_height fontHeight;
be_bold_font->GetHeight(&fontHeight);
fFontHeight = fontHeight.descent + fontHeight.leading + fontHeight.ascent;
BRect frame = Bounds();
frame.InsetBy(5,5);
BRect temp = frame;
temp.bottom = temp.top + 40;
SettingsTextView *testo1=new SettingsTextView(temp,"testo",_T("Settings"));
AddChild(testo1);
frame.top +=40;
//BSeparator *sep=new BSeparator(frame,"sep","cippa");
//sep->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
//AddChild(sep);
//frame.InsetBy(kEdgeOffset, kEdgeOffset);
//frame.top += fFontHeight; //some space
#if SCROLLBAR
frame.right -= B_V_SCROLL_BAR_WIDTH + 2;
#endif
BView *view = new BView(frame, "", B_FOLLOW_ALL_SIDES,B_WILL_DRAW);
#if B_BEOS_VERSION > B_BEOS_VERSION_5
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
#else
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->SetHighColor(0, 0, 0, 0);
#endif
float settings_height = BuildGUI(fTemplate, fData, view);
view->ResizeTo( view->Bounds().Width(), settings_height);
#if SCROLLBAR
BScrollView * scroller = new BScrollView(
"scroller", view, B_FOLLOW_ALL,
0, false, true
);
float scroll_height = scroller->Bounds().Height();
float diff = settings_height - scroll_height;
if ( diff < 0 ) diff = 0;
scroller->ScrollBar(B_VERTICAL)->SetRange(0, diff);
view = scroller;
#endif
fPrefView = view;
AddChild(fPrefView);
testo1->SetText(fTemplate.FindString("name"));
}
示例4: r
int32
LibraryWindow::ScanThread(void *data)
{
LibraryWindow *win = (LibraryWindow *)data;
float maxwidth;
BRect r(5,5,105,20);
BView *systemheader = win->AddHeader(r.LeftTop(),TR("System Libraries:"));
win->Lock();
r = systemheader->Frame();
win->Unlock();
maxwidth = r.right;
r.OffsetBy(0,r.Height() + 10);
DPath sysPath = GetSystemPath(B_USER_DEVELOP_DIRECTORY);
sysPath << "lib/x86";
BRect out = win->ScanFolder(r.LeftTop(),sysPath.GetFullPath(),&maxwidth);
if (out != BRect(0,0,-1,-1))
{
r = out;
r.OffsetBy(0,10);
}
if (gPlatform == PLATFORM_HAIKU || gPlatform == PLATFORM_HAIKU_GCC4)
{
BView *commonheader = win->AddHeader(r.LeftTop(),TR("Common Libraries:"));
win->Lock();
r = commonheader->Frame();
win->Unlock();
maxwidth = MAX(r.right,maxwidth);
r.OffsetBy(0,r.Height() + 10);
out = win->ScanFolder(r.LeftTop(),GetSystemPath(B_USER_LIB_DIRECTORY).GetFullPath(),
&maxwidth);
if (out != BRect(0,0,-1,-1))
{
r = out;
r.OffsetBy(0,10);
}
}
BView *userheader = win->AddHeader(r.LeftTop(),TR("User Libraries:"));
win->Lock();
r = userheader->Frame();
win->Unlock();
maxwidth = MAX(r.right,maxwidth);
r.OffsetBy(0,r.Height() + 10);
out = win->ScanFolder(r.LeftTop(),GetSystemPath(B_USER_LIB_DIRECTORY).GetFullPath(),
&maxwidth);
if (out.IsValid())
{
r = out;
r.OffsetBy(0,10);
}
win->Lock();
BView *top = win->GetBackgroundView();
BScrollView *scrollView = (BScrollView*)top->FindView("scrollView");
BScrollBar *vbar = scrollView->ScrollBar(B_VERTICAL);
vbar->SetRange(0, r.bottom - scrollView->Bounds().Height());
vbar->SetSteps(r.Height() * 2.0,r.Height() * 8.0);
gSettings.Lock();
BRect savedframe;
if (gSettings.FindRect("libwin_frame",&savedframe) == B_OK)
win->ResizeTo(savedframe.Width(),savedframe.Height());
gSettings.Unlock();
BStringView *label = (BStringView*)top->FindView("label");
label->SetText(TR("Choose the system libraries for your project."));
float minw = label->Frame().right + 10;
win->SetSizeLimits(minw,30000,200,30000);
if (win->Bounds().Width() < minw)
win->ResizeTo(minw,win->Bounds().Height());
win->fScanThread = -1;
win->Unlock();
return 0;
}
示例5: btnAddRect
/*
* BLSettingsBlockedView(BRect canvas);
*
*/
BLSettingsBlockedView::BLSettingsBlockedView(BRect canvas, BLSettings* bls)
: BView(canvas, "blockedview", B_FOLLOW_ALL_SIDES, B_WILL_DRAW), Settings(bls), FilePanel(NULL)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
float Padding = 5.0;
float ButtonHeight = 25.0;
/* Calculate list view position */
BRect rectLVPos = BRect(canvas.left + Padding, canvas.top + Padding, canvas.right - (Padding + B_V_SCROLL_BAR_WIDTH + 3), canvas.bottom - (Padding + 3 + B_H_SCROLL_BAR_HEIGHT + 35));
/* Create and add listview and scrollview*/
ListView = new BListView(rectLVPos, "Blocked");
BScrollView* scrollview = new BScrollView("scroll_blocked", ListView, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_NO_BORDER, true, true);
scrollview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(scrollview);
/* Calculate the size and position of the Add button */
BRect btnAddRect(Bounds().right - (Padding + 60), Bounds().bottom - (Padding + ButtonHeight + 3), scrollview->Bounds().right, Bounds().bottom - (Padding + 3));
/* Create and add the Add button */
btnAdd = new BButton(btnAddRect, "BeLoginSettings_AddButton", "Add", new BMessage(BL_ADD_ITEM));
btnAdd->MakeDefault(true);
btnAdd->SetTarget(this);
AddChild(btnAdd);
/* Calculate the size and position of the Add button */
BRect TextControlRect(ListView->Bounds().left , Bounds().bottom - (Padding + ButtonHeight), Bounds().right - (Padding*2 + btnAdd->Bounds().Width()) , ListView->Bounds().bottom - Padding);
/* Create and add the password Textcontrol */
txtSignature = new BTextControl(TextControlRect, "BeLoginView_signature", "", "", NULL);
txtSignature->SetDivider(0.0);
AddChild(txtSignature);
/* Add blocked to list */
BLBlocked* blocked = Settings->GetBlocked();
for(int i=0;i<blocked->CountItems();i++)
ListView->AddItem(new BStringItem((blocked->ItemAt(i))->String()));
/* Set up messaging */
ListView->SetInvocationMessage(new BMessage(BL_REMOVE_ITEM));
ListView->SetTarget(this);
txtSignature->SetText("application/");
}
示例6: CaptionView
// Private function to add the config view of the currently
// selected output format to our window
void
OutputFormatView::AddConfigView()
{
the_window->Lock();
// Remove the window size limits,
// so we are free to do whatever we like
the_window->SetSizeLimits(0.0, 32767.0, 0.0, 32767.0);
// The current views must stay put while we resize
// the window to make room for the config view
MakeFollowBottom(false);
// Remove the old config view if there is one
if (config_view)
{
RemoveChild(config_view);
delete config_view;
config_view = 0;
}
BRect config_rect;
if (the_roster->MakeConfigurationView(
output_list[index].translator,
0,
&config_view,
&config_rect) == B_NO_ERROR &&
config_view != 0)
{
// Create a caption for the config view
// if there wasn't one already
if (!config_caption)
{
config_caption = new CaptionView(
BRect(8.0, info_view->Frame().bottom + 1.0, Bounds().right - 8.0, 0.0),
"config caption",
StringsRsrc[STR_TRANSLATOR_SETTINGS]);
config_caption->SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
AddChild(config_caption);
}
// Move the config view to just below the config caption
config_view->MoveBy(
16.0 - config_view->Frame().left,
config_caption->Frame().bottom + 1.0 - config_view->Frame().top);
// Colour it gray
config_view->SetViewColor(222, 222, 222);
config_view->SetLowColor(222, 222, 222);
// First resize the window so that the config view will fit,
// otherwise the config view may want to change with us
float width_diff = config_view->Frame().right + 16.0 - Bounds().Width();
the_window->ResizeTo(
Bounds().Width() + (width_diff > 0.0 ? width_diff : 0.0),
config_view->Frame().bottom + 8.0);
// Add it to the main view
AddChild(config_view);
// Make the config_view and its children follow the bottom of the window
RecursiveSetMode(config_view);
}
else
{
// This translator doesn't have a config view
if (config_caption)
{
RemoveChild(config_caption);
delete config_caption;
config_caption = 0;
}
the_window->ResizeTo(Bounds().right, info_view->Frame().bottom + 8.0);
}
// Make all views follow the bottom of the window again
MakeFollowBottom();
// Set the window's minimum size
float min_width = (config_view ? config_view->Frame().right : 200.0);
if (min_width < 200.0)
min_width = 200.0;
the_window->SetSizeLimits(
min_width,
32767.0,
Bounds().Height() - scroll_view->Bounds().Height() + 50.0,
32767.0);
the_window->Unlock();
}