本文整理汇总了C++中BButton::SetTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ BButton::SetTarget方法的具体用法?C++ BButton::SetTarget怎么用?C++ BButton::SetTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BButton
的用法示例。
在下文中一共展示了BButton::SetTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AttachedToWindow
void _OwqList::AttachedToWindow()
{
inherited::AttachedToWindow();
if( mAdd ) mAdd->SetTarget( this );
if( mChange ) mChange->SetTarget( this );
if( mRemove ) mRemove->SetTarget( this );
}
示例2:
void
ModulesView::AttachedToWindow()
{
_OpenSaver();
fScreenSaversListView->SetTarget(this);
fTestButton->SetTarget(this);
fAddButton->SetTarget(this);
}
示例3: AttachedToWindow
/////
// view attached to window
//
void MCMainView::AttachedToWindow()
{
BButton *btn;
btn = (BButton*) this->FindView("newchipbtn");
btn->SetTarget(be_app);
btn = (BButton*) this->FindView("prefbtn");
btn->SetTarget(be_app);
}
示例4: Parent
void
ModulesView::AttachedToWindow()
{
if (Parent() != NULL) {
// We adopt the size of our parent view (in case the window
// was resized during our absence (BTabView...)
ResizeTo(Parent()->Bounds().Width(), Parent()->Bounds().Height());
}
_OpenSaver();
fListView->SetTarget(this);
fTestButton->SetTarget(this);
fAddButton->SetTarget(this);
}
示例5: b
// show_window
void
show_window(BRect frame, const char* name)
{
BWindow* window = new BWindow(frame, name,
B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
BView* view = new TestView(window->Bounds(), "test", B_FOLLOW_ALL,
B_WILL_DRAW/* | B_FULL_UPDATE_ON_RESIZE*/);
window->AddChild(view);
BRect b(0.0, 0.0, 50.0, 15.0);
b.OffsetTo(5.0, view->Bounds().bottom - (b.Height() + 15.0));
BButton* control = new BButton(b, "button", "Copy", new BMessage(MSG_COPY_BITS));
view->AddChild(control);
control->SetTarget(view);
// test CopyBits() on top of children
b = BRect(80, 130, 130, 160);
BView* child = new BView(b, "some child", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, 0);
child->SetViewColor(255, 0, 0);
view->AddChild(child);
b = BRect(136, 127, 158, 140);
child = new BView(b, "some other child", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, 0);
child->SetViewColor(255, 255, 0);
view->AddChild(child);
window->Show();
}
示例6:
void
AutomountSettingsPanel::AttachedToWindow()
{
fInitialMountAllCheck->SetTarget(this);
fInitialMountAllBFSCheck->SetTarget(this);
fInitialMountRestoreCheck->SetTarget(this);
fInitialDontMountCheck->SetTarget(this);
fAutoMountAllCheck->SetTarget(this);
fAutoMountAllBFSCheck->SetTarget(this);
fScanningDisabledCheck->SetTarget(this);
fEjectWhenUnmountingCheckBox->SetTarget(this);
fDone->SetTarget(this);
fMountAllNow->SetTarget(fTarget);
}
示例7: addon_init
status_t addon_init (uint32 index, becasso_addon_info *info)
{
strcpy (info->name, "CaptureTest");
strcpy (info->author, "Sander Stoks");
strcpy (info->copyright, "© 1998-2001 ∑ Sum Software");
strcpy (info->description, "Fake Capture add-on");
info->type = BECASSO_CAPTURE;
info->index = index;
info->version = 1;
info->release = 2;
info->becasso_version = 2;
info->becasso_release = 0;
info->does_preview = 0;
info->flags = 0;
window = new CaptureWindow (BRect (100, 180, 100 + 188, 180 + 72));
BView *bg = new BView (BRect (0, 0, 188, 72), "bg", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
bg->SetViewColor (LightGrey);
window->AddChild (bg);
BMessage *msg = new BMessage (CAPTURE_READY);
msg->AddInt32 ("index", index);
BButton *grab = new BButton (BRect (128, 40, 180, 64), "grab", "Grab", msg);
grab->SetTarget (be_app);
bg->AddChild (grab);
window->Run();
return (0);
}
示例8: 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();
}
示例9: BWindow
InfoWindow::InfoWindow(BRect r,BWindow *win)
: BWindow(r,"Update Progress",B_TITLED_WINDOW,B_NOT_RESIZABLE|B_NOT_ZOOMABLE)
{
BView *mainView = new BView(Bounds(),NULL,B_FOLLOW_ALL,B_WILL_DRAW);
mainView->SetViewColor(216,216,216);
AddChild(mainView);
BRect sv = Bounds();
sv.bottom = sv.top+14;
line1 = new BStringView(sv,NULL,"Updating...");
sv.top = sv.bottom;
sv.bottom += 14;
line2 = new BStringView(sv,NULL,"");
sv.bottom = Bounds().bottom-30;
sv.top = sv.bottom-30;
bar = new BStatusBar(sv,NULL);
mainView->AddChild(line1);
mainView->AddChild(line2);
mainView->AddChild(bar);
sv.top = sv.bottom+5;
sv.bottom = sv.top+20;
sv.left = 0;
sv.right = 100;
BButton *button = new BButton(sv,NULL,"Pause",new BMessage('Paus'));
mainView->AddChild(button);
button->SetTarget(win);
sv.left = 150;
sv.right = 250;
button = new BButton(sv,NULL,"Stop",new BMessage('Stop'));
mainView->AddChild(button);
button->SetTarget(win);
Show();
}
示例10: LockableButton
void
BToolbar::AddAction(BMessage* message, BHandler* target,
const BBitmap* icon, const char* toolTipText, bool lockable)
{
BButton* button;
if (lockable)
button = new LockableButton(NULL, NULL, message);
else
button = new BButton(NULL, NULL, message);
button->SetIcon(icon);
button->SetFlat(true);
if (toolTipText != NULL)
button->SetToolTip(toolTipText);
_AddView(button);
button->SetTarget(target);
}
示例11: bounds
PasswordWindow::PasswordWindow()
: BWindow(BRect(100, 100, 400, 230), "Enter password",
B_NO_BORDER_WINDOW_LOOK, kPasswordWindowFeel
/* TODO: B_MODAL_APP_WINDOW_FEEL should also behave correctly */,
B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE
| B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES)
{
BView* topView = new BView(Bounds(), "topView", B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topView);
BRect bounds(Bounds());
bounds.InsetBy(10.0, 10.0);
BBox *customBox = new BBox(bounds, "customBox", B_FOLLOW_NONE);
topView->AddChild(customBox);
customBox->SetLabel("Unlock screen saver");
bounds.top += 10.0;
fPassword = new BTextControl(bounds, "password", "Enter password:",
"VeryLongPasswordPossible", B_FOLLOW_NONE);
customBox->AddChild(fPassword);
fPassword->MakeFocus(true);
fPassword->ResizeToPreferred();
fPassword->TextView()->HideTyping(true);
fPassword->SetDivider(be_plain_font->StringWidth("Enter password:") + 5.0);
BButton* button = new BButton(BRect(), "unlock", "Unlock",
new BMessage(kMsgUnlock), B_FOLLOW_NONE);
customBox->AddChild(button);
button->MakeDefault(true);
button->ResizeToPreferred();
button->SetTarget(NULL, be_app);
BRect frame = fPassword->Frame();
button->MoveTo(frame.right - button->Bounds().Width(), frame.bottom + 10.0);
customBox->ResizeTo(frame.right + 10.0, button->Frame().bottom + 10.0);
frame = customBox->Frame();
ResizeTo(frame.right + 10.0, frame.bottom + 10.0);
BScreen screen(this);
MoveTo(screen.Frame().left + (screen.Frame().Width() - Bounds().Width()) / 2,
screen.Frame().top + (screen.Frame().Height() - Bounds().Height()) / 2);
}
示例12: folderSelect
void
MediaConverterWindow::MessageReceived(BMessage* message)
{
entry_ref inRef;
char buffer[40];
BEntry inEntry;
switch (message->what) {
#if B_BEOS_VERSION <= B_BEOS_VERSION_6
case B_LANGUAGE_CHANGED:
LanguageChanged();
break;
#endif
case INIT_FORMAT_MENUS:
BuildFormatMenu();
if (CountSourceFiles() == 0)
SetEnabled(false, false);
break;
case B_SIMPLE_DATA:
if (message->WasDropped()) {
DetachCurrentMessage();
message->what = B_REFS_RECEIVED;
BMessenger(be_app).SendMessage(message);
delete message;
}
break;
case FORMAT_SELECT_MESSAGE:
BuildAudioVideoMenus();
break;
case AUDIO_CODEC_SELECT_MESSAGE:
break;
case VIDEO_CODEC_SELECT_MESSAGE:
break;
case CONVERT_BUTTON_MESSAGE:
if (!fConverting) {
fConvertButton->SetLabel(B_TRANSLATE("Cancel"));
fConverting = true;
SetStatusMessage(B_TRANSLATE("Convert"));
SetEnabled(false, true);
BMessenger(be_app).SendMessage(START_CONVERSION_MESSAGE);
} else if (!fCancelling) {
fCancelling = true;
SetStatusMessage(B_TRANSLATE("Cancelling" B_UTF8_ELLIPSIS));
BMessenger(be_app).SendMessage(CANCEL_CONVERSION_MESSAGE);
}
break;
case CONVERSION_DONE_MESSAGE:
{
SetStatusMessage(fCancelling ? B_TRANSLATE("Conversion cancelled")
: B_TRANSLATE("Conversion completed"));
fConverting = false;
fCancelling = false;
bool enable = CountSourceFiles() > 0;
SetEnabled(enable, enable);
fConvertButton->SetLabel(B_TRANSLATE("Convert"));
break;
}
case OUTPUT_FOLDER_MESSAGE:
// Execute Save Panel
if (fSaveFilePanel == NULL) {
BButton* selectThisDir;
BMessage folderSelect(FOLDER_SELECT_MESSAGE);
fSaveFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL,
B_DIRECTORY_NODE, true, &folderSelect, NULL, false, true);
fSaveFilePanel->SetButtonLabel(B_DEFAULT_BUTTON,
B_TRANSLATE("Select"));
fSaveFilePanel->SetTarget(this);
fSaveFilePanel->Window()->Lock();
fSaveFilePanel->Window()->SetTitle(
B_TRANSLATE("MediaConverter+:SaveDirectory"));
BRect buttonRect
= fSaveFilePanel->Window()->ChildAt(0)->FindView(
"cancel button")->Frame();
buttonRect.right = buttonRect.left - 20;
buttonRect.left = buttonRect.right - 130;
selectThisDir = new BButton(buttonRect, NULL,
B_TRANSLATE("Select this folder"),
new BMessage(SELECT_THIS_DIR_MESSAGE),
B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT);
selectThisDir->SetTarget(this);
fSaveFilePanel->Window()->ChildAt(0)->AddChild(selectThisDir);
fSaveFilePanel->Window()->Unlock();
fSaveFilePanel->SetRefFilter(new DirectoryFilter);
}
fSaveFilePanel->Show();
break;
case FOLDER_SELECT_MESSAGE:
// "SELECT" Button at Save Panel Pushed
fSaveFilePanel->GetNextSelectedRef(&inRef);
//.........这里部分代码省略.........
示例13: rect
//.........这里部分代码省略.........
MDR_DIALECT_CHOICE ("All Workspaces","全てのワークスペース"),
msg = new BMessage(kMsgStatusWorkspaceChanged)));
msg->AddInt32("StatusWindowWorkSpace", -1);
rect.OffsetBy(0,height + 6);
fStatusWorkspaceField = new BMenuField(rect,"status workspace",
MDR_DIALECT_CHOICE ("Window visible on:","表示場所:"),workspacesPopUp);
fStatusWorkspaceField->SetDivider(labelWidth);
box->AddChild(fStatusWorkspaceField);
rect = box->Frame(); rect.bottom = rect.top + 3*height + 13;
box = new BBox(rect);
box->SetLabel(MDR_DIALECT_CHOICE ("Deskbar Icon","デスクバーアイコンリンク"));
view->AddChild(box);
rect = box->Bounds().InsetByCopy(8,8);
rect.top += 7; rect.bottom = rect.top + height + 5;
BStringView *stringView = new BStringView(rect,B_EMPTY_STRING, MDR_DIALECT_CHOICE (
"The menu links are links to folders in a real folder like the Be menu.",
"デスクバーで表示する項目の設定"));
box->AddChild(stringView);
stringView->SetAlignment(B_ALIGN_CENTER);
stringView->ResizeToPreferred();
// BStringView::ResizeToPreferred() changes the width, so that the
// alignment has no effect anymore
stringView->ResizeTo(rect.Width(), stringView->Bounds().Height());
rect.left += 100; rect.right -= 100;
rect.OffsetBy(0,height + 1);
BButton *button = new BButton(rect,B_EMPTY_STRING,
MDR_DIALECT_CHOICE ("Configure Menu Links","メニューリンクの設定"),
msg = new BMessage(B_REFS_RECEIVED));
box->AddChild(button);
button->SetTarget(BMessenger("application/x-vnd.Be-TRAK"));
BPath path;
find_directory(B_USER_SETTINGS_DIRECTORY, &path);
path.Append("Mail/Menu Links");
BEntry entry(path.Path());
if (entry.InitCheck() == B_OK && entry.Exists()) {
entry_ref ref;
entry.GetRef(&ref);
msg->AddRef("refs", &ref);
}
else
button->SetEnabled(false);
rect = box->Frame(); rect.bottom = rect.top + 2*height + 6;
box = new BBox(rect);
box->SetLabel(MDR_DIALECT_CHOICE ("Misc.","その他の設定"));
view->AddChild(box);
rect = box->Bounds().InsetByCopy(8,8);
rect.top += 7; rect.bottom = rect.top + height + 5;
fAutoStartCheckBox = new BCheckBox(rect,"start daemon",
MDR_DIALECT_CHOICE ("Auto-Start Mail Daemon","Mail Daemonを自動起動"),NULL);
box->AddChild(fAutoStartCheckBox);
// about page
rect = tabView->Bounds(); rect.bottom -= tabView->TabHeight() + 4;
tabView->AddTab(view = new BView(rect,NULL,B_FOLLOW_ALL,0));
tabView->TabAt(2)->SetLabel(MDR_DIALECT_CHOICE ("About","情報"));
view->SetViewColor(top->ViewColor());
AboutTextView *about = new AboutTextView(rect);
示例14: BMessage
//.........这里部分代码省略.........
"\tchainloader\t\t+1\n\n");
infoText << B_TRANSLATE(
"You can see the correct partition in GParted for example.\n\n\n");
infoText << B_TRANSLATE(
"2.2) GRUB 2\n");
infoText << B_TRANSLATE(
"Newer versions of GRUB use an extra configuration file to add "
"custom entries to the boot menu. To add them to the top, you have "
"to create/edit a file by launching your favorite editor from a "
"Terminal like this:\n\n");
infoText << B_TRANSLATE(
"\tsudo <your favorite text editor> /etc/grub.d/40_custom\n\n");
infoText << B_TRANSLATE(
"NOTE: While the naming strategy for hard disks is still as described "
"under 2.1) the naming scheme for partitions has changed.\n\n");
infoText << B_TRANSLATE(
"GRUB's naming scheme is still: (hdN,n)\n\n");
infoText << B_TRANSLATE(
"All hard disks start with \"hd\".\n");
infoText << B_TRANSLATE(
"\"N\" is the hard disk number, starting with \"0\".\n");
infoText << B_TRANSLATE(
"\"n\" is the partition number, which for GRUB 2 starts with \"1\"\n");
infoText << B_TRANSLATE(
"With GRUB 2 the first logical partition always has the number \"5\", "
"regardless of the number of primary partitions.\n\n");
infoText << B_TRANSLATE(
"So below the heading that must not be edited, add something similar "
"to these lines:\n\n");
infoText << B_TRANSLATE(
"\t# Haiku on /dev/sda7\n");
infoText << B_TRANSLATE(
"\tmenuentry \"Haiku Alpha\" {\n");
infoText << B_TRANSLATE(
"\t\tset root=(hd0,7)\n");
infoText << B_TRANSLATE(
"\t\tchainloader +1\n");
infoText << B_TRANSLATE(
"\t}\n\n");
infoText << B_TRANSLATE(
"Additionally you have to edit another file to actually display the "
"boot menu:\n\n");
infoText << B_TRANSLATE(
"\tsudo <your favorite text editor> /etc/default/grub\n\n");
infoText << B_TRANSLATE(
"Here you have to comment out the line \"GRUB_HIDDEN_TIMEOUT=0\" by "
"putting a \"#\" in front of it in order to actually display the "
"boot menu.\n\n");
infoText << B_TRANSLATE(
"Finally, you have to update the boot menu by entering:\n\n");
infoText << B_TRANSLATE(
"\tsudo update-grub\n\n\n");
infoText << B_TRANSLATE(
"3) When you successfully boot into Haiku for the first time, make "
"sure to read our \"Welcome\" documentation, there is a link on the "
"Desktop.\n\n");
infoText << B_TRANSLATE(
"Have fun and thanks a lot for trying out Haiku! We hope you like it!");
#if 1
// Show the EULA first.
BTextView* textView = new BTextView("eula", be_plain_font, NULL,
B_WILL_DRAW);
textView->SetInsets(10, 10, 10, 10);
textView->MakeEditable(false);
textView->MakeSelectable(false);
textView->SetText(infoText);
BScrollView* scrollView = new BScrollView("eulaScroll",
textView, B_WILL_DRAW, false, true);
BButton* cancelButton = new BButton(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED));
cancelButton->SetTarget(this);
BButton* continueButton = new BButton(B_TRANSLATE("Continue"),
new BMessage(kMsgAgree));
continueButton->SetTarget(this);
continueButton->MakeDefault(true);
BRect eulaFrame = BRect(0, 0, 600, 450);
fEULAWindow = new BWindow(eulaFrame, B_TRANSLATE("README"),
B_MODAL_WINDOW, B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE
| B_AUTO_UPDATE_SIZE_LIMITS);
BLayoutBuilder::Group<>(fEULAWindow, B_VERTICAL, 10)
.SetInsets(10)
.Add(scrollView)
.AddGroup(B_HORIZONTAL, 10)
.AddGlue()
.Add(cancelButton)
.Add(continueButton);
fEULAWindow->CenterOnScreen();
fEULAWindow->Show();
#else
// Show the installer window without EULA.
new InstallerWindow();
#endif
}
示例15: BMessage
EULAWindow::EULAWindow()
:
BWindow(BRect(0, 0, 600, 450), B_TRANSLATE("README"),
B_MODAL_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE
| B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
BString infoText;
infoText << B_TRANSLATE(
"Welcome to the Haiku Installer!\n\n");
infoText << B_TRANSLATE(
"IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n");
infoText << B_TRANSLATE(
"This is beta-quality software! It means there is a risk of "
"losing important data. Make frequent backups! You have been "
"warned.\n\n\n");
infoText << B_TRANSLATE(
"1) If you are installing Haiku onto real hardware (not inside an "
"emulator), you may want to prepare a hard disk partition from "
"another OS (you could, for example, use a GParted Live-CD, which "
"can also resize existing partitions to make room).\n"
"You can also set up partitions by launching DriveSetup from "
"Installer, but you won't be able to resize existing partitions with "
"it. While DriveSetup has been quite thoroughly tested over the "
"years, it's recommended to have up-to-date backups of the other "
"partitions on your system. Just in case" B_UTF8_ELLIPSIS);
infoText << "\n\n\n";
infoText << B_TRANSLATE(
"2) The Installer will make the Haiku partition itself bootable, "
"but takes no steps to integrate Haiku into an existing boot menu. "
"If you have GRUB already installed, you can add Haiku to it.\n"
"For details, please consult the guide on booting Haiku on our "
"website at https://www.haiku-os.org/guides/booting.\n"
"Or you can set up a boot menu from Installer's \"Tools\" menu, see "
"the Userguide's topic on the application \"BootManager\".\n\n\n");
infoText << B_TRANSLATE(
"3) When you successfully boot into Haiku for the first time, make "
"sure to read our \"Welcome\" and \"Userguide\" documentation. There "
"are links on the Desktop and in WebPositive's bookmarks.\n\n");
infoText << B_TRANSLATE(
"Have fun and thanks for trying out Haiku!");
BTextView* textView = new BTextView("eula", be_plain_font, NULL, B_WILL_DRAW);
textView->SetInsets(10, 10, 10, 10);
textView->MakeEditable(false);
textView->MakeSelectable(false);
textView->SetText(infoText);
BScrollView* scrollView = new BScrollView("eulaScroll",
textView, B_WILL_DRAW, false, true);
BButton* cancelButton = new BButton(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED));
cancelButton->SetTarget(be_app);
BButton* continueButton = new BButton(B_TRANSLATE("Continue"),
new BMessage(kMsgAgree));
continueButton->SetTarget(be_app);
continueButton->MakeDefault(true);
if (!be_roster->IsRunning(kTrackerSignature))
SetWorkspaces(B_ALL_WORKSPACES);
BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
.SetInsets(B_USE_WINDOW_SPACING)
.Add(scrollView)
.AddGroup(B_HORIZONTAL, B_USE_ITEM_SPACING)
.AddGlue()
.Add(cancelButton)
.Add(continueButton);
CenterOnScreen();
Show();
}