bool MWMDIManagerImpl::eventFilter(QObject *obj, QEvent *event) { QEvent::Type t = event->type(); if ( t == QEvent::Close) { QMdiSubWindow* qw = qobject_cast<QMdiSubWindow*>(obj); MDIItem* item = getMDIItem(qw); uiLog.trace(QString("Processing close window request for '%1'").arg(getWindowName(item))); //check if user really wants to close the window, ignore event if not if (!onCloseEvent(item->w)) { uiLog.trace(QString("Ignoring close window request for '%1'").arg(getWindowName(item))); event->ignore(); return true; } // here we sure that window will be closed emit si_windowClosing(item->w); if (item == mdiContentOwner) { // if 'current' window is closed -> clear MDI clearMDIContent(true); } items.removeAll(item); delete item; updateState(); } else if (t == QEvent::WindowStateChange) { QMdiSubWindow* qw = qobject_cast<QMdiSubWindow*>(obj); defaultIsMaximized = qw->isMaximized(); } return QObject::eventFilter(obj, event); }
void Mouse::updateMethod() { // Mouse position { GLFWwindow* win; int xpos, ypos; Window::getMousePos(win, xpos, ypos); State substate; substate.action = "mouse_position"; substate.value = Values({xpos, ypos}); substate.window = getWindowName(win); _state.emplace_back(std::move(substate)); } // Buttons events while (true) { GLFWwindow* win; int btn, action, mods; if (!Window::getMouseBtn(win, btn, action, mods)) break; State substate; switch (action) { default: continue; case GLFW_PRESS: substate.action = "mouse_press"; break; case GLFW_RELEASE: substate.action = "mouse_release"; break; } substate.value = Values({Value(btn)}); substate.modifiers = mods; substate.window = getWindowName(win); _state.emplace_back(std::move(substate)); } // Scrolling events while (true) { GLFWwindow* win; double xoffset, yoffset; if (!Window::getScroll(win, xoffset, yoffset)) break; State substate; substate.action = "mouse_scroll"; substate.value = Values({xoffset, yoffset}); substate.window = getWindowName(win); _state.emplace_back(std::move(substate)); } }
Minimap::Minimap() : // TRANSLATORS: mini map window name Window(_("Map"), Modal_false, nullptr, "map.xml"), mWidthProportion(0.5), mHeightProportion(0.5), mMapImage(nullptr), mMapOriginX(0), mMapOriginY(0), mCustomMapImage(false), mAutoResize(config.getBoolValue("autoresizeminimaps")) { setWindowName("Minimap"); mShow = config.getValueBool(getWindowName() + "Show", true); config.addListener("autoresizeminimaps", this); setDefaultSize(5, 25, 100, 100); // set this to false as the minimap window size is changed // depending on the map size setResizable(true); if (setupWindow) setupWindow->registerWindowForReset(this); setDefaultVisible(true); setSaveVisible(true); setStickyButton(true); setSticky(false); loadWindowState(); setVisible(fromBool(mShow, Visible), isSticky()); enableVisibleSound(true); }
QStringList MainWindow::allWindowNameList() { QStringList namelist; QList<void*> list = allWindowList(); for (int i=0; i<list.size(); i++) namelist << getWindowName(list[i]); return namelist; }
Minimap::~Minimap() { config.setValue(getWindowName() + "Show", mShow); config.removeListeners(this); CHECKLISTENERS deleteMapImage(); }
/** * Обновление выводимой информации. */ void EdgeDetector::update() { if (camera == NULL) return; cvWaitKey(33); cameraFrame = cvQueryFrame(camera); cvReleaseImage(&resultFrame); if (isGrayScaleEffect) { IplImage* tempFrame = cvCloneImage(cameraFrame); resultFrame = cvCreateImage(imageSize, cameraFrame->depth, CV_LOAD_IMAGE_GRAYSCALE); cvCvtColor(tempFrame, resultFrame, CV_BGR2GRAY); cvReleaseImage(&tempFrame); } else resultFrame = cvCloneImage(cameraFrame); if (!isOriginalEffect) { if (isStrokeEffect) { IplImage* tempFrame = cvCloneImage(resultFrame); tempFrame = edgeDetectOperator->applyOperator(tempFrame); cvSub(resultFrame, tempFrame, resultFrame); cvReleaseImage(&tempFrame); } else resultFrame = edgeDetectOperator->applyOperator(resultFrame); } if (isInverseEffect) { IplImage* tempFrame = cvCloneImage(resultFrame); cvNot(tempFrame, resultFrame); cvReleaseImage(&tempFrame); } cvShowImage(getWindowName(), resultFrame); }
Minimap::~Minimap() { config.setValue(getWindowName() + "Show", mShow); if (mMapImage) mMapImage->decRef(); }
GtkWidget * AP_UnixDialog_Lists::_constructWindow(void) { GtkWidget *contents; GtkWidget *vbox1; ConstructWindowName(); m_wMainWindow = abiDialogNew ( "list dialog", TRUE, getWindowName() ); vbox1 = gtk_dialog_get_content_area(GTK_DIALOG(m_wMainWindow)); contents = _constructWindowContents(); gtk_widget_show (contents); gtk_box_pack_start (GTK_BOX (vbox1), contents, FALSE, TRUE, 0); if(!isModal()) { m_wClose = abiAddStockButton ( GTK_DIALOG(m_wMainWindow), GTK_STOCK_CLOSE, BUTTON_CLOSE ) ; m_wApply = abiAddStockButton ( GTK_DIALOG(m_wMainWindow), GTK_STOCK_APPLY, BUTTON_APPLY ) ; } else { m_wApply = abiAddStockButton ( GTK_DIALOG(m_wMainWindow), GTK_STOCK_OK, BUTTON_OK ) ; m_wClose = abiAddStockButton ( GTK_DIALOG(m_wMainWindow), GTK_STOCK_CANCEL, BUTTON_CANCEL ) ; } gtk_widget_grab_default (m_wClose); _connectSignals (); return (m_wMainWindow); }
// Handles the printing/sending of the PRIVMSG message. void QueryWindow::handleSay(const QString &text) { QString textToPrint = GET_STRING("message.say") .arg(m_pSession->getNick()) .arg(text); printOutput(textToPrint, MESSAGE_IRC_SAY_SELF); m_pSession->sendPrivmsg(getWindowName(), text); }
// Handles the printing/sending of the PRIVMSG ACTION message. void QueryWindow::handleAction(const QString &text) { QString textToPrint = GET_STRING("message.action") .arg(m_pSession->getNick()) .arg(text); printOutput(textToPrint, MESSAGE_IRC_ACTION_SELF); m_pSession->sendAction(getWindowName(), text); }
void CtrlrPanelWindowManager::create(const CtrlrPanelWindowManager::WindowType window, const String &lastWindowState) { CtrlrChildWindow *w = createWindow(window); String windowState; if (w == nullptr) { return; } if (lastWindowState.isEmpty()) { if (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).isValid()) { windowState = managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).getProperty (Ids::uiChildWindowState); } } else { windowState = lastWindowState; } if (windowState != String::empty) { w->restoreWindowStateFromString(windowState); } else { w->centreWithSize(w->getWidth(), w->getHeight()); } if (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).isValid()) { if (w->getContent()) { /* restore the stored state in our global tree */ w->getContent()->restoreState (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).getChildWithName(Ids::uiChildWindowContentState)); /* remove the CONTENT state */ managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).removeAllChildren (nullptr); /* reattach the CONTENT state but with the valid data reference */ managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).addChild (w->getContent()->saveState(), -1, nullptr); } } }
void AP_UnixDialog_Lists::activate (void) { UT_ASSERT (m_wMainWindow); ConstructWindowName(); gtk_window_set_title (GTK_WINDOW (m_wMainWindow), getWindowName()); m_bDontUpdate = false; updateDialog(); gdk_window_raise (gtk_widget_get_window(m_wMainWindow)); }
void AP_UnixDialog_Lists::notifyActiveFrame(XAP_Frame * /*pFrame*/) { UT_ASSERT(m_wMainWindow); ConstructWindowName(); gtk_window_set_title (GTK_WINDOW (m_wMainWindow), getWindowName()); m_bDontUpdate = false; updateDialog(); previewExposed(); }
void CtrlrManagerWindowManager::create(const CtrlrManagerWindowManager::WindowType window, const String &lastWindowState) { CtrlrChildWindow *w = createWindow(window); String windowState; if (w == nullptr) { return; } if (lastWindowState.isEmpty()) { if (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).isValid()) { windowState = managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).getProperty (Ids::uiChildWindowState); } } else { windowState = lastWindowState; } if (windowState != String::empty) { w->restoreWindowStateFromString(windowState); } else { w->centreWithSize(w->getWidth(), w->getHeight()); } if (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).isValid()) { if (w->getContent()) { w->getContent()->restoreState (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).getChildWithName(Ids::uiChildWindowContentState)); } } }
void CtrlrManagerWindowManager::windowChanged(CtrlrChildWindow *windowThatChanged) { CtrlrChildWindowContent *c = windowThatChanged->getContent(); if (c == 0) return; CtrlrManagerWindowManager::WindowType window = (CtrlrManagerWindowManager::WindowType) c->getType(); if (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).isValid()) { managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).setProperty (Ids::uiChildWindowState, getWindow(window)->getWindowStateAsString(), 0); } else { ValueTree windowTree(Ids::uiChildWindow); windowTree.setProperty (Ids::uiChildWindowName, getWindowName(window), 0); windowTree.setProperty (Ids::uiChildWindowState, getWindow(window)->getWindowStateAsString(), 0); managerTree.addChild(windowTree,-1,0); windowTree.addChild (c->saveState(), -1, 0); } }
void HSV::showControl() { cv::namedWindow(getWindowName(), cv::WINDOW_NORMAL); cv::createTrackbar("LOW_H", getWindowName(), &lowH, 255); cv::createTrackbar("HIGH_H", getWindowName(), &highH, 255); cv::createTrackbar("LOW_S", getWindowName(), &lowS, 255); cv::createTrackbar("HIGH_S", getWindowName(), &highS, 255); cv::createTrackbar("LOW_V", getWindowName(), &lowV, 255); cv::createTrackbar("HIGH_V", getWindowName(), &highV, 255); }
void QueryWindow::onNumericMessage(Event *pEvent) { Message msg = DCAST(MessageEvent, pEvent)->getMessage(); switch(msg.m_command) { case 401: // ERR_NOSUCKNICK case 404: // ERR_CANNOTSENDTOCHAN { // msg.m_params[0]: my nick // msg.m_params[1]: nick/channel // msg.m_params[2]: "No such nick/channel" if(msg.m_params[1].compare(getWindowName(), Qt::CaseInsensitive) == 0) printOutput(getNumericText(msg), MESSAGE_IRC_NUMERIC); } } }
Minimap::Minimap(): Window(_("Map")), mMapImage(0), mWidthProportion(0.5), mHeightProportion(0.5) { setWindowName("MiniMap"); mShow = config.getValue(getWindowName() + "Show", true); setDefaultSize(5, 25, 100, 100); // set this to false as the minimap window size is changed //depending on the map size setResizable(false); setDefaultVisible(true); setSaveVisible(true); setStickyButton(true); setSticky(false); loadWindowState(); setVisible(mShow, isSticky()); }
LRESULT CALLBACK KeyboardProc(_In_ int nCode, _In_ WPARAM wParam, _In_ LPARAM lParam) { KBDLLHOOKSTRUCT *hookInfo; if (nCode == HC_ACTION) { setModifier(nCode, wParam, lParam); hookInfo = (KBDLLHOOKSTRUCT*)lParam; Key key(gVirtualKeyCode[hookInfo->vkCode][clt.getMod()], hookInfo->vkCode); Modifier mod(clt.getCtrl(), clt.getAlt(), clt.getShift(), clt.getCapsLock()); eEventType etype; std::string winName = getWindowName(); if (wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN) etype = Pressed; else if (wParam == WM_KEYUP || wParam == WM_SYSKEYUP) etype = Released; clt.m_itime.now(); KeyboardEvent *kbEv = new KeyboardEvent(key, mod, etype, clt.m_itime.get_second(), clt.m_itime.get_nano(), winName); clt.addEvent(kbEv); } return (CallNextHookEx(NULL, nCode, wParam, lParam)); }
InventoryWindow::InventoryWindow(Inventory *const inventory) : Window("Inventory", Modal_false, nullptr, "inventory.xml"), ActionListener(), KeyListener(), SelectionListener(), InventoryListener(), AttributeListener(), mInventory(inventory), mItems(new ItemContainer(this, mInventory)), mUseButton(nullptr), mDropButton(nullptr), mOutfitButton(nullptr), mShopButton(nullptr), mCartButton(nullptr), mEquipmentButton(nullptr), mStoreButton(nullptr), mRetrieveButton(nullptr), mInvCloseButton(nullptr), mWeightBar(nullptr), mSlotsBar(new ProgressBar(this, 0.0F, 100, 0, ProgressColorId::PROG_INVY_SLOTS, "slotsprogressbar.xml", "slotsprogressbar_fill.xml")), mFilter(nullptr), mSortModel(new SortListModelInv), mSortDropDown(new DropDown(this, mSortModel, false, Modal_false, this, "sort")), mNameFilter(new TextField(this, "", true, this, "namefilter", true)), mSortDropDownCell(nullptr), mNameFilterCell(nullptr), mFilterCell(nullptr), mSlotsBarCell(nullptr), mSplit(false), mCompactMode(false) { mSlotsBar->setColor(getThemeColor(ThemeColorId::SLOTS_BAR), getThemeColor(ThemeColorId::SLOTS_BAR_OUTLINE)); if (inventory) { setCaption(gettext(inventory->getName().c_str())); setWindowName(inventory->getName()); switch (inventory->getType()) { case InventoryType::Inventory: case InventoryType::Trade: case InventoryType::Npc: #ifdef EATHENA_SUPPORT case InventoryType::Vending: case InventoryType::Mail: case InventoryType::Craft: #endif case InventoryType::TypeEnd: default: mSortDropDown->setSelected(config.getIntValue( "inventorySortOrder")); break; case InventoryType::Storage: mSortDropDown->setSelected(config.getIntValue( "storageSortOrder")); break; #ifdef EATHENA_SUPPORT case InventoryType::Cart: mSortDropDown->setSelected(config.getIntValue( "cartSortOrder")); break; #endif }; } else { // TRANSLATORS: inventory window name setCaption(_("Inventory")); setWindowName("Inventory"); mSortDropDown->setSelected(0); } if (setupWindow && inventory && inventory->getType() != InventoryType::Storage) { setupWindow->registerWindowForReset(this); } setResizable(true); setCloseButton(true); setSaveVisible(true); setStickyButtonLock(true); if (mainGraphics->mWidth > 600) setDefaultSize(450, 310, ImagePosition::CENTER); else setDefaultSize(387, 307, ImagePosition::CENTER); setMinWidth(310); setMinHeight(179); addKeyListener(this); mItems->addSelectionListener(this); ScrollArea *const invenScroll = new ScrollArea(this, mItems, getOptionBool("showbackground"), "inventory_background.xml"); invenScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); const int size = config.getIntValue("fontSize"); mFilter = new TabStrip(this, "filter_" + getWindowName(), size + 16); mFilter->addActionListener(this); mFilter->setActionEventId("tag_"); StringVect tags = ItemDB::getTags(); const size_t sz = tags.size(); for (size_t f = 0; f < sz; f ++) mFilter->addButton(tags[f], tags[f], false); if (!mInventory) { invInstances.push_back(this); return; } switch (mInventory->getType()) { case InventoryType::Inventory: { // TRANSLATORS: inventory button const std::string equip = _("Equip"); // TRANSLATORS: inventory button const std::string use = _("Use"); // TRANSLATORS: inventory button const std::string unequip = _("Unequip"); std::string longestUseString = getFont()->getWidth(equip) > getFont()->getWidth(use) ? equip : use; if (getFont()->getWidth(longestUseString) < getFont()->getWidth(unequip)) { longestUseString = unequip; } mUseButton = new Button(this, longestUseString, "use", this); // TRANSLATORS: inventory button mDropButton = new Button(this, _("Drop..."), "drop", this); // TRANSLATORS: inventory outfits button mOutfitButton = new Button(this, _("O"), "outfit", this); // TRANSLATORS: inventory cart button mCartButton = new Button(this, _("C"), "cart", this); // TRANSLATORS: inventory shop button mShopButton = new Button(this, _("S"), "shop", this); // TRANSLATORS: inventory equipment button mEquipmentButton = new Button(this, _("E"), "equipment", this); mWeightBar = new ProgressBar(this, 0.0F, 100, 0, ProgressColorId::PROG_WEIGHT, "weightprogressbar.xml", "weightprogressbar_fill.xml"); mWeightBar->setColor(getThemeColor(ThemeColorId::WEIGHT_BAR), getThemeColor(ThemeColorId::WEIGHT_BAR_OUTLINE)); // TRANSLATORS: outfits button tooltip mOutfitButton->setDescription(_("Outfits")); // TRANSLATORS: cart button tooltip mCartButton->setDescription(_("Cart")); // TRANSLATORS: shop button tooltip mShopButton->setDescription(_("Shop")); // TRANSLATORS: equipment button tooltip mEquipmentButton->setDescription(_("Equipment")); place(0, 0, mWeightBar, 4); mSlotsBarCell = &place(4, 0, mSlotsBar, 4); mSortDropDownCell = &place(8, 0, mSortDropDown, 3); mFilterCell = &place(0, 1, mFilter, 10).setPadding(3); mNameFilterCell = &place(8, 1, mNameFilter, 3); place(0, 2, invenScroll, 11).setPadding(3); place(0, 3, mUseButton); place(1, 3, mDropButton); ContainerPlacer placer = getPlacer(10, 3); placer(0, 0, mShopButton); placer(1, 0, mOutfitButton); placer(2, 0, mCartButton); placer(3, 0, mEquipmentButton); updateWeight(); break; } case InventoryType::Storage: { // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); // TRANSLATORS: storage button mRetrieveButton = new Button(this, _("Retrieve"), "retrieve", this); // TRANSLATORS: storage button mInvCloseButton = new Button(this, _("Close"), "close", this); mSlotsBarCell = &place(0, 0, mSlotsBar, 6); mSortDropDownCell = &place(6, 0, mSortDropDown, 1); mFilterCell = &place(0, 1, mFilter, 7).setPadding(3); mNameFilterCell = &place(6, 1, mNameFilter, 1); place(0, 2, invenScroll, 7, 4); place(0, 6, mStoreButton); place(1, 6, mRetrieveButton); place(6, 6, mInvCloseButton); break; } #ifdef EATHENA_SUPPORT case InventoryType::Cart: { // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); // TRANSLATORS: storage button mRetrieveButton = new Button(this, _("Retrieve"), "retrieve", this); // TRANSLATORS: storage button mInvCloseButton = new Button(this, _("Close"), "close", this); mWeightBar = new ProgressBar(this, 0.0F, 100, 0, ProgressColorId::PROG_WEIGHT, "weightprogressbar.xml", "weightprogressbar_fill.xml"); mWeightBar->setColor(getThemeColor(ThemeColorId::WEIGHT_BAR), getThemeColor(ThemeColorId::WEIGHT_BAR_OUTLINE)); mSlotsBarCell = &place(3, 0, mSlotsBar, 3); mSortDropDownCell = &place(6, 0, mSortDropDown, 1); mFilterCell = &place(0, 1, mFilter, 7).setPadding(3); mNameFilterCell = &place(6, 1, mNameFilter, 1); place(0, 0, mWeightBar, 3); place(0, 2, invenScroll, 7, 4); place(0, 6, mStoreButton); place(1, 6, mRetrieveButton); place(6, 6, mInvCloseButton); break; } #endif default: case InventoryType::Trade: case InventoryType::Npc: #ifdef EATHENA_SUPPORT case InventoryType::Vending: case InventoryType::Mail: case InventoryType::Craft: #endif case InventoryType::TypeEnd: break; }; Layout &layout = getLayout(); layout.setRowHeight(2, LayoutType::SET); mInventory->addInventoyListener(this); invInstances.push_back(this); if (inventory->isMainInventory()) { updateDropButton(); } else { if (!invInstances.empty()) invInstances.front()->updateDropButton(); } loadWindowState(); enableVisibleSound(true); }
LRESULT CALLBACK MouseProc(_In_ int nCode, _In_ WPARAM wParam, _In_ LPARAM lParam) { MSLLHOOKSTRUCT *hookInfo; if (nCode >= HC_ACTION) { std::string name; hookInfo = (MSLLHOOKSTRUCT*)lParam; Position pos(hookInfo->pt.x, hookInfo->pt.y); eEventType etype; switch (wParam) { case WM_LBUTTONDOWN: name = "Left Button Down"; etype = Pressed; break; case WM_LBUTTONUP: name = "Left Button Up"; etype = Released; break; case WM_MOUSEMOVE: name = "Mouse Move"; etype = Move; break; case WM_MOUSEWHEEL: name = "Mouse Wheel (vertical scrolling)"; etype = Scroll; break; case WM_MOUSEHWHEEL: name = "Mouse Wheel (horizontal scrolling)"; etype = Scroll; break; case WM_RBUTTONDOWN: name = "Right Button Down"; etype = Pressed; break; case WM_RBUTTONUP: name = "Right Button Up"; etype = Released; break; } Button button(name, hookInfo->mouseData); clt.m_itime.now(); MouseEvent *msEv = new MouseEvent(button, pos, etype, clt.m_itime.get_second(), clt.m_itime.get_nano(), getWindowName()); clt.addEvent(msEv); } return (CallNextHookEx(NULL, nCode, wParam, lParam)); }
InventoryWindow::InventoryWindow(Inventory *const inventory): Window("Inventory", false, nullptr, "inventory.xml"), gcn::ActionListener(), gcn::KeyListener(), gcn::SelectionListener(), InventoryListener(), mInventory(inventory), mItems(new ItemContainer(this, mInventory)), mWeight(), mSlots(), mUseButton(nullptr), mDropButton(nullptr), mSplitButton(nullptr), mOutfitButton(nullptr), mShopButton(nullptr), mEquipmentButton(nullptr), mStoreButton(nullptr), mRetrieveButton(nullptr), mInvCloseButton(nullptr), mWeightBar(nullptr), mSlotsBar(new ProgressBar(this, 0.0f, 100, 0, Theme::PROG_INVY_SLOTS)), mFilter(nullptr), mSortModel(new SortListModelInv), mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort")), mNameFilter(new TextField(this, "", true, this, "namefilter", true)), mSortDropDownCell(nullptr), mNameFilterCell(nullptr), mFilterCell(nullptr), mSlotsBarCell(nullptr), mSplit(false), mCompactMode(false) { if (inventory) { setCaption(gettext(inventory->getName().c_str())); setWindowName(inventory->getName()); } else { // TRANSLATORS: inventory window name setCaption(_("Inventory")); setWindowName("Inventory"); } listen(CHANNEL_ATTRIBUTES); if (setupWindow) setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setSaveVisible(true); setStickyButtonLock(true); setDefaultSize(387, 307, ImageRect::CENTER); setMinWidth(310); setMinHeight(179); addKeyListener(this); mItems->addSelectionListener(this); gcn::ScrollArea *const invenScroll = new ScrollArea( mItems, getOptionBool("showbackground"), "inventory_background.xml"); invenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); const int size = config.getIntValue("fontSize"); mFilter = new TabStrip(this, "filter_" + getWindowName(), size + 16); mFilter->addActionListener(this); mFilter->setActionEventId("tag_"); mSortDropDown->setSelected(0); StringVect tags = ItemDB::getTags(); for (unsigned f = 0; f < tags.size(); f ++) mFilter->addButton(tags[f]); if (isMainInventory()) { // TRANSLATORS: inventory button const std::string equip = _("Equip"); // TRANSLATORS: inventory button const std::string use = _("Use"); // TRANSLATORS: inventory button const std::string unequip = _("Unequip"); std::string longestUseString = getFont()->getWidth(equip) > getFont()->getWidth(use) ? equip : use; if (getFont()->getWidth(longestUseString) < getFont()->getWidth(unequip)) { longestUseString = unequip; } mUseButton = new Button(this, longestUseString, "use", this); // TRANSLATORS: inventory button mDropButton = new Button(this, _("Drop..."), "drop", this); // TRANSLATORS: inventory button mSplitButton = new Button(this, _("Split"), "split", this); // TRANSLATORS: inventory button mOutfitButton = new Button(this, _("Outfits"), "outfit", this); // TRANSLATORS: inventory button mShopButton = new Button(this, _("Shop"), "shop", this); // TRANSLATORS: inventory button mEquipmentButton = new Button(this, _("Equipment"), "equipment", this); mWeightBar = new ProgressBar(this, 0.0f, 100, 0, Theme::PROG_WEIGHT); place(0, 0, mWeightBar, 4); mSlotsBarCell = &place(4, 0, mSlotsBar, 5); mSortDropDownCell = &place(9, 0, mSortDropDown, 2); mFilterCell = &place(0, 1, mFilter, 10).setPadding(3); mNameFilterCell = &place(9, 1, mNameFilter, 2); place(0, 2, invenScroll, 11).setPadding(3); place(0, 3, mUseButton); place(1, 3, mDropButton); place(8, 2, mSplitButton); place(8, 3, mShopButton); place(9, 3, mOutfitButton); place(10, 3, mEquipmentButton); updateWeight(); } else { // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); // TRANSLATORS: storage button mRetrieveButton = new Button(this, _("Retrieve"), "retrieve", this); // TRANSLATORS: storage button mInvCloseButton = new Button(this, _("Close"), "close", this); mSlotsBarCell = &place(0, 0, mSlotsBar, 6); mSortDropDownCell = &place(6, 0, mSortDropDown, 1); mFilterCell = &place(0, 1, mFilter, 7).setPadding(3); mNameFilterCell = &place(6, 1, mNameFilter, 1); place(0, 2, invenScroll, 7, 4); place(0, 6, mStoreButton); place(1, 6, mRetrieveButton); place(6, 6, mInvCloseButton); } Layout &layout = getLayout(); layout.setRowHeight(2, Layout::AUTO_SET); mInventory->addInventoyListener(this); invInstances.push_back(this); if (inventory && inventory->isMainInventory()) { updateDropButton(); } else { if (!invInstances.empty()) invInstances.front()->updateDropButton(); } loadWindowState(); enableVisibleSound(true); slotsChanged(mInventory); widgetResized(gcn::Event(nullptr)); if (!isMainInventory()) setVisible(true); }
/** * Инициализация камеры, окон и первоначальных параметров. */ void EdgeDetector::init(int deviceNumber) { camera = initCamera(deviceNumber); imageSize = getCameraImageSize(camera); cvNamedWindow(getWindowName(), CV_WINDOW_AUTOSIZE); }
CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, const int slot) : // TRANSLATORS: char create dialog name Window(_("New Character"), Modal_true, parent, "charcreate.xml"), ActionListener(), KeyListener(), mCharSelectDialog(parent), mNameField(new TextField(this, "")), // TRANSLATORS: char create dialog label mNameLabel(new Label(this, _("Name:"))), // TRANSLATORS: This is a narrow symbol used to denote 'next'. // You may change this symbol if your language uses another. // TRANSLATORS: char create dialog button mNextHairColorButton(new Button(this, _(">"), "nextcolor", this)), // TRANSLATORS: This is a narrow symbol used to denote 'previous'. // You may change this symbol if your language uses another. // TRANSLATORS: char create dialog button mPrevHairColorButton(new Button(this, _("<"), "prevcolor", this)), // TRANSLATORS: char create dialog label mHairColorLabel(new Label(this, _("Hair color:"))), mHairColorNameLabel(new Label(this, "")), // TRANSLATORS: char create dialog button mNextHairStyleButton(new Button(this, _(">"), "nextstyle", this)), // TRANSLATORS: char create dialog button mPrevHairStyleButton(new Button(this, _("<"), "prevstyle", this)), // TRANSLATORS: char create dialog label mHairStyleLabel(new Label(this, _("Hair style:"))), mHairStyleNameLabel(new Label(this, "")), mNextRaceButton(nullptr), mPrevRaceButton(nullptr), mRaceLabel(nullptr), mRaceNameLabel(nullptr), mNextLookButton(nullptr), mPrevLookButton(nullptr), mLookLabel(nullptr), mLookNameLabel(nullptr), // TRANSLATORS: char create dialog button mActionButton(new Button(this, _("^"), "action", this)), // TRANSLATORS: char create dialog button mRotateButton(new Button(this, _(">"), "rotate", this)), mAttributeSlider(), mAttributeLabel(), mAttributeValue(), mAttributesLeft(new Label(this, // TRANSLATORS: char create dialog label strprintf(_("Please distribute %d points"), 99))), // TRANSLATORS: char create dialog button mCreateButton(new Button(this, _("Create"), "create", this)), // TRANSLATORS: char create dialog button mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mPlayer(new Being(BeingId_zero, ActorType::Player, BeingTypeId_zero, nullptr)), mPlayerBox(new PlayerBox(this, mPlayer, "charcreate_playerbox.xml", "charcreate_selectedplayerbox.xml")), mGenderStrip(nullptr), mMaxPoints(0), mUsedPoints(0), mRace(CharDB::getMinRace()), mLook(0), mMinLook(CharDB::getMinLook()), mMaxLook(CharDB::getMaxLook()), mMinRace(CharDB::getMinRace()), mMaxRace(CharDB::getMaxRace()), mHairStyle(0), mHairColor(0), mSlot(slot), mDefaultGender(Gender::FEMALE), mGender(Gender::UNSPECIFIED), maxHairColor(CharDB::getMaxHairColor()), minHairColor(CharDB::getMinHairColor()), maxHairStyle(CharDB::getMaxHairStyle()), minHairStyle(CharDB::getMinHairStyle()), mAction(0), mDirection(0) { setStickyButtonLock(true); setSticky(true); setWindowName("NewCharacter"); const int w = 480; const int h = 350; setContentSize(w, h); mPlayer->setGender(Gender::MALE); const std::vector<int> &items = CharDB::getDefaultItems(); int i = 1; for (std::vector<int>::const_iterator it = items.begin(), it_end = items.end(); it != it_end; ++ it, i ++) { mPlayer->setSprite(i, *it); } if (!maxHairColor) maxHairColor = ColorDB::getHairSize(); if (!maxHairStyle) maxHairStyle = mPlayer->getNumOfHairstyles(); if (maxHairStyle) { mHairStyle = (static_cast<unsigned int>(rand()) % maxHairStyle) + minHairStyle; } else { mHairStyle = 0; } if (maxHairColor) { mHairColor = (static_cast<unsigned int>(rand()) % maxHairColor) + minHairColor; } else { mHairColor = 0; } mNameField->setMaximum(24); if (serverFeatures->haveRaceSelection()) { // TRANSLATORS: char create dialog button mNextRaceButton = new Button(this, _(">"), "nextrace", this); // TRANSLATORS: char create dialog button mPrevRaceButton = new Button(this, _("<"), "prevrace", this); // TRANSLATORS: char create dialog label mRaceLabel = new Label(this, _("Race:")); mRaceNameLabel = new Label(this, ""); } if (serverFeatures->haveLookSelection() && mMinLook < mMaxLook) { // TRANSLATORS: char create dialog button mNextLookButton = new Button(this, _(">"), "nextlook", this); // TRANSLATORS: char create dialog button mPrevLookButton = new Button(this, _("<"), "prevlook", this); // TRANSLATORS: char create dialog label mLookLabel = new Label(this, _("Look:")); mLookNameLabel = new Label(this, ""); } if (serverFeatures->haveCreateCharGender()) { const int size = config.getIntValue("fontSize"); mGenderStrip = new TabStrip(this, "gender_" + getWindowName(), size + 16); mGenderStrip->setPressFirst(false); mGenderStrip->addActionListener(this); mGenderStrip->setActionEventId("gender_"); // TRANSLATORS: one char size female character gender mGenderStrip->addButton(_("F"), "f", false); // TRANSLATORS: one char size male character gender mGenderStrip->addButton(_("M"), "m", false); // TRANSLATORS: one char size unknown character gender mGenderStrip->addButton(_("U"), "u", true); mGenderStrip->setVisible(Visible_true); add(mGenderStrip); mGenderStrip->setPosition(385, 130); mGenderStrip->setWidth(500); mGenderStrip->setHeight(50); } mPlayerBox->setWidth(74); mNameField->setActionEventId("create"); mNameField->addActionListener(this); mPlayerBox->setDimension(Rect(360, 0, 110, 90)); mActionButton->setPosition(385, 100); mRotateButton->setPosition(415, 100); mNameLabel->setPosition(5, 2); mNameField->setDimension( Rect(60, 2, 300, mNameField->getHeight())); const int leftX = 120; const int rightX = 300; const int labelX = 5; const int nameX = 145; int y = 30; mPrevHairColorButton->setPosition(leftX, y); mNextHairColorButton->setPosition(rightX, y); y += 5; mHairColorLabel->setPosition(labelX, y); mHairColorNameLabel->setPosition(nameX, y); y += 24; mPrevHairStyleButton->setPosition(leftX, y); mNextHairStyleButton->setPosition(rightX, y); y += 5; mHairStyleLabel->setPosition(labelX, y); mHairStyleNameLabel->setPosition(nameX, y); if (serverFeatures->haveLookSelection() && mMinLook < mMaxLook) { y += 24; if (mPrevLookButton) mPrevLookButton->setPosition(leftX, y); if (mNextLookButton) mNextLookButton->setPosition(rightX, y); y += 5; if (mLookLabel) mLookLabel->setPosition(labelX, y); if (mLookNameLabel) mLookNameLabel->setPosition(nameX, y); // 93 } if (serverFeatures->haveRaceSelection()) { y += 24; if (mPrevRaceButton) mPrevRaceButton->setPosition(leftX, y); if (mNextRaceButton) mNextRaceButton->setPosition(rightX, y); y += 5; if (mRaceLabel) mRaceLabel->setPosition(labelX, y); if (mRaceNameLabel) mRaceNameLabel->setPosition(nameX, y); } updateSliders(); setButtonsPosition(w, h); add(mPlayerBox); add(mNameField); add(mNameLabel); add(mNextHairColorButton); add(mPrevHairColorButton); add(mHairColorLabel); add(mHairColorNameLabel); add(mNextHairStyleButton); add(mPrevHairStyleButton); add(mHairStyleLabel); add(mHairStyleNameLabel); add(mActionButton); add(mRotateButton); if (serverFeatures->haveLookSelection() && mMinLook < mMaxLook) { add(mNextLookButton); add(mPrevLookButton); add(mLookLabel); add(mLookNameLabel); } if (serverFeatures->haveRaceSelection()) { add(mNextRaceButton); add(mPrevRaceButton); add(mRaceLabel); add(mRaceNameLabel); } add(mAttributesLeft); add(mCreateButton); add(mCancelButton); center(); setVisible(Visible_true); mNameField->requestFocus(); updateHair(); if (serverFeatures->haveRaceSelection()) updateRace(); if (serverFeatures->haveLookSelection() && mMinLook < mMaxLook) updateLook(); updatePlayer(); addKeyListener(this); }
bool WebPage::matchesWindowSelector(QString selector) { return (selector == getWindowName() || selector == mainFrame()->title() || selector == mainFrame()->url().toString() || selector == uuid()); }