bool EstateController::init() { if (!Layer::init()) { return false; } user_status = REGIST_KENCHIKU_CONSULT; CCSize winSize = CCDirector::sharedDirector()->getWinSize(); auto _bg2 = LayerColor::create(Color4B(0x11,0x11,0x11,0x11), winSize.width, winSize.height); this->addChild(_bg2); //シングルタップイベント取得 auto listener = EventListenerTouchOneByOne::create(); listener->setSwallowTouches(_swallowsTouches); //イベント関数の割り当て listener->onTouchBegan = CC_CALLBACK_2(EstateController::onTouchBegan, this); listener->onTouchMoved = CC_CALLBACK_2(EstateController::onTouchMoved, this); listener->onTouchEnded = CC_CALLBACK_2(EstateController::onTouchEnded, this); listener->onTouchCancelled = CC_CALLBACK_2(EstateController::onTouchCancelled, this); //イベントを追加する _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); showModal(); return true; }
void PolycodeFrame::showAssetBrowser(std::vector<String> extensions) { if(!projectManager->getActiveProject()) { return; } assetBrowser->setProject(projectManager->getActiveProject()); assetBrowser->setExtensions(extensions); showModal(assetBrowser); }
int Dialog::doModal() { Rect rc(0, 0, 200, 200); initialize(); create(L"Dialog", rc, WfxDispatcher::getMainWnd()); showModal(); return 1; }
FontDialogPanel::FontDialogPanel(QWidget *parent) : QWidget(parent) , m_fontFamilyBox(new QFontComboBox) , m_fontSizeBox(new QDoubleSpinBox) , m_noButtons(new QCheckBox(tr("Don't display OK/Cancel buttons"))) , m_dontUseNativeDialog(new QCheckBox(tr("Don't use native dialog"))) , m_scalableFilter(new QCheckBox(tr("Filter scalable fonts"))) , m_nonScalableFilter(new QCheckBox(tr("Filter non scalable fonts"))) , m_monospacedFilter(new QCheckBox(tr("Filter monospaced fonts"))) , m_proportionalFilter(new QCheckBox(tr("Filter proportional fonts"))) { // Options QGroupBox *optionsGroupBox = new QGroupBox(tr("Options"), this); QVBoxLayout *optionsLayout = new QVBoxLayout(optionsGroupBox); optionsLayout->addWidget(m_noButtons); optionsLayout->addWidget(m_dontUseNativeDialog); optionsLayout->addWidget(m_scalableFilter); optionsLayout->addWidget(m_nonScalableFilter); optionsLayout->addWidget(m_monospacedFilter); optionsLayout->addWidget(m_proportionalFilter); // Font QGroupBox *fontGroupBox = new QGroupBox(tr("Font"), this); QHBoxLayout *fontLayout = new QHBoxLayout(fontGroupBox); fontLayout->addWidget(m_fontFamilyBox); fontLayout->addWidget(m_fontSizeBox); m_fontSizeBox->setValue(QFont().pointSizeF()); // Buttons QGroupBox *buttonsGroupBox = new QGroupBox(tr("Show")); QVBoxLayout *buttonsLayout = new QVBoxLayout(buttonsGroupBox); addButton(tr("Exec modal"), buttonsLayout, this, SLOT(execModal())); addButton(tr("Show modal"), buttonsLayout, this, SLOT(showModal())); m_deleteModalDialogButton = addButton(tr("Delete modal"), buttonsLayout, this, SLOT(deleteModalDialog())); addButton(tr("Show non-modal"), buttonsLayout, this, SLOT(showNonModal())); m_deleteNonModalDialogButton = addButton(tr("Delete non-modal"), buttonsLayout, this, SLOT(deleteNonModalDialog())); addButton(tr("Restore defaults"), buttonsLayout, this, SLOT(restoreDefaults())); buttonsLayout->addStretch(); // Main layout QHBoxLayout *mainLayout = new QHBoxLayout(this); QVBoxLayout *leftLayout = new QVBoxLayout; leftLayout->addWidget(optionsGroupBox); leftLayout->addWidget(fontGroupBox); leftLayout->addStretch(); mainLayout->addLayout(leftLayout); mainLayout->addWidget(buttonsGroupBox); enableDeleteModalDialogButton(); enableDeleteNonModalDialogButton(); restoreDefaults(); }
bool Client::browseImpl(ServerDescription& d) { m_connectPushed = false; m_index = 0; showModal(m_osWindow); if (m_connectPushed) { d = m_serverArray[m_index]; } return m_connectPushed; }
ColorDialogPanel::ColorDialogPanel(QWidget *parent) : QWidget(parent) , m_colorComboBox(new QComboBox) , m_showAlphaChannel(new QCheckBox(tr("Show alpha channel"))) , m_noButtons(new QCheckBox(tr("Don't display OK/Cancel buttons"))) , m_dontUseNativeDialog(new QCheckBox(tr("Don't use native dialog"))) { // Options QGroupBox *optionsGroupBox = new QGroupBox(tr("Options"), this); QVBoxLayout *optionsLayout = new QVBoxLayout(optionsGroupBox); optionsLayout->addWidget(m_showAlphaChannel); optionsLayout->addWidget(m_noButtons); optionsLayout->addWidget(m_dontUseNativeDialog); // Color QGroupBox *colorGroupBox = new QGroupBox(tr("Color"), this); QVBoxLayout *colorLayout = new QVBoxLayout(colorGroupBox); colorLayout->addWidget(m_colorComboBox); m_colorComboBox->addItems(svgColorNames()); m_colorComboBox->setEditable(true); QAbstractItemModel *sourceModel = m_colorComboBox->model(); ColorProxyModel* proxyModel = new ColorProxyModel(m_colorComboBox); proxyModel->setSourceModel(sourceModel); sourceModel->setParent(proxyModel); m_colorComboBox->setModel(proxyModel); // Buttons QGroupBox *buttonsGroupBox = new QGroupBox(tr("Show")); QVBoxLayout *buttonsLayout = new QVBoxLayout(buttonsGroupBox); addButton(tr("Exec modal"), buttonsLayout, this, SLOT(execModal())); addButton(tr("Show modal"), buttonsLayout, this, SLOT(showModal())); m_deleteModalDialogButton = addButton(tr("Delete modal"), buttonsLayout, this, SLOT(deleteModalDialog())); addButton(tr("Show non-modal"), buttonsLayout, this, SLOT(showNonModal())); m_deleteNonModalDialogButton = addButton(tr("Delete non-modal"), buttonsLayout, this, SLOT(deleteNonModalDialog())); addButton(tr("Restore defaults"), buttonsLayout, this, SLOT(restoreDefaults())); buttonsLayout->addStretch(); // Main layout QHBoxLayout *mainLayout = new QHBoxLayout(this); QVBoxLayout *leftLayout = new QVBoxLayout; leftLayout->addWidget(optionsGroupBox); leftLayout->addWidget(colorGroupBox); leftLayout->addStretch(); mainLayout->addLayout(leftLayout); mainLayout->addWidget(buttonsGroupBox); enableDeleteModalDialogButton(); enableDeleteNonModalDialogButton(); restoreDefaults(); }
void GuiMenu::show(WidgetManager* manager, GuiWindow* superior, GuiControl* eventSource, const Vector2& position, bool modal, const GuiControl::Callback& actionCallback) { m_actionCallback = actionCallback; m_superior = superior; m_eventSource = eventSource; manager->add(this); // Clamp position to screen bounds OSWindow* osWindow = (superior != NULL) ? superior->window() : RenderDevice::lastRenderDeviceCreated->window(); const Vector2 high(osWindow->width() - m_rect.width(), osWindow->height() - m_rect.height()); Vector2 actualPos = position.min(high).max(Vector2(0,0)); moveTo(actualPos); manager->setFocusedWidget(this); if (modal) { showModal(superior); } else { setVisible(true); } }
void PolycodeFrame::handleEvent(Event *event) { if(event->getDispatcher() == currentFileSelector && event->getEventType() == "UIEvent") { PolycodeEditor *editor = editorManager->openEditors[currentFileSelector->getSelectedIndex()]; editorManager->setCurrentEditor(editor, false); showEditor(editor); } if(event->getDispatcher() == editorManager) { currentFileSelector->clearItems(); for(int i=0; i < editorManager->openEditors.size(); i++) { OSFileEntry entry(editorManager->openEditors[i]->getFilePath(), OSFileEntry::TYPE_FILE); if(editorManager->openEditors[i]->hasChanges()) { currentFileSelector->addComboItem("* " +entry.name); } else { currentFileSelector->addComboItem(entry.name); } if(editorManager->getCurrentEditor() == editorManager->openEditors[i]) { currentFileSelector->setSelectedIndex(i); } } } if(event->getDispatcher() == projectManager) { if(projectManager->getActiveProject()) { currentProjectTitle->setText(projectManager->getActiveProject()->getProjectName()); } else { if (projectManager->getProjectCount() == 0) { currentProjectTitle->setText(""); } } } if(event->getDispatcher() == aboutOKButton && event->getEventType() == "UIEvent") { hideModal(); } if(event->getDispatcher() == fileDialog && event->getEventType() == "UIEvent") { fileBrowserRoot->removeChild(fileDialog); fileDialogBlocker->visible = false; fileDialogBlocker->enabled = false; } if(event->getDispatcher() == CoreServices::getInstance()->getCore()->getInput()) { switch(event->getEventCode()) { case InputEvent::EVENT_MOUSEUP: if(isDragging) { if(editorHolder->currentEditor) { InputEvent *inputEvent = (InputEvent*) event; Number posX = inputEvent->mousePosition.x; Number posY = inputEvent->mousePosition.y; editorHolder->currentEditor->handleDroppedFile(draggedFile, posX, posY); } } isDragging = false; dragEntity->visible = false; break; case InputEvent::EVENT_MOUSEMOVE: if(isDragging) { dragEntity->setPosition(((InputEvent*)event)->mousePosition); } break; } } if(event->getDispatcher() == projectBrowser->treeContainer->getRootNode()) { switch (event->getEventCode()) { case UITreeEvent::DRAG_START_EVENT: { UITreeEvent *treeEvent = (UITreeEvent*) event; BrowserUserData *data = (BrowserUserData*)treeEvent->selection->getUserData(); draggedFile = data->fileEntry; dragLabel->setText(data->fileEntry.name); dragEntity->visible = true; isDragging = true; // printf("START DRAG: %s\n", data->fileEntry.name.c_str()); } break; } } if(event->getDispatcher() == modalChild) { if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLOSE_EVENT) { willHideModal = true; } } else { if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT && event->getDispatcher() == newProjectButton) { newProjectWindow->ResetForm(); showModal(newProjectWindow); } if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT && event->getDispatcher() == examplesButton) { newProjectWindow->ResetForm(); showModal(exampleBrowserWindow); } } }
void PolycodeFrame::handleEvent(Event *event) { if(event->getDispatcher() == CoreServices::getInstance()->getCore()->getInput()) { switch(event->getEventCode()) { case InputEvent::EVENT_MOUSEUP: if(isDragging) { if(editorHolder->currentEditor) { InputEvent *inputEvent = (InputEvent*) event; Number posX = inputEvent->mousePosition.x; Number posY = inputEvent->mousePosition.y; editorHolder->currentEditor->handleDroppedFile(draggedFile, posX, posY); } } isDragging = false; dragEntity->visible = false; break; case InputEvent::EVENT_MOUSEMOVE: if(isDragging) { dragEntity->setPosition(((InputEvent*)event)->mousePosition); } break; } } if(event->getDispatcher() == projectBrowser->treeContainer->getRootNode()) { switch (event->getEventCode()) { case UITreeEvent::DRAG_START_EVENT: { UITreeEvent *treeEvent = (UITreeEvent*) event; BrowserUserData *data = (BrowserUserData*)treeEvent->selection->getUserData(); draggedFile = data->fileEntry; dragLabel->setText(data->fileEntry.name); dragEntity->visible = true; isDragging = true; // printf("START DRAG: %s\n", data->fileEntry.name.c_str()); } break; } } if(event->getDispatcher() == modalChild) { if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLOSE_EVENT) { hideModal(); } } else { if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT && event->getDispatcher() == newProjectButton) { newProjectWindow->ResetForm(); showModal(newProjectWindow); } if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT && event->getDispatcher() == examplesButton) { newProjectWindow->ResetForm(); showModal(exampleBrowserWindow); } } }