void PowerStatusReplicant::MouseDown(BPoint point) { BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); menu->SetFont(be_plain_font); BMenuItem* item; menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show text label"), new BMessage(kMsgToggleLabel))); if (fShowLabel) item->SetMarked(true); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show status icon"), new BMessage(kMsgToggleStatusIcon))); if (fShowStatusIcon) item->SetMarked(true); menu->AddItem(new BMenuItem(!fShowTime ? B_TRANSLATE("Show time") : B_TRANSLATE("Show percent"), new BMessage(kMsgToggleTime))); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("Battery info" B_UTF8_ELLIPSIS), new BMessage(kMsgToggleExtInfo))); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("About" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED))); menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED))); menu->SetTargetForItems(this); ConvertToScreen(&point); menu->Go(point, true, false, true); }
// DisplayPopupMenu bool SplitManipulator::DisplayPopupMenu(BPoint where) { BPopUpMenu* menu = new BPopUpMenu("item popup", false, false); BMessage* message; BMenuItem* item; bool separator = false; if (fItem->HasVideo()) { message = new BMessage(MSG_SET_VIDEO_MUTED); message->AddPointer("item", fItem); item = new BMenuItem("Enabled Video", message); item->SetMarked(!fItem->IsVideoMuted()); menu->AddItem(item); separator = true; } if (fItem->HasAudio()) { message = new BMessage(MSG_SET_AUDIO_MUTED); message->AddPointer("item", fItem); item = new BMenuItem("Enabled Audio", message); item->SetMarked(!fItem->IsAudioMuted()); menu->AddItem(item); separator = true; } if (separator) menu->AddSeparatorItem(); BMenuItem* selectClipItem = NULL; if (ClipPlaylistItem* clipItem = dynamic_cast<ClipPlaylistItem*>(fItem)) { message = new BMessage(MSG_SELECT_AND_SHOW_CLIP); message->AddPointer("clip", clipItem->Clip()); selectClipItem = new BMenuItem("Select Clip", message); menu->AddItem(selectClipItem); } else separator = false; if (separator) menu->AddSeparatorItem(); message = new BMessage(MSG_REMOVE_ITEM); message->AddPointer("item", fItem); item = new BMenuItem("Remove Clip", message); menu->AddItem(item); menu->SetTargetForItems(fView); if (selectClipItem) selectClipItem->SetTarget(fView->Window()); show_popup_menu(menu, where, fView, false); return true; }
void MediaReplicant::MouseDown(BPoint point) { int32 buttons = B_PRIMARY_MOUSE_BUTTON; if (Looper() != NULL && Looper()->CurrentMessage() != NULL) Looper()->CurrentMessage()->FindInt32("buttons", &buttons); BPoint where = ConvertToScreen(point); if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) { BPopUpMenu* menu = new BPopUpMenu("", false, false); menu->SetFont(be_plain_font); menu->AddItem(new BMenuItem( B_TRANSLATE("Media preferences" B_UTF8_ELLIPSIS), new BMessage(kMsgOpenMediaSettings))); menu->AddItem(new BMenuItem( B_TRANSLATE("Sound preferences" B_UTF8_ELLIPSIS), new BMessage(kMsgOpenSoundSettings))); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("Open MediaPlayer"), new BMessage(kMsgOpenMediaPlayer))); menu->AddSeparatorItem(); BMenu* subMenu = new BMenu(B_TRANSLATE("Options")); menu->AddItem(subMenu); BMenuItem* item = new BMenuItem(B_TRANSLATE("Control physical output"), new BMessage(kMsgVolumeWhich)); item->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT); subMenu->AddItem(item); item = new BMenuItem(B_TRANSLATE("Beep"), new BMessage(kMsgToggleBeep)); item->SetMarked(!fDontBeep); subMenu->AddItem(item); menu->SetTargetForItems(this); subMenu->SetTargetForItems(this); menu->Go(where, true, true, BRect(where - BPoint(4, 4), where + BPoint(4, 4))); } else { // Show VolumeWindow fVolumeSlider = new VolumeWindow(BRect(where.x, where.y, where.x + 207, where.y + 19), fDontBeep, fVolumeWhich); fVolumeSlider->Show(); } }
void NetPulseView::MouseDown(BPoint where) { int32 buttons; int32 clicks; if (Window()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK || Window()->CurrentMessage()->FindInt32("clicks", &clicks) != B_OK) { return; } if (buttons == B_SECONDARY_MOUSE_BUTTON) { BPopUpMenu* popUpMenu = new BPopUpMenu("NetPulseMenu"); popUpMenu->AddItem(new BMenuItem("Connect", new BMessage(kMsgConnect))); popUpMenu->AddItem(new BMenuItem("Disconnect", new BMessage(kMsgDisconnect))); popUpMenu->AddSeparatorItem(); popUpMenu->AddItem(new BMenuItem("Statistics...", new BMessage(kMsgStatistics))); popUpMenu->AddSeparatorItem(); uint32 cookie = 0; BNetworkInterface interface; BNetworkRoster& roster = BNetworkRoster::Default(); while (roster.GetNextInterface(&cookie, interface) == B_OK) { const char* name = interface.Name(); if (strncmp(name, "loop", 4) != 0) { BMenuItem* menuItem = new BMenuItem(name, new BMessage(kMsgChangeInterface + cookie)); menuItem->SetMarked(cookie == fCookie); popUpMenu->AddItem(menuItem); } } popUpMenu->AddSeparatorItem(); popUpMenu->AddItem(new BMenuItem("Quit", new BMessage(kMsgQuit))); popUpMenu->SetTargetForItems(this); popUpMenu->FindItem(kMsgConnect)->SetEnabled(!fEnable && fCookie != 0); popUpMenu->FindItem(kMsgDisconnect)->SetEnabled(fEnable && fCookie != 0); popUpMenu->FindItem(kMsgStatistics)->SetEnabled(fEnable && fCookie != 0); popUpMenu->Go(ConvertToScreen(BPoint(0, 0)), true, false, false); delete popUpMenu; } else if (buttons == B_PRIMARY_MOUSE_BUTTON && clicks == 2) be_roster->Launch("application/x-vnd.Haiku-Network"); }
//! Track the mouse without blocking the window void CPUButton::MouseDown(BPoint point) { BPoint mousePosition; uint32 mouseButtons; GetMouse(&mousePosition, &mouseButtons); if ((B_PRIMARY_MOUSE_BUTTON & mouseButtons) != 0) { SetValue(!Value()); SetTracking(true); SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); } else if ((B_SECONDARY_MOUSE_BUTTON & mouseButtons) != 0 && fReplicantInDeskbar) { BPopUpMenu *menu = new BPopUpMenu(B_TRANSLATE("Deskbar menu")); menu->AddItem(new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED))); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("Remove replicant"), new BMessage(kDeleteReplicant))); menu->SetTargetForItems(this); ConvertToScreen(&point); menu->Go(point, true, true, true); } }
BPopUpMenu* AmControlChangeInfoView::NewPropertiesMenu() const { BPopUpMenu* menu = inherited::NewPropertiesMenu(); if (!menu) return menu; mCachedControlMenu = NewControlMenu(); if (!mCachedControlMenu) return menu; BMenuItem* item; if (mCachedControlMenu->CountItems() < 1 ) { item = new _AmActiveControlItem( "<track has no output filter>", new BMessage('null') ); if (item) { item->SetEnabled( false ); mCachedControlMenu->AddItem(item); } } item = new BMenuItem(mCachedControlMenu); if (!item) { delete mCachedControlMenu; mCachedControlMenu = NULL; return menu; } menu->AddSeparatorItem(); menu->AddItem(item); return menu; }
/*static*/ BPopUpMenu* AppearancePrefView::_MakeMenu(uint32 msg, const char** items, const char* defaultItemName) { BPopUpMenu* menu = new BPopUpMenu(""); int32 i = 0; while (*items) { if (!strcmp((*items), "")) menu->AddSeparatorItem(); else { BMessage* message = new BMessage(msg); menu->AddItem(new BMenuItem((*items), message)); } items++; i++; } BMenuItem* defaultItem = menu->FindItem(defaultItemName); if (defaultItem) defaultItem->SetMarked(true); return menu; }
// ShowContextMenu bool PathManipulator::ShowContextMenu(BPoint where) { // Change the selection to the current point if it isn't currently // selected. This could will only be chosen if the user right-clicked // a path point directly. if (fCurrentPathPoint >= 0 && !fSelection->Contains(fCurrentPathPoint)) { fSelection->MakeEmpty(); _UpdateSelection(); *fOldSelection = *fSelection; _Select(fCurrentPathPoint, false); } BPopUpMenu* menu = new BPopUpMenu("context menu", false, false); BMessage* message; BMenuItem* item; bool hasSelection = fSelection->CountItems() > 0; if (fCurrentPathPoint < 0) { message = new BMessage(B_SELECT_ALL); item = new BMenuItem("Select All", message, 'A'); menu->AddItem(item); menu->AddSeparatorItem(); } message = new BMessage(MSG_TRANSFORM); item = new BMenuItem("Transform", message, 'T'); item->SetEnabled(hasSelection); menu->AddItem(item); message = new BMessage(MSG_SPLIT_POINTS); item = new BMenuItem("Split", message); item->SetEnabled(hasSelection); menu->AddItem(item); message = new BMessage(MSG_FLIP_POINTS); item = new BMenuItem("Flip", message); item->SetEnabled(hasSelection); menu->AddItem(item); message = new BMessage(MSG_REMOVE_POINTS); item = new BMenuItem("Remove", message); item->SetEnabled(hasSelection); menu->AddItem(item); // go menu->SetTargetForItems(fCanvasView); menu->SetAsyncAutoDestruct(true); menu->SetFont(be_plain_font); where = fCanvasView->ConvertToScreen(where); BRect mouseRect(where, where); mouseRect.InsetBy(-10.0, -10.0); where += BPoint(5.0, 5.0); menu->Go(where, true, false, mouseRect, true); return true; }
void PowerStatusReplicant::MouseDown(BPoint point) { BMessage* msg = Window()->CurrentMessage(); int32 buttons = msg->GetInt32("buttons", 0); if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0) { BMessenger messenger(this); messenger.SendMessage(kMsgToggleExtInfo); } else { BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING, false, false); menu->SetFont(be_plain_font); BMenuItem* item; menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show text label"), new BMessage(kMsgToggleLabel))); if (fShowLabel) item->SetMarked(true); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show status icon"), new BMessage(kMsgToggleStatusIcon))); if (fShowStatusIcon) item->SetMarked(true); menu->AddItem(new BMenuItem(!fShowTime ? B_TRANSLATE("Show time") : B_TRANSLATE("Show percent"), new BMessage(kMsgToggleTime))); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("Battery info" B_UTF8_ELLIPSIS), new BMessage(kMsgToggleExtInfo))); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("About" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED))); menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED))); menu->SetTargetForItems(this); ConvertToScreen(&point); menu->Go(point, true, false, true); } }
void QueryView::MouseDown(BPoint point) { BPoint cursorpoint; uint32 buttonmask; GetMouse(&cursorpoint, &buttonmask); if( buttonmask & B_PRIMARY_MOUSE_BUTTON ) { //pop-up query results window BMessenger messenger(this); messenger.SendMessage(OPEN_QUERY_WIN); return; //buttons aren't mutually exclusive, so we favor the primary. } if( buttonmask & B_SECONDARY_MOUSE_BUTTON ) { //pop-up context menu BPopUpMenu* popup = new BPopUpMenu("QueryWatcher"); BMenuItem* headeritem = new BMenuItem( Name(), NULL ); headeritem->SetEnabled(false); popup->AddItem(headeritem); popup->AddSeparatorItem(); popup->AddItem(new BMenuItem("Open settings directory", new BMessage(OPEN_SETTINGS_DIR))); popup->AddSeparatorItem(); popup->AddItem( new BMenuItem("Open query results", new BMessage(OPEN_QUERY_WIN) ) ); popup->AddItem( new BMenuItem("Reset query", new BMessage(RESET_QUERY) ) ); status_t ret; ret = popup->SetTargetForItems(this); #ifdef DEBUG ASSERT(ret == B_OK); #endif ConvertToScreen(&point); popup->Go(point, true, false, true); delete popup; } }
void GLObject::MenuInvoked(BPoint point) { BPopUpMenu* m = new BPopUpMenu("Object",false,false); BMenuItem* i; int c = 1; m->AddItem(i = new BMenuItem("White",NULL)); if (color == c++) i->SetMarked(true); m->AddItem(i = new BMenuItem("Yellow",NULL)); if (color == c++) i->SetMarked(true); m->AddItem(i = new BMenuItem("Blue",NULL)); if (color == c++) i->SetMarked(true); m->AddItem(i = new BMenuItem("Red",NULL)); if (color == c++) i->SetMarked(true); m->AddItem(i = new BMenuItem("Green",NULL)); if (color == c++) i->SetMarked(true); m->AddSeparatorItem(); c = 0; m->AddItem(i = new BMenuItem("Solid",NULL)); if (solidity == c++) i->SetMarked(true); m->AddItem(i = new BMenuItem("Translucent",NULL)); if (solidity == c++) i->SetMarked(true); m->AddItem(i = new BMenuItem("Transparent",NULL)); if (solidity == c++) i->SetMarked(true); i = m->Go(point); int32 index = m->IndexOf(i); delete m; if (index < 5) { color = index+1; } else if (index > 5) { solidity = index-6; } changed = true; setEvent(fObjView->drawEvent); }
BPopUpMenu* TPrefsWindow::_BuildSignatureMenu(char* sig) { char name[B_FILE_NAME_LENGTH]; BEntry entry; BFile file; BMenuItem* item; BMessage* msg; BQuery query; BVolume vol; BVolumeRoster volume; BPopUpMenu* menu = new BPopUpMenu(""); msg = new BMessage(P_SIG); msg->AddString("signature", B_TRANSLATE("None")); menu->AddItem(item = new BMenuItem(B_TRANSLATE("None"), msg)); if (!strcmp(sig, B_TRANSLATE("None"))) item->SetMarked(true); msg = new BMessage(P_SIG); msg->AddString("signature", B_TRANSLATE("Random")); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Random"), msg)); if (!strcmp(sig, B_TRANSLATE("Random"))) item->SetMarked(true); menu->AddSeparatorItem(); volume.GetBootVolume(&vol); query.SetVolume(&vol); query.SetPredicate("_signature = *"); query.Fetch(); while (query.GetNextEntry(&entry) == B_NO_ERROR) { file.SetTo(&entry, O_RDONLY); if (file.InitCheck() == B_NO_ERROR) { msg = new BMessage(P_SIG); file.ReadAttr("_signature", B_STRING_TYPE, 0, name, sizeof(name)); msg->AddString("signature", name); menu->AddItem(item = new BMenuItem(name, msg)); if (!strcmp(sig, name)) item->SetMarked(true); } } return menu; }
void SeqToolBarView::ShowPropertyMenu(const AmTool* tool, BPoint where) { BPopUpMenu* menu = new BPopUpMenu("properties menu"); if (!menu) return; BMessage* msg = new BMessage(PROPERTIES_MSG); if (msg) { msg->AddString("tool_key", tool->Key() ); BMenuItem* item = new BMenuItem("Properties", msg); if (item) { item->SetTarget(this); menu->AddItem(item); } } msg = new BMessage(EDIT_MSG); if (msg) { msg->AddString("tool_key", tool->Key() ); msg->AddString("path", tool->LocalFilePath() ); BMenuItem* item = new BMenuItem("Edit", msg); if (item) { item->SetTarget(this); if (tool->IsReadOnly() ) item->SetEnabled(false); menu->AddItem(item); } } menu->AddSeparatorItem(); msg = new BMessage(REMOVE_FROM_TOOL_BAR_MSG); if (msg) { msg->AddString("tool_key", tool->Key() ); msg->AddPointer("tool_id", tool->Id() ); BMenuItem* item = new BMenuItem("Remove From Tool Bar", msg); if (item) { item->SetTarget(this); menu->AddItem(item); } } menu->SetAsyncAutoDestruct(true); where = ConvertToScreen(where); BRect sticky(where.x-5, where.y-5, where.x+5, where.y+5); menu->Go(where, true, false, sticky, true); }
/*static*/ BPopUpMenu* AppearancePrefView::_MakeColorSchemaMenu(uint32 msg, const color_schema** items, const color_schema* defaultItemName) { BPopUpMenu* menu = new BPopUpMenu(""); int32 i = 0; while (*items) { if (!strcmp((*items)->name, "")) menu->AddSeparatorItem(); else { BMessage* message = new BMessage(msg); message->AddPointer("color_schema", (const void*)*items); menu->AddItem(new BMenuItem((*items)->name, message)); } items++; i++; } return menu; }
/*static*/ BPopUpMenu* AppearancePrefView::_MakeMenu(uint32 msg, const char** items, const char* defaultItemName) { BPopUpMenu* menu = new BPopUpMenu(""); while (*items) { if (strcmp((*items), "") == 0) menu->AddSeparatorItem(); else { BMessage* message = new BMessage(msg); message->AddString("label", *items); BMenuItem* item = new BMenuItem(B_TRANSLATE(*items), message); menu->AddItem(item); if (strcmp(*items, defaultItemName) == 0) item->SetMarked(true); } items++; } return menu; }
void MediaRoutingView::showContextMenu( BPoint point) { D_METHOD(("MediaRoutingView::showContextMenu()\n")); BPopUpMenu *menu = new BPopUpMenu("MediaRoutingView PopUp", false, false, B_ITEMS_IN_COLUMN); menu->SetFont(be_plain_font); // add layout options BMenuItem *item; BMessage *message = new BMessage(M_LAYOUT_CHANGED); message->AddInt32("layout", M_ICON_VIEW); menu->AddItem(item = new BMenuItem("Icon View", message)); if (m_layout == M_ICON_VIEW) { item->SetMarked(true); } message = new BMessage(M_LAYOUT_CHANGED); message->AddInt32("layout", M_MINI_ICON_VIEW); menu->AddItem(item = new BMenuItem("Mini Icon View", message)); if (m_layout == M_MINI_ICON_VIEW) { item->SetMarked(true); } menu->AddSeparatorItem(); // add 'CleanUp' command menu->AddItem(new BMenuItem("Clean Up", new BMessage(M_CLEANUP_REQUESTED), 'K')); // add 'Select All' command menu->AddItem(new BMenuItem("Select All", new BMessage(M_SELECT_ALL), 'A')); menu->SetTargetForItems(this); ConvertToScreen(&point); point -= BPoint(1.0, 1.0); menu->Go(point, true, true, true); }
// --------------------------------------------------------------- // Constructor // // Sets up the view settings // // Preconditions: // // Parameters: // // Postconditions: // // Returns: // --------------------------------------------------------------- TIFFView::TIFFView(const char *name, uint32 flags, TranslatorSettings *settings) : BView(name, flags) { fSettings = settings; SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ViewColor()); fTitle = new BStringView("title", "TIFF Image Translator"); fTitle->SetFont(be_bold_font); char detail[100]; sprintf(detail, "Version %d.%d.%d %s", static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TIFF_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_MINOR_VERSION(TIFF_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_REVISION_VERSION(TIFF_TRANSLATOR_VERSION)), __DATE__); fDetail = new BStringView("detail", detail); int16 i = 1; fLibTIFF[0] = new BStringView(NULL, "TIFF Library:"); char libtiff[] = TIFFLIB_VERSION_STR; char *tok = strtok(libtiff, "\n"); while (i < 5 && tok) { fLibTIFF[i] = new BStringView(NULL, tok); tok = strtok(NULL, "\n"); i++; } BPopUpMenu* menu = new BPopUpMenu("pick compression"); uint32 currentCompression = fSettings->SetGetInt32(TIFF_SETTING_COMPRESSION); // create the menu items with the various compression methods add_menu_item(menu, COMPRESSION_NONE, "None", currentCompression); menu->AddSeparatorItem(); add_menu_item(menu, COMPRESSION_PACKBITS, "RLE (Packbits)", currentCompression); add_menu_item(menu, COMPRESSION_DEFLATE, "ZIP (Deflate)", currentCompression); add_menu_item(menu, COMPRESSION_LZW, "LZW", currentCompression); // TODO: the disabled compression modes are not configured in libTIFF // menu->AddSeparatorItem(); // add_menu_item(menu, COMPRESSION_JPEG, "JPEG", currentCompression); // TODO ? - strip encoding is not implemented in libTIFF for this compression // add_menu_item(menu, COMPRESSION_JP2000, "JPEG2000", currentCompression); fCompressionMF = new BMenuField("Use Compression:", menu, NULL); // Build the layout SetLayout(new BGroupLayout(B_VERTICAL)); i = 0; AddChild(BGroupLayoutBuilder(B_VERTICAL, 7) .Add(fTitle) .Add(fDetail) .AddGlue() .Add(fCompressionMF) .AddGlue() .Add(fLibTIFF[0]) .Add(fLibTIFF[1]) .Add(fLibTIFF[2]) .Add(fLibTIFF[3]) // Theses 4 adding above work because we know there are 4 strings // but it's fragile: one string less in the library version and the application breaks .AddGlue() .SetInsets(5, 5, 5, 5) ); BFont font; GetFont(&font); SetExplicitPreferredSize(BSize((font.Size() * 350)/12, (font.Size() * 200)/12)); }
void WorkspacesView::MouseDown(BPoint where) { // With enabled auto-raise feature, we'll get mouse messages we don't // want to handle here. if (!Bounds().Contains(where)) return; int32 buttons = 0; if (Window() != NULL && Window()->CurrentMessage() != NULL) Window()->CurrentMessage()->FindInt32("buttons", &buttons); if ((buttons & B_SECONDARY_MOUSE_BUTTON) == 0) return; // open context menu BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); menu->SetFont(be_plain_font); // TODO: alternatively change the count here directly? BMenuItem* changeItem = new BMenuItem("Change workspace count" B_UTF8_ELLIPSIS, new BMessage(kMsgChangeCount)); menu->AddItem(changeItem); WorkspacesWindow* window = dynamic_cast<WorkspacesWindow*>(Window()); if (window != NULL) { BMenuItem* item; menu->AddSeparatorItem(); menu->AddItem(item = new BMenuItem("Show window title", new BMessage(kMsgToggleTitle))); if (window->Look() == B_TITLED_WINDOW_LOOK) item->SetMarked(true); menu->AddItem(item = new BMenuItem("Show window border", new BMessage(kMsgToggleBorder))); if (window->Look() == B_TITLED_WINDOW_LOOK || window->Look() == B_MODAL_WINDOW_LOOK) item->SetMarked(true); menu->AddSeparatorItem(); menu->AddItem(item = new BMenuItem("Always on top", new BMessage(kMsgToggleAlwaysOnTop))); if (window->Feel() == B_FLOATING_ALL_WINDOW_FEEL) item->SetMarked(true); menu->AddItem(item = new BMenuItem("Auto-raise", new BMessage(kMsgToggleAutoRaise))); if (window->IsAutoRaising()) item->SetMarked(true); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem("About Workspaces" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED))); menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED))); menu->SetTargetForItems(window); } changeItem->SetTarget(this); ConvertToScreen(&where); menu->Go(where, true, true, true); }
BPopUpMenu* DeskbarView::_BuildMenu() { BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING, false, false); menu->SetFont(be_plain_font); menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE ( "Create new message", "N) 新規メッセージ作成")B_UTF8_ELLIPSIS, new BMessage(MD_OPEN_NEW))); menu->AddSeparatorItem(); BMessenger tracker(kTrackerSignature); BNavMenu* navMenu; BMenuItem* item; BMessage* msg; entry_ref ref; BPath path; find_directory(B_USER_SETTINGS_DIRECTORY, &path); path.Append("Mail/Menu Links"); BDirectory directory; if (_CreateMenuLinks(directory, path)) { int32 count = 0; while (directory.GetNextRef(&ref) == B_OK) { count++; path.SetTo(&ref); // the true here dereferences the symlinks all the way :) BEntry entry(&ref, true); // do we want to use the NavMenu, or just an ordinary BMenuItem? // we are using the NavMenu only for directories and queries bool useNavMenu = false; if (entry.InitCheck() == B_OK) { if (entry.IsDirectory()) useNavMenu = true; else if (entry.IsFile()) { // Files should use the BMenuItem unless they are queries char mimeString[B_MIME_TYPE_LENGTH]; BNode node(&entry); BNodeInfo info(&node); if (info.GetType(mimeString) == B_OK && strcmp(mimeString, "application/x-vnd.Be-query") == 0) useNavMenu = true; } // clobber the existing ref only if the symlink derefernces // completely, otherwise we'll stick with what we have entry.GetRef(&ref); } msg = new BMessage(B_REFS_RECEIVED); msg->AddRef("refs", &ref); if (useNavMenu) { item = new BMenuItem(navMenu = new BNavMenu(path.Leaf(), B_REFS_RECEIVED, tracker), msg); navMenu->SetNavDir(&ref); } else item = new BMenuItem(path.Leaf(), msg); menu->AddItem(item); if(entry.InitCheck() != B_OK) item->SetEnabled(false); } if (count > 0) menu->AddSeparatorItem(); } // Hack for R5's buggy Query Notification #ifdef HAIKU_TARGET_PLATFORM_BEOS menu->AddItem(new BMenuItem( MDR_DIALECT_CHOICE("Refresh New Mail Count", "未読メールカウントを更新"), new BMessage(MD_REFRESH_QUERY))); #endif // The New E-mail query if (fNewMessages > 0) { BString string; MDR_DIALECT_CHOICE( string << fNewMessages << " new message" << (fNewMessages != 1 ? "s" : B_EMPTY_STRING), string << fNewMessages << " 通の未読メッセージ"); _GetNewQueryRef(ref); item = new BMenuItem(navMenu = new BNavMenu(string.String(), B_REFS_RECEIVED, BMessenger(kTrackerSignature)), msg = new BMessage(B_REFS_RECEIVED)); msg->AddRef("refs", &ref); navMenu->SetNavDir(&ref); menu->AddItem(item); } else { menu->AddItem(item = new BMenuItem( MDR_DIALECT_CHOICE ("No new messages","未読メッセージなし"), NULL)); item->SetEnabled(false); } BMailAccounts accounts; if (modifiers() & B_SHIFT_KEY) { BMenu *accountMenu = new BMenu( MDR_DIALECT_CHOICE ("Check for mails only","R) メール受信のみ")); BFont font; menu->GetFont(&font); accountMenu->SetFont(&font); for (int32 i = 0; i < accounts.CountAccounts(); i++) { BMailAccountSettings* account = accounts.AccountAt(i); BMessage* message = new BMessage(MD_CHECK_FOR_MAILS); message->AddInt32("account", account->AccountID()); accountMenu->AddItem(new BMenuItem(account->Name(), message)); } if (accounts.CountAccounts() == 0) { item = new BMenuItem("<no accounts>", NULL); item->SetEnabled(false); accountMenu->AddItem(item); } accountMenu->SetTargetForItems(this); menu->AddItem(new BMenuItem(accountMenu, new BMessage(MD_CHECK_FOR_MAILS))); // Not used: // menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE ( // "Check For Mails Only","メール受信のみ"), new BMessage(MD_CHECK_FOR_MAILS))); menu->AddItem(new BMenuItem( MDR_DIALECT_CHOICE ("Send pending mails", "M) 保留メールを送信"), new BMessage(MD_SEND_MAILS))); } else { menu->AddItem(item = new BMenuItem( MDR_DIALECT_CHOICE ("Check for mail now", "C) メールチェック"), new BMessage(MD_CHECK_SEND_NOW))); if (accounts.CountAccounts() == 0) item->SetEnabled(false); } menu->AddSeparatorItem(); menu->AddItem(new BMenuItem( MDR_DIALECT_CHOICE ("Preferences", "P) メール環境設定") B_UTF8_ELLIPSIS, new BMessage(MD_OPEN_PREFS))); if (modifiers() & B_SHIFT_KEY) { menu->AddItem(new BMenuItem( MDR_DIALECT_CHOICE ("Shutdown mail services", "Q) 終了"), new BMessage(B_QUIT_REQUESTED))); } // Reset Item Targets (only those which aren't already set) for (int32 i = menu->CountItems(); i-- > 0;) { item = menu->ItemAt(i); if (item && (msg = item->Message()) != NULL) { if (msg->what == B_REFS_RECEIVED) item->SetTarget(tracker); else item->SetTarget(this); } } return menu; }
void ActivityView::MouseDown(BPoint where) { int32 buttons = B_SECONDARY_MOUSE_BUTTON; if (Looper() != NULL && Looper()->CurrentMessage() != NULL) Looper()->CurrentMessage()->FindInt32("buttons", &buttons); if (buttons == B_PRIMARY_MOUSE_BUTTON) { fZoomPoint = where; fOriginalResolution = fDrawResolution; fZooming = true; SetMouseEventMask(B_POINTER_EVENTS); return; } BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); menu->SetFont(be_plain_font); BMenu* additionalMenu = new BMenu(B_TRANSLATE("Additional items")); additionalMenu->SetFont(be_plain_font); SystemInfo info; BMenuItem* item; for (int32 i = 0; i < DataSource::CountSources(); i++) { const DataSource* source = DataSource::SourceAt(i); if (source->MultiCPUOnly() && info.CPUCount() == 1) continue; BMessage* message = new BMessage(kMsgToggleDataSource); message->AddInt32("index", i); item = new BMenuItem(source->Name(), message); if (FindDataSource(source)) item->SetMarked(true); if (source->Primary()) menu->AddItem(item); else additionalMenu->AddItem(item); } menu->AddItem(new BMenuItem(additionalMenu)); menu->AddSeparatorItem(); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show legend"), new BMessage(kMsgToggleLegend))); item->SetMarked(fShowLegend); menu->SetTargetForItems(this); additionalMenu->SetTargetForItems(this); ActivityWindow* window = dynamic_cast<ActivityWindow*>(Window()); if (window != NULL && window->ActivityViewCount() > 1) { menu->AddSeparatorItem(); BMessage* message = new BMessage(kMsgRemoveView); message->AddPointer("view", this); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Remove graph"), message)); item->SetTarget(window); } ConvertToScreen(&where); menu->Go(where, true, false, true); }
void SeqMeasureControl::ShowTimeSignatureMenu(BPoint pt) const { AmSignature sig; if (SignatureForPt(pt, sig) != B_OK) return; BPopUpMenu* menu = new BPopUpMenu("menu"); if (!menu) return; menu->SetFontSize(10); menu->SetAsyncAutoDestruct(true); BMessage signatureChoices; if (seq_get_message_preference(SIGNATURE_CHOICES_PREF, &signatureChoices) == B_OK) { int32 beats; for(int32 k = 0; signatureChoices.FindInt32("beats", k, &beats) == B_OK; k++) { int32 beatvalue; if (signatureChoices.FindInt32("beat value", k, &beatvalue) == B_OK) { BString label; label << beats << " / " << beatvalue; BMessage* msg = new BMessage(CHANGE_SIGNATURE_MSG); BMenuItem* item; if (msg && (item = new BMenuItem(label.String(), msg)) ) { msg->AddInt32("measure", sig.Measure() ); msg->AddInt32("beats", beats); msg->AddInt32("beat value", beatvalue); menu->AddItem(item); item->SetTarget(this); } } } } BMessage* msg = new BMessage(CHANGE_SIGNATURE_MSG); BMenuItem* item; if ( msg && (item = new BMenuItem("Other...", msg)) ) { msg->AddInt32("measure", sig.Measure() ); msg->AddInt32("beats", sig.Beats() ); msg->AddInt32("beat value", sig.BeatValue() ); menu->AddItem(item); item->SetTarget( Window() ); } /* If I'm a track measure control, add in my motion list. */ BMenu* motionMenu = NULL; if (mTrackWinProps && (motionMenu = new BMenu("Motion")) ) { BMessage* msg = new BMessage(CHANGE_MOTION_MSG); BMenuItem* item; if (msg && (item = new BMenuItem(NONE_STR, msg)) ) { msg->AddInt32("code", MOTION_NONE); msg->AddInt32("measure", sig.Measure() ); motionMenu->AddItem(item); item->SetTarget(this); } msg = new BMessage(CHANGE_MOTION_MSG); if (msg && (item = new BMenuItem(CLEAR_STR, msg)) ) { msg->AddInt32("code", MOTION_CLEAR); msg->AddInt32("measure", sig.Measure() ); motionMenu->AddItem(item); item->SetTarget(this); } BString label, key; for (uint32 k = 0; AmGlobals().GetMotionInfo(k, label, key) == B_OK; k++) { msg = new BMessage(CHANGE_MOTION_MSG); if (msg && (item = new BMenuItem(label.String(), msg)) ) { if (k == 0) motionMenu->AddSeparatorItem(); msg->AddString(MOTION_KEY_STR, key); msg->AddInt32("measure", sig.Measure() ); motionMenu->AddItem(item); item->SetTarget(this); } } if (motionMenu) { menu->AddSeparatorItem(); BMenuItem* i = new BMenuItem(motionMenu); if (i) menu->AddItem(i); } } BRect frame(pt, pt); menu->Go( ConvertToScreen(pt), true, false, ConvertToScreen(frame), true); }
void WorkspacesView::MouseDown(BPoint where) { // With enabled auto-raise feature, we'll get mouse messages we don't // want to handle here. if (!Bounds().Contains(where)) return; int32 buttons = 0; if (Window() != NULL && Window()->CurrentMessage() != NULL) Window()->CurrentMessage()->FindInt32("buttons", &buttons); if ((buttons & B_SECONDARY_MOUSE_BUTTON) == 0) return; // open context menu BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); menu->SetFont(be_plain_font); // TODO: alternatively change the count here directly? BMenuItem* changeItem = new BMenuItem(B_TRANSLATE("Change workspace count" B_UTF8_ELLIPSIS), new BMessage(kMsgChangeCount)); menu->AddItem(changeItem); WorkspacesWindow* window = dynamic_cast<WorkspacesWindow*>(Window()); if (window != NULL) { // inside Workspaces app BMenuItem* item; menu->AddSeparatorItem(); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show window tab"), new BMessage(kMsgToggleTitle))); if (window->Look() == B_TITLED_WINDOW_LOOK) item->SetMarked(true); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show window border"), new BMessage(kMsgToggleBorder))); if (window->Look() == B_TITLED_WINDOW_LOOK || window->Look() == B_MODAL_WINDOW_LOOK) item->SetMarked(true); menu->AddSeparatorItem(); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Always on top"), new BMessage(kMsgToggleAlwaysOnTop))); if (window->Feel() == B_FLOATING_ALL_WINDOW_FEEL) item->SetMarked(true); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Auto-raise"), new BMessage(kMsgToggleAutoRaise))); if (window->IsAutoRaising()) item->SetMarked(true); if (be_roster->IsRunning(kDeskbarSignature)) { menu->AddItem(item = new BMenuItem(B_TRANSLATE("Live in the Deskbar"), new BMessage(kMsgToggleLiveInDeskbar))); BDeskbar deskbar; item->SetMarked(deskbar.HasItem(kDeskbarItemName)); } menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("About Workspaces" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED))); menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED))); menu->SetTargetForItems(window); } else { // we're replicated in some way... BMenuItem* item; menu->AddSeparatorItem(); // check which way BDragger *dragger = dynamic_cast<BDragger*>(ChildAt(0)); if (dragger) { // replicant menu->AddItem(item = new BMenuItem(B_TRANSLATE("Remove replicant"), new BMessage(B_TRASH_TARGET))); item->SetTarget(dragger); } else { // Deskbar item menu->AddItem(item = new BMenuItem(B_TRANSLATE("Remove replicant"), new BMessage(kMsgToggleLiveInDeskbar))); item->SetTarget(this); } } changeItem->SetTarget(this); ConvertToScreen(&where); menu->Go(where, true, true, true); }
void NetworkStatusView::MouseDown(BPoint point) { BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING, false, false); menu->SetAsyncAutoDestruct(true); menu->SetFont(be_plain_font); BString wifiInterface; BNetworkDevice wifiDevice; // Add interfaces for (std::map<BString, int32>::const_iterator it = fInterfaceStatuses.begin(); it != fInterfaceStatuses.end(); ++it) { const BString& name = it->first; BString label = name; label += ": "; label += kStatusDescriptions[ _DetermineInterfaceStatus(name.String())]; BMessage* info = new BMessage(kMsgShowConfiguration); info->AddString("interface", name.String()); menu->AddItem(new BMenuItem(label.String(), info)); // We only show the networks of the first wireless device we find. if (wifiInterface.IsEmpty()) { wifiDevice.SetTo(name); if (wifiDevice.IsWireless()) wifiInterface = name; } } if (!fInterfaceStatuses.empty()) menu->AddSeparatorItem(); // Add wireless networks, if any if (!wifiInterface.IsEmpty()) { std::set<BNetworkAddress> associated; BNetworkAddress address; uint32 cookie = 0; while (wifiDevice.GetNextAssociatedNetwork(cookie, address) == B_OK) associated.insert(address); cookie = 0; wireless_network network; typedef std::vector<wireless_network> WirelessNetworkVector; WirelessNetworkVector wirelessNetworks; while (wifiDevice.GetNextNetwork(cookie, network) == B_OK) wirelessNetworks.push_back(network); std::sort(wirelessNetworks.begin(), wirelessNetworks.end(), signal_strength_compare); int32 count = 0; for (WirelessNetworkVector::iterator it = wirelessNetworks.begin(); it != wirelessNetworks.end(); it++) { wireless_network &network = *it; BMessage* message = new BMessage(kMsgJoinNetwork); message->AddString("device", wifiInterface); message->AddString("name", network.name); message->AddFlat("address", &network.address); BMenuItem* item = new WirelessNetworkMenuItem(network.name, network.signal_strength, network.authentication_mode, message); menu->AddItem(item); if (associated.find(network.address) != associated.end()) item->SetMarked(true); count++; } if (count == 0) { BMenuItem* item = new BMenuItem( B_TRANSLATE("<no wireless networks found>"), NULL); item->SetEnabled(false); menu->AddItem(item); } menu->AddSeparatorItem(); } menu->AddItem(new BMenuItem(B_TRANSLATE( "Open network preferences" B_UTF8_ELLIPSIS), new BMessage(kMsgOpenNetworkPreferences))); if (fInDeskbar) { menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED))); } menu->SetTargetForItems(this); ConvertToScreen(&point); menu->Go(point, true, true, true); }
EthernetSettingsView::EthernetSettingsView() : BView("EthernetSettingsView", 0, NULL), fCurrentSettings(NULL) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fSocket = socket(AF_INET, SOCK_DGRAM, 0); _GatherInterfaces(); // build the GUI BGroupLayout* rootLayout = new BGroupLayout(B_VERTICAL); SetLayout(rootLayout); BGridView* controlsGroup = new BGridView(); BGridLayout* layout = controlsGroup->GridLayout(); // insets float inset = ceilf(be_plain_font->Size() * 0.7); rootLayout->SetInsets(inset, inset, inset, inset); rootLayout->SetSpacing(inset); layout->SetSpacing(inset, inset); BPopUpMenu* deviceMenu = new BPopUpMenu(B_TRANSLATE("<no adapter>")); for (int32 i = 0; i < fInterfaces.CountItems(); i++) { BString& name = *fInterfaces.ItemAt(i); BString label = name; BMessage* info = new BMessage(kMsgInfo); info->AddString("interface", name.String()); BMenuItem* item = new BMenuItem(label.String(), info); deviceMenu->AddItem(item); } BPopUpMenu* modeMenu = new BPopUpMenu("modes"); modeMenu->AddItem(new BMenuItem(B_TRANSLATE("Static"), new BMessage(kMsgStaticMode))); modeMenu->AddItem(new BMenuItem(B_TRANSLATE("DHCP"), new BMessage(kMsgDHCPMode))); modeMenu->AddSeparatorItem(); modeMenu->AddItem(new BMenuItem(B_TRANSLATE("Disabled"), new BMessage(kMsgDisabledMode))); BPopUpMenu* networkMenu = new BPopUpMenu("networks"); fDeviceMenuField = new BMenuField(B_TRANSLATE("Adapter:"), deviceMenu); layout->AddItem(fDeviceMenuField->CreateLabelLayoutItem(), 0, 0); layout->AddItem(fDeviceMenuField->CreateMenuBarLayoutItem(), 1, 0); fNetworkMenuField = new BMenuField(B_TRANSLATE("Network:"), networkMenu); layout->AddItem(fNetworkMenuField->CreateLabelLayoutItem(), 0, 1); layout->AddItem(fNetworkMenuField->CreateMenuBarLayoutItem(), 1, 1); fTypeMenuField = new BMenuField(B_TRANSLATE("Mode:"), modeMenu); layout->AddItem(fTypeMenuField->CreateLabelLayoutItem(), 0, 2); layout->AddItem(fTypeMenuField->CreateMenuBarLayoutItem(), 1, 2); fIPTextControl = new BTextControl(B_TRANSLATE("IP address:"), "", NULL); SetupTextControl(fIPTextControl); BLayoutItem* layoutItem = fIPTextControl->CreateTextViewLayoutItem(); layoutItem->SetExplicitMinSize(BSize( fIPTextControl->StringWidth("XXX.XXX.XXX.XXX") + inset, B_SIZE_UNSET)); layout->AddItem(fIPTextControl->CreateLabelLayoutItem(), 0, 3); layout->AddItem(layoutItem, 1, 3); fNetMaskTextControl = new BTextControl(B_TRANSLATE("Netmask:"), "", NULL); SetupTextControl(fNetMaskTextControl); layout->AddItem(fNetMaskTextControl->CreateLabelLayoutItem(), 0, 4); layout->AddItem(fNetMaskTextControl->CreateTextViewLayoutItem(), 1, 4); fGatewayTextControl = new BTextControl(B_TRANSLATE("Gateway:"), "", NULL); SetupTextControl(fGatewayTextControl); layout->AddItem(fGatewayTextControl->CreateLabelLayoutItem(), 0, 5); layout->AddItem(fGatewayTextControl->CreateTextViewLayoutItem(), 1, 5); // TODO: Replace the DNS text controls by a BListView with add/remove // functionality and so on... fPrimaryDNSTextControl = new BTextControl(B_TRANSLATE("DNS #1:"), "", NULL); SetupTextControl(fPrimaryDNSTextControl); layout->AddItem(fPrimaryDNSTextControl->CreateLabelLayoutItem(), 0, 6); layout->AddItem(fPrimaryDNSTextControl->CreateTextViewLayoutItem(), 1, 6); fSecondaryDNSTextControl = new BTextControl(B_TRANSLATE("DNS #2:"), "", NULL); SetupTextControl(fSecondaryDNSTextControl); layout->AddItem(fSecondaryDNSTextControl->CreateLabelLayoutItem(), 0, 7); layout->AddItem(fSecondaryDNSTextControl->CreateTextViewLayoutItem(), 1, 7); fDomainTextControl = new BTextControl(B_TRANSLATE("Domain:"), "", NULL); SetupTextControl(fDomainTextControl); layout->AddItem(fDomainTextControl->CreateLabelLayoutItem(), 0, 8); layout->AddItem(fDomainTextControl->CreateTextViewLayoutItem(), 1, 8); fErrorMessage = new BStringView("error", ""); fErrorMessage->SetAlignment(B_ALIGN_LEFT); fErrorMessage->SetFont(be_bold_font); fErrorMessage->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); layout->AddView(fErrorMessage, 1, 9); // button group (TODO: move to window, but take care of // enabling/disabling) BGroupView* buttonGroup = new BGroupView(B_HORIZONTAL); fRevertButton = new BButton(B_TRANSLATE("Revert"), new BMessage(kMsgRevert)); fRevertButton->SetEnabled(false); buttonGroup->GroupLayout()->AddView(fRevertButton); buttonGroup->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); fApplyButton = new BButton(B_TRANSLATE("Apply"), new BMessage(kMsgApply)); fApplyButton->SetEnabled(false); buttonGroup->GroupLayout()->AddView(fApplyButton); rootLayout->AddView(controlsGroup); rootLayout->AddView(buttonGroup); }
BPopUpMenu * BuildPopUp(BDirectory &dir) { BPopUpMenu *menu = new BPopUpMenu("menu", false); //BMenuItem *item; //BMessage *msg; //status_t err; //menu->SetFont(be_plain_font); AddTemplateItem(menu, B_UTF8_COPYRIGHT " Haiku", sHaikuHeaderTemplate); /* AddTemplateItem(menu, B_UTF8_COPYRIGHT " Haiku (Add me)", sHaikuAddMeHeaderTemplate, sHaikuAddMeHeaderMatch); */ AddTemplateItem(menu, B_UTF8_COPYRIGHT " Me (Haiku)", sHaikuMeHeaderTemplate); AddTemplateItem(menu, B_UTF8_COPYRIGHT " Me (Haiku) + Rights Reserved", sHaikuMeRightsHeaderTemplate); AddTemplateItem(menu, "Id + " B_UTF8_COPYRIGHT "Me + MIT + Created", sIdMeMITCreatedHeaderTemplate); AddTemplateItem(menu, "Id + " B_UTF8_COPYRIGHT "Me + Full MIT + Created", sIdMeFullMITCreatedHeaderTemplate); AddTemplateItem(menu, "Id + " B_UTF8_COPYRIGHT "Me + Full MIT Revised + Created", sIdMeFullMITRevisedCreatedHeaderTemplate); if (dir.InitCheck() < B_OK) return menu; entry_ref ref; while (dir.GetNextRef(&ref) == B_OK) { BFile file(&ref, B_READ_ONLY); if (file.InitCheck() < B_OK) continue; BString str; char *p = str.LockBuffer(1024); memset(p, 0, 1024); if (file.Read(p, 1024) <= 0) continue; str.UnlockBuffer(); AddTemplateItem(menu, ref.name, str.String()); } menu->AddSeparatorItem(); menu->AddItem(new BMenuItem("Open template folder"B_UTF8_ELLIPSIS, new BMessage('optf'))); menu->AddItem(new BMenuItem("Set author"B_UTF8_ELLIPSIS, new BMessage('seta'))); menu->AddItem(new BMenuItem("About"B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED))); return menu; }
void MediaNodePanel::showContextMenu( BPoint point) { D_METHOD(("MediaNodePanel::showContextMenu()\n")); BPopUpMenu *menu = new BPopUpMenu("MediaNodePanel PopUp", false, false, B_ITEMS_IN_COLUMN); menu->SetFont(be_plain_font); BMenuItem *item; BMessage *message; // add the "Tweak Parameters" item message = new BMessage(MediaRoutingView::M_NODE_TWEAK_PARAMETERS); menu->AddItem(item = new BMenuItem("Tweak parameters", message, 'P')); if (!(ref->kind() & B_CONTROLLABLE)) { item->SetEnabled(false); } message = new BMessage(InfoWindowManager::M_INFO_WINDOW_REQUESTED); message->AddInt32("nodeID", ref->id()); menu->AddItem(new BMenuItem("Get info", message, 'I')); menu->AddSeparatorItem(); menu->AddItem(item = new BMenuItem("Release", new BMessage(MediaRoutingView::M_DELETE_SELECTION), 'T')); if (!ref->isInternal()) { item->SetEnabled(false); } menu->AddSeparatorItem(); // add the "Cycle" item message = new BMessage(MediaRoutingView::M_NODE_CHANGE_CYCLING); message->AddBool("cycle", !ref->isCycling()); menu->AddItem(item = new BMenuItem("Cycle", message)); item->SetMarked(ref->isCycling()); if (ref->flags() & NodeRef::NO_SEEK) { item->SetEnabled(false); } // add the "Run Mode" sub menu BMenu *subMenu = new BMenu("Run mode"); subMenu->SetFont(be_plain_font); for (uint32 runMode = 1; runMode <= BMediaNode::B_RECORDING; runMode++) { BString itemName = MediaString::getStringFor(static_cast<BMediaNode::run_mode> (runMode)); message = new BMessage(MediaRoutingView::M_NODE_CHANGE_RUN_MODE); message->AddInt32("run_mode", runMode); subMenu->AddItem(item = new BMenuItem(itemName.String(), message)); if (ref->runMode() == runMode) { item->SetMarked(true); } else if ((ref->runMode() == 0) && (ref->group()) && (ref->group()->runMode() == BMediaNode::run_mode(runMode))) { item->SetMarked(true); } } subMenu->AddSeparatorItem(); message = new BMessage(MediaRoutingView::M_NODE_CHANGE_RUN_MODE); message->AddInt32("run_mode", 0); subMenu->AddItem(item = new BMenuItem("(same as group)", message)); if (ref->group() == 0) { item->SetEnabled(false); } else if ((ref->runMode() < 1) && (ref->group()->runMode() > 0)) { item->SetMarked(true); } menu->AddItem(subMenu); subMenu->SetTargetForItems(view()); // [c.lenz 24dec99] hide rarely used commands in a 'Advanced' submenu subMenu = new BMenu("Advanced"); subMenu->SetFont(be_plain_font); // [e.moon 5dec99] ad-hoc timesource support if(ref->kind() & B_TIME_SOURCE) { message = new BMessage(MediaRoutingView::M_NODE_START_TIME_SOURCE); message->AddInt32("nodeID", ref->id()); subMenu->AddItem(new BMenuItem( "Start time source", message)); message = new BMessage(MediaRoutingView::M_NODE_START_TIME_SOURCE); message->AddInt32("nodeID", ref->id()); subMenu->AddItem(new BMenuItem( "Stop time source", message)); } // [c.lenz 24dec99] support for BControllable::StartControlPanel() if(ref->kind() & B_CONTROLLABLE) { if (subMenu->CountItems() > 0) subMenu->AddSeparatorItem(); message = new BMessage(MediaRoutingView::M_NODE_START_CONTROL_PANEL); subMenu->AddItem(new BMenuItem("Start Control Panel", message, 'P', B_COMMAND_KEY | B_SHIFT_KEY)); } // [em 1feb00] group tweaks if(ref->group()) { message = new BMessage(MediaRoutingView::M_GROUP_SET_LOCKED); message->AddInt32("groupID", ref->group()->id()); bool isLocked = (ref->group()->groupFlags() & NodeGroup::GROUP_LOCKED); message->AddBool("locked", !isLocked); if (subMenu->CountItems() > 0) subMenu->AddSeparatorItem(); subMenu->AddItem( new BMenuItem( isLocked ? "Unlock group" : "Lock group", message)); } if (subMenu->CountItems() > 0) { menu->AddItem(subMenu); subMenu->SetTargetForItems(view()); } menu->SetTargetForItems(view()); view()->ConvertToScreen(&point); point -= BPoint(1.0, 1.0); menu->Go(point, true, true, true); }
void MainWin::ShowContextMenu(const BPoint &screen_point) { printf("Show context menu\n"); BPopUpMenu *menu = new BPopUpMenu("context menu", false, false); BMenuItem *item; menu->AddItem(new BMenuItem(B_TRANSLATE("Scale to native size"), new BMessage(M_SCALE_TO_NATIVE_SIZE), 'N', B_COMMAND_KEY)); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Full screen"), new BMessage(M_TOGGLE_FULLSCREEN), 'F', B_COMMAND_KEY)); item->SetMarked(fIsFullscreen); menu->AddSeparatorItem(); menu->AddItem(item = new BMenuItem(B_TRANSLATE("No menu"), new BMessage(M_TOGGLE_NO_MENU), 'M', B_COMMAND_KEY)); item->SetMarked(fNoMenu); menu->AddItem(item = new BMenuItem(B_TRANSLATE("No border"), new BMessage(M_TOGGLE_NO_BORDER), 'B', B_COMMAND_KEY)); item->SetMarked(fNoBorder); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Always on top"), new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T', B_COMMAND_KEY)); item->SetMarked(fAlwaysOnTop); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Keep aspect ratio"), new BMessage(M_TOGGLE_KEEP_ASPECT_RATIO), 'K', B_COMMAND_KEY)); item->SetMarked(fKeepAspectRatio); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new BMessage(M_FILE_QUIT), 'Q', B_COMMAND_KEY)); menu->AddSeparatorItem(); const char* pixel_aspect = "pixel aspect ratio"; BString str1 = pixel_aspect; str1 << " 1.00000:1"; menu->AddItem(new BMenuItem(str1.String(), new BMessage(M_ASPECT_100000_1))); BString str2 = pixel_aspect; str2 << " 1.06666:1"; menu->AddItem(new BMenuItem(str2.String(), new BMessage(M_ASPECT_106666_1))); BString str3 = pixel_aspect; str3 << " 1.09091:1"; menu->AddItem(new BMenuItem(str3.String(), new BMessage(M_ASPECT_109091_1))); BString str4 = pixel_aspect; str4 << " 1.41176:1"; menu->AddItem(new BMenuItem(str4.String(), new BMessage(M_ASPECT_141176_1))); menu->AddItem(new BMenuItem(B_TRANSLATE( "force 720 x 576, display aspect 4:3"), new BMessage(M_ASPECT_720_576))); menu->AddItem(new BMenuItem(B_TRANSLATE( "force 704 x 576, display aspect 4:3"), new BMessage(M_ASPECT_704_576))); menu->AddItem(new BMenuItem(B_TRANSLATE( "force 544 x 576, display aspect 4:3"), new BMessage(M_ASPECT_544_576))); menu->SetTargetForItems(this); BRect r(screen_point.x - 5, screen_point.y - 5, screen_point.x + 5, screen_point.y + 5); menu->Go(screen_point, true, true, r, true); }
void PadView::DisplayMenu(BPoint where, LaunchButton* button) const { MainWindow* window = dynamic_cast<MainWindow*>(Window()); if (window == NULL) return; LaunchButton* nearestButton = button; if (!nearestButton) { // find the nearest button for (int32 i = 0; (nearestButton = ButtonAt(i)); i++) { if (nearestButton->Frame().top > where.y) break; } } BPopUpMenu* menu = new BPopUpMenu(B_TRANSLATE("launch popup"), false, false); // add button BMessage* message = new BMessage(MSG_ADD_SLOT); message->AddPointer("be:source", (void*)nearestButton); BMenuItem* item = new BMenuItem(B_TRANSLATE("Add button here"), message); item->SetTarget(window); menu->AddItem(item); // button options if (button) { // clear button message = new BMessage(MSG_CLEAR_SLOT); message->AddPointer("be:source", (void*)button); item = new BMenuItem(B_TRANSLATE("Clear button"), message); item->SetTarget(window); menu->AddItem(item); // remove button message = new BMessage(MSG_REMOVE_SLOT); message->AddPointer("be:source", (void*)button); item = new BMenuItem(B_TRANSLATE("Remove button"), message); item->SetTarget(window); menu->AddItem(item); // Open containing folder button if (button->Ref() != NULL) { message = new BMessage(MSG_OPEN_CONTAINING_FOLDER); message->AddPointer("be:source", (void*)button); item = new BMenuItem(B_TRANSLATE("Open containing folder"), message); item->SetTarget(window); menu->AddItem(item); } // set button description if (button->Ref()) { message = new BMessage(MSG_SET_DESCRIPTION); message->AddPointer("be:source", (void*)button); item = new BMenuItem(B_TRANSLATE("Set description"B_UTF8_ELLIPSIS), message); item->SetTarget(window); menu->AddItem(item); } } menu->AddSeparatorItem(); // window settings BMenu* settingsM = new BMenu(B_TRANSLATE("Settings")); settingsM->SetFont(be_plain_font); const char* toggleLayoutLabel; if (fButtonLayout->Orientation() == B_HORIZONTAL) toggleLayoutLabel = B_TRANSLATE("Vertical layout"); else toggleLayoutLabel = B_TRANSLATE("Horizontal layout"); item = new BMenuItem(toggleLayoutLabel, new BMessage(MSG_TOGGLE_LAYOUT)); item->SetTarget(this); settingsM->AddItem(item); BMenu* iconSizeM = new BMenu(B_TRANSLATE("Icon size")); for (uint32 i = 0; i < sizeof(kIconSizes) / sizeof(uint32); i++) { uint32 iconSize = kIconSizes[i]; message = new BMessage(MSG_SET_ICON_SIZE); message->AddInt32("size", iconSize); BString label; label << iconSize << " x " << iconSize; item = new BMenuItem(label.String(), message); item->SetTarget(this); item->SetMarked(IconSize() == iconSize); iconSizeM->AddItem(item); } settingsM->AddItem(iconSizeM); item = new BMenuItem(B_TRANSLATE("Ignore double-click"), new BMessage(MSG_SET_IGNORE_DOUBLECLICK)); item->SetTarget(this); item->SetMarked(IgnoreDoubleClick()); settingsM->AddItem(item); uint32 what = window->Look() == B_BORDERED_WINDOW_LOOK ? MSG_SHOW_BORDER : MSG_HIDE_BORDER; item = new BMenuItem(B_TRANSLATE("Show window border"), new BMessage(what)); item->SetTarget(window); item->SetMarked(what == MSG_HIDE_BORDER); settingsM->AddItem(item); item = new BMenuItem(B_TRANSLATE("Auto-raise"), new BMessage(MSG_TOGGLE_AUTORAISE)); item->SetTarget(window); item->SetMarked(window->AutoRaise()); settingsM->AddItem(item); item = new BMenuItem(B_TRANSLATE("Show on all workspaces"), new BMessage(MSG_SHOW_ON_ALL_WORKSPACES)); item->SetTarget(window); item->SetMarked(window->ShowOnAllWorkspaces()); settingsM->AddItem(item); menu->AddItem(settingsM); menu->AddSeparatorItem(); // pad commands BMenu* padM = new BMenu(B_TRANSLATE("Pad")); padM->SetFont(be_plain_font); // new pad item = new BMenuItem(B_TRANSLATE("New"), new BMessage(MSG_ADD_WINDOW)); item->SetTarget(be_app); padM->AddItem(item); // new pad item = new BMenuItem(B_TRANSLATE("Clone"), new BMessage(MSG_ADD_WINDOW)); item->SetTarget(window); padM->AddItem(item); padM->AddSeparatorItem(); // close item = new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_QUIT_REQUESTED)); item->SetTarget(window); padM->AddItem(item); menu->AddItem(padM); // app commands BMenu* appM = new BMenu(B_TRANSLATE_SYSTEM_NAME("LaunchBox")); appM->SetFont(be_plain_font); // quit item = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED)); item->SetTarget(be_app); appM->AddItem(item); menu->AddItem(appM); // finish popup menu->SetAsyncAutoDestruct(true); menu->SetFont(be_plain_font); where = ConvertToScreen(where); BRect mouseRect(where, where); mouseRect.InsetBy(-4.0, -4.0); menu->Go(where, true, false, mouseRect, true); }
PrefsWindow::PrefsWindow(BRect frame) : BWindow(frame, TR("Program settings"), B_TITLED_WINDOW, B_NOT_V_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { AddShortcut('1', B_COMMAND_KEY, new BMessage(M_SET_TAB_0)); AddShortcut('2', B_COMMAND_KEY, new BMessage(M_SET_TAB_1)); // general fProjectFolder = new PathBox("projectfolder", gProjectPath.GetFullPath(), ""); fProjectFolder->MakeValidating(true); SetToolTip(fProjectFolder, TR("The default path for new projects.")); fShowProjectFolder = new BCheckBox("showfolder", TR("Show project folder on open"), new BMessage); SetToolTip(fShowProjectFolder, TR("When checked, a project's folder is " "shown in Tracker when it is opened.")); if (gShowFolderOnOpen) fShowProjectFolder->SetValue(B_CONTROL_ON); fDontAddHeaders = new BCheckBox("dontaddheaders", TR("Omit header files from projects"), NULL); SetToolTip(fDontAddHeaders, TR("If checked, header files are not automatically " "added to projects.")); if (gDontManageHeaders) fDontAddHeaders->SetValue(B_CONTROL_ON); fSlowBuilds = new BCheckBox("slowbuilds", TR("Use single thread"), NULL); SetToolTip(fSlowBuilds, TR("Build with just one thread instead of one thread " "per processor")); if (gSingleThreadedBuild) fSlowBuilds->SetValue(B_CONTROL_ON); fCCache = new BCheckBox("ccache", TR("Use ccache to build faster"), NULL); SetToolTip(fCCache, TR("Compiler caching is another way to speed up builds")); if (gCCacheAvailable) { if (gUseCCache) fCCache->SetValue(B_CONTROL_ON); } else { BString label = fCCache->Label(); label << " -- " << TR("unavailable"); fCCache->SetLabel(label.String()); fCCache->SetEnabled(false); } fFastDep = new BCheckBox("fastdep", TR("Use fastdep dependency checker"), NULL); SetToolTip(fFastDep, TR("Use the fastdep dependency checker instead of gcc")); if (gFastDepAvailable) { if (gUseFastDep) fFastDep->SetValue(B_CONTROL_ON); } else { BString label = fFastDep->Label(); label << " -- " << TR("unavailable"); fFastDep->SetLabel(label.String()); fFastDep->SetEnabled(false); } BBox* buildBox = new BBox(B_FANCY_BORDER, BLayoutBuilder::Group<>(B_VERTICAL, 0) .Add(fSlowBuilds) .Add(fCCache) .Add(fFastDep) .SetInsets(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING, B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING) .View()); buildBox->SetLabel(TR("Build")); fAutoSyncModules = new BCheckBox("autosync", TR("Automatically synchronize modules"), NULL); SetToolTip(fAutoSyncModules, TR("Automatically synchronize modules in your " "projects with the those in the code library")); if (gAutoSyncModules) fAutoSyncModules->SetValue(B_CONTROL_ON); fBackupFolder = new PathBox("backupfolder", gBackupPath.GetFullPath(), ""); fBackupFolder->MakeValidating(true); SetToolTip(fBackupFolder, TR("Sets the location for project backups")); fTabs[0] = BLayoutBuilder::Grid<>(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING) .Add(new BStringView("projects folder label", TR("Projects folder:")), 0, 0) .Add(fProjectFolder, 1, 0) .AddGroup(B_VERTICAL, 0.0f, 1, 1) .Add(fShowProjectFolder) .Add(fDontAddHeaders) .End() .Add(buildBox, 1, 2) .Add(fAutoSyncModules, 1, 3) .Add(new BStringView("backups folder label", TR("Backups folder:")), 0, 4) .Add(fBackupFolder, 1, 4) .SetInsets(B_USE_DEFAULT_SPACING) .View(); fTabs[0]->SetName(TR("General")); fTabs[0]->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); #ifndef BUILD_CODE_LIBRARY fAutoSyncModules->Hide(); #endif // source control BPopUpMenu* scmMenu = new BPopUpMenu("SCM Chooser"); scmMenu->AddItem(new BMenuItem(TR("None"), NULL)); scmMenu->AddSeparatorItem(); scmMenu->AddItem(new BMenuItem(TR("Git"), NULL)); scmMenu->AddItem(new BMenuItem(TR("Mercurial"), NULL)); scmMenu->AddItem(new BMenuItem(TR("Subversion"), NULL)); fSCMChooser = new BMenuField("scmchooser", TR("Preferred source control:"), scmMenu); #ifdef DISABLE_GIT_SUPPORT scmMenu->ItemAt(2)->SetEnabled(false); #endif BMenuItem* marked = scmMenu->ItemAt(gDefaultSCM); if (marked != NULL) marked->SetMarked(true); else scmMenu->ItemAt(0)->SetMarked(true); if (!marked->IsEnabled()) { // if the default SCM is disabled unmark it and mark the first one that // is enabled. marked->SetMarked(false); for (int32 i = 0; i < scmMenu->CountItems(); i++) { if (scmMenu->ItemAt(i)->IsEnabled()) { scmMenu->ItemAt(i)->SetMarked(true); break; } } } fSVNRepoFolder = new PathBox("svnrepofolder", gSVNRepoPath.GetFullPath(), ""); fSVNRepoFolder->MakeValidating(true); SetToolTip(fSVNRepoFolder, TR("Sets the location for the 'server' side of " "local Subversion repositories.")); fTabs[1] = BLayoutBuilder::Group<>(B_VERTICAL) .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING) .Add(fSCMChooser->CreateLabelLayoutItem(), 0, 0) .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING, 1, 0) .Add(fSCMChooser->CreateMenuBarLayoutItem()) .AddGlue() .End() .Add(new BStringView("svn repo folder label", TR("Subversion repository folder:")), 0, 1) .Add(fSVNRepoFolder, 1, 1) .End() .AddGlue() .SetInsets(B_USE_DEFAULT_SPACING) .View(); fTabs[1]->SetName(TR("Source control")); fTabs[1]->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); // tab view fTabView = new BTabView("tabview", B_WIDTH_FROM_LABEL); fTabView->SetBorder(B_NO_BORDER); fTabView->AddTab(fTabs[0]); fTabView->AddTab(fTabs[1]); fTabView->Select(0L); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .AddStrut(B_USE_SMALL_SPACING) .Add(fTabView) .End(); fProjectFolder->MakeFocus(true); CenterOnScreen(); }
/***************************************************************************** * VLCVIew::MouseDown *****************************************************************************/ void VLCView::MouseDown(BPoint where) { VideoWindow* videoWindow = dynamic_cast<VideoWindow*>(Window()); BMessage* msg = Window()->CurrentMessage(); int32 clicks; uint32_t buttons; msg->FindInt32("clicks", &clicks); msg->FindInt32("buttons", (int32*)&buttons); if (videoWindow) { if (buttons & B_PRIMARY_MOUSE_BUTTON) { if (clicks == 2 && !fIgnoreDoubleClick) Window()->Zoom(); /* else videoWindow->ToggleInterfaceShowing(); */ fIgnoreDoubleClick = false; } else { if (buttons & B_SECONDARY_MOUSE_BUTTON) { // clicks will be 2 next time (if interval short enough) // even if the first click and the second // have not been made with the same mouse button fIgnoreDoubleClick = true; // launch popup menu BPopUpMenu *menu = new BPopUpMenu("context menu"); menu->SetRadioMode(false); // In full screen, add an item to show/hide the interface if( videoWindow->IsFullScreen() ) { BMenuItem *intfItem = new BMenuItem( _("Show Interface"), new BMessage(SHOW_INTERFACE) ); menu->AddItem( intfItem ); } // Resize to 50% BMenuItem *halfItem = new BMenuItem(_("50%"), new BMessage(RESIZE_50)); menu->AddItem(halfItem); // Resize to 100% BMenuItem *origItem = new BMenuItem(_("100%"), new BMessage(RESIZE_100)); menu->AddItem(origItem); // Resize to 200% BMenuItem *doubleItem = new BMenuItem(_("200%"), new BMessage(RESIZE_200)); menu->AddItem(doubleItem); // Toggle FullScreen BMenuItem *zoomItem = new BMenuItem(_("Fullscreen"), new BMessage(TOGGLE_FULL_SCREEN)); zoomItem->SetMarked(videoWindow->IsFullScreen()); menu->AddItem(zoomItem); menu->AddSeparatorItem(); // Toggle vSync BMenuItem *vsyncItem = new BMenuItem(_("Vertical Sync"), new BMessage(VERT_SYNC)); vsyncItem->SetMarked(videoWindow->IsSyncedToRetrace()); menu->AddItem(vsyncItem); // Correct Aspect Ratio BMenuItem *aspectItem = new BMenuItem(_("Correct Aspect Ratio"), new BMessage(ASPECT_CORRECT)); aspectItem->SetMarked(videoWindow->CorrectAspectRatio()); menu->AddItem(aspectItem); menu->AddSeparatorItem(); // Window Feel Items /* BMessage *winNormFeel = new BMessage(WINDOW_FEEL); winNormFeel->AddInt32("WinFeel", (int32_t)B_NORMAL_WINDOW_FEEL); BMenuItem *normWindItem = new BMenuItem("Normal Window", winNormFeel); normWindItem->SetMarked(videoWindow->Feel() == B_NORMAL_WINDOW_FEEL); menu->AddItem(normWindItem); BMessage *winFloatFeel = new BMessage(WINDOW_FEEL); winFloatFeel->AddInt32("WinFeel", (int32_t)B_FLOATING_APP_WINDOW_FEEL); BMenuItem *onTopWindItem = new BMenuItem("App Top", winFloatFeel); onTopWindItem->SetMarked(videoWindow->Feel() == B_FLOATING_APP_WINDOW_FEEL); menu->AddItem(onTopWindItem); BMessage *winAllFeel = new BMessage(WINDOW_FEEL); winAllFeel->AddInt32("WinFeel", (int32_t)B_FLOATING_ALL_WINDOW_FEEL); BMenuItem *allSpacesWindItem = new BMenuItem("On Top All Workspaces", winAllFeel); allSpacesWindItem->SetMarked(videoWindow->Feel() == B_FLOATING_ALL_WINDOW_FEEL); menu->AddItem(allSpacesWindItem);*/ BMessage *windowFeelMsg = new BMessage( WINDOW_FEEL ); bool onTop = videoWindow->Feel() == B_FLOATING_ALL_WINDOW_FEEL; window_feel feel = onTop ? B_NORMAL_WINDOW_FEEL : B_FLOATING_ALL_WINDOW_FEEL; windowFeelMsg->AddInt32( "WinFeel", (int32_t)feel ); BMenuItem *windowFeelItem = new BMenuItem( _("Stay On Top"), windowFeelMsg ); windowFeelItem->SetMarked( onTop ); menu->AddItem( windowFeelItem ); menu->AddSeparatorItem(); BMenuItem* screenShotItem = new BMenuItem( _("Take Screen Shot"), new BMessage( SCREEN_SHOT ) ); menu->AddItem( screenShotItem ); menu->SetTargetForItems( this ); ConvertToScreen( &where ); BRect mouseRect( where.x - 5, where.y - 5, where.x + 5, where.y + 5 ); menu->Go( where, true, false, mouseRect, true ); } } } fLastMouseMovedTime = mdate(); fCursorHidden = false; }