void ProjucerLookAndFeel::drawComboBox (Graphics& g, int width, int height, bool, int, int, int, int, ComboBox& box) { const auto cornerSize = box.findParentComponentOfClass<ChoicePropertyComponent>() != nullptr ? 0.0f : 1.5f; Rectangle<int> boxBounds (0, 0, width, height); auto isChoiceCompChild = (box.findParentComponentOfClass<ChoicePropertyComponent>() != nullptr); if (isChoiceCompChild) { box.setColour (ComboBox::textColourId, findColour (widgetTextColourId)); g.setColour (findColour (widgetBackgroundColourId)); g.fillRect (boxBounds); auto arrowZone = boxBounds.removeFromRight (boxBounds.getHeight()).reduced (0, 2).toFloat(); g.setColour (Colours::black); g.fillPath (getChoiceComponentArrowPath (arrowZone)); } else { g.setColour (box.findColour (ComboBox::outlineColourId)); g.drawRoundedRectangle (boxBounds.toFloat().reduced (0.5f, 0.5f), cornerSize, 1.0f); auto arrowZone = boxBounds.removeFromRight (boxBounds.getHeight()).toFloat(); g.setColour (box.findColour (ComboBox::arrowColourId).withAlpha ((box.isEnabled() ? 0.9f : 0.2f))); g.fillPath (getArrowPath (arrowZone, 2, true, Justification::centred)); } }
bool ComboBoxListBox::onProcessMessage(Message* msg) { switch (msg->type()) { case kMouseUpMessage: m_comboBox->closeListBox(); return true; case kKeyDownMessage: if (hasFocus()) { KeyMessage* keymsg = static_cast<KeyMessage*>(msg); KeyScancode scancode = keymsg->scancode(); if (scancode == kKeySpace || scancode == kKeyEnter || scancode == kKeyEnterPad) { m_comboBox->closeListBox(); return true; } } break; } return ListBox::onProcessMessage(msg); }
//----------------------------------------------------------------------------- // Purpose: Called when the game dir combo box is changed //----------------------------------------------------------------------------- void CBaseMapsPage::OnTextChanged(Panel *panel, const char *text) { if (!Q_stricmp(text, m_szComboAllText)) { ComboBox *box = dynamic_cast<ComboBox *>(panel); if (box) { box->SetText(""); text = ""; } } // get filter settings from controls UpdateFilterSettings(); // apply settings ApplyGameFilters(); if (m_bFiltersVisible && (panel == m_pGameModeFilter || panel == m_pDifficultyFilter || panel == m_pMapFilter || panel == m_pMapLayoutFilter)) { // if they changed filter settings then cancel the refresh because the old list they are getting // will be for the wrong map or gametype, so stop and start a refresh StopRefresh(); //If the filters have changed, we'll want to send a new request with the new data //MOM_TODO: uncomment this: StartRefresh() } }
//----------------------------------------------------------------------------- // Purpose: Called when the game dir combo box is changed //----------------------------------------------------------------------------- void CBaseGamesPage::OnTextChanged(Panel *panel, const char *text) { if (!Q_stricmp(text, m_szComboAllText)) { ComboBox *box = dynamic_cast<ComboBox *>(panel); if (box) { box->SetText(""); text = ""; } } // get filter settings from controls UpdateFilterSettings(); // apply settings ApplyGameFilters(); if ( m_bFiltersVisible && ( panel == m_pGameFilter || panel == m_pLocationFilter ) ) { // if they changed games and/or region then cancel the refresh because the old list they are getting // will be for the wrong game, so stop and start a refresh StopRefresh(); GetNewServerList(); } }
//----------------------------------------------------------------------------- // Purpose: Handles changes to combo boxes //----------------------------------------------------------------------------- void CMOMSpectatorMenu::OnTextChanged(KeyValues *data) { Panel *panel = reinterpret_cast<Panel *>(data->GetPtr("panel")); ComboBox *box = dynamic_cast<ComboBox *>(panel); if (box == m_pConfigSettings) // don't change the text in the config setting combo { m_pConfigSettings->SetText("#Spec_Options"); } else if (box == m_pPlayerList) { KeyValues *kv = box->GetActiveItemUserData(); if (kv && GameResources()) { const char *player = kv->GetString("player"); int currentPlayerNum = GetSpectatorTarget(); const char *currentPlayerName = GameResources()->GetPlayerName(currentPlayerNum); if (!FStrEq(currentPlayerName, player)) { char command[128]; Q_snprintf(command, sizeof(command), "spec_player \"%s\"", player); engine->ClientCmd(command); } } } }
//============================================================================== void OldSchoolLookAndFeel::drawComboBox (Graphics& g, int width, int height, const bool isButtonDown, int buttonX, int buttonY, int buttonW, int buttonH, ComboBox& box) { g.fillAll (box.findColour (ComboBox::backgroundColourId)); g.setColour (box.findColour ((isButtonDown) ? ComboBox::buttonColourId : ComboBox::backgroundColourId)); g.fillRect (buttonX, buttonY, buttonW, buttonH); g.setColour (box.findColour (ComboBox::outlineColourId)); g.drawRect (0, 0, width, height); const float arrowX = 0.2f; const float arrowH = 0.3f; if (box.isEnabled()) { Path p; p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH), buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f, buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f); p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH), buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f, buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f); g.setColour (box.findColour ((isButtonDown) ? ComboBox::backgroundColourId : ComboBox::buttonColourId)); g.fillPath (p); } }
int main(int argc, char **argv) { QApplication app(argc,argv); ComboBox *window = new ComboBox(); app.setMainWidget(window); window->show(); return app.exec(); }
void SpriteSizeCommand::onExecute(Context* context) { const ContextReader reader(UIContext::instance()); // TODO use the context in sprite size command const Sprite* sprite(reader.sprite()); // load the window widget base::UniquePtr<Window> window(app::load_widget<Window>("sprite_size.xml", "sprite_size")); m_widthPx = app::find_widget<Entry>(window, "width_px"); m_heightPx = app::find_widget<Entry>(window, "height_px"); m_widthPerc = app::find_widget<Entry>(window, "width_perc"); m_heightPerc = app::find_widget<Entry>(window, "height_perc"); m_lockRatio = app::find_widget<CheckBox>(window, "lock_ratio"); ComboBox* method = app::find_widget<ComboBox>(window, "method"); Widget* ok = app::find_widget<Widget>(window, "ok"); m_widthPx->setTextf("%d", sprite->width()); m_heightPx->setTextf("%d", sprite->height()); m_lockRatio->Click.connect(Bind<void>(&SpriteSizeCommand::onLockRatioClick, this)); m_widthPx->EntryChange.connect(Bind<void>(&SpriteSizeCommand::onWidthPxChange, this)); m_heightPx->EntryChange.connect(Bind<void>(&SpriteSizeCommand::onHeightPxChange, this)); m_widthPerc->EntryChange.connect(Bind<void>(&SpriteSizeCommand::onWidthPercChange, this)); m_heightPerc->EntryChange.connect(Bind<void>(&SpriteSizeCommand::onHeightPercChange, this)); method->addItem("Nearest-neighbor"); method->addItem("Bilinear"); method->setSelectedItemIndex(get_config_int("SpriteSize", "Method", doc::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR)); window->remapWindow(); window->centerWindow(); load_window_pos(window, "SpriteSize"); window->setVisible(true); window->openWindowInForeground(); save_window_pos(window, "SpriteSize"); if (window->getKiller() == ok) { int new_width = m_widthPx->getTextInt(); int new_height = m_heightPx->getTextInt(); ResizeMethod resize_method = (ResizeMethod)method->getSelectedItemIndex(); set_config_int("SpriteSize", "Method", resize_method); { SpriteSizeJob job(reader, new_width, new_height, resize_method); job.startJob(); job.waitJob(); } ContextWriter writer(reader); update_screen_for_document(writer.document()); } }
void updateCameraList() { cameraSelectorComboBox.clear(); cameraSelectorComboBox.addItem ("No camera", 1); cameraSelectorComboBox.addSeparator(); StringArray cameras = CameraDevice::getAvailableDevices(); for (int i = 0; i < cameras.size(); ++i) cameraSelectorComboBox.addItem (cameras[i], i + 2); }
void OptDlg::OnExit(AWEvent* event) { ComboBox* cmb = (ComboBox*) event->window; if (!cmb || cmb->IsListShowing()) return; if (description) description->SetText(""); }
void updateStylesList (const Font& newFont) { const StringArray newStyles (newFont.getAvailableStyles()); if (newStyles != currentStyleList) { currentStyleList = newStyles; styleBox.clear(); styleBox.addItemList (newStyles, 1); styleBox.setSelectedItemIndex (0); } }
void DemoState::createPlainWindow() { detachChild("plainWindow"); plainWindow = new Window("plainWindow", Vector2(100, 100), Vector2(300, 200), ColourRGBA(ColourRGBA::CYAN)); plainWindow->setDraggable(true); plainWindow->setResizable(true); plainWindow->setGradiant(TO_BOTTOM, 4.0f); ComboBox* gradiants = new ComboBox("gradiantCombo", Vector2(120, 80), 120); gradiants->setOptions(5, "To bottom", "To top", "To left", "To right", "None"); gradiants->attachChild(new Label("gradLabel", "Gradiant:", 10, Vector2(-55, 10))); plainWindow->attachChild(gradiants); attachChild(plainWindow); }
void ComboBoxBase::execSyncV( FieldContainer &oFrom, ConstFieldMaskArg whichField, AspectOffsetStore &oOffsets, ConstFieldMaskArg syncMode, const UInt32 uiSyncInfo) { ComboBox *pThis = static_cast<ComboBox *>(this); pThis->execSync(static_cast<ComboBox *>(&oFrom), whichField, oOffsets, syncMode, uiSyncInfo); }
void LookAndFeel_E1::drawComboBox (Graphics& g, int width, int height, const bool isButtonDown, int buttonX, int buttonY, int buttonW, int buttonH, ComboBox& box) { g.fillAll (box.findColour (ComboBox::backgroundColourId)); const Colour buttonColour (box.findColour (ComboBox::buttonColourId)); if (box.isEnabled() && box.hasKeyboardFocus (false)) { g.setColour (buttonColour); g.drawRect (0, 0, width, height, 2); } else { g.setColour (box.findColour (ComboBox::outlineColourId)); g.drawRect (0, 0, width, height); } const float outlineThickness = box.isEnabled() ? (isButtonDown ? 1.2f : 0.5f) : 0.3f; Path buttonShape; buttonShape.addRectangle (buttonX + outlineThickness, buttonY + outlineThickness, buttonW - outlineThickness * 2.0f, buttonH - outlineThickness * 2.0f); drawButtonShape (g, buttonShape, buttonColour.withMultipliedSaturation (box.hasKeyboardFocus (true) ? 1.3f : 0.9f) .withMultipliedAlpha (box.isEnabled() ? 0.9f : 0.5f), (float) height); if (box.isEnabled()) { const float arrowX = 0.3f; const float arrowH = 0.2f; Path p; p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH), buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f, buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f); p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH), buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f, buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f); g.setColour (box.findColour (ComboBox::arrowColourId)); g.fillPath (p); } }
void CtrlrCombo::CtrlrComboLF::positionComboBoxText (ComboBox& box, Label& label) { int bw = owner.getProperty (Ids::uiComboButtonWidth); if ((bool)owner.getProperty (Ids::uiComboButtonWidthOverride) == true) { label.setBounds (1, 1, box.getWidth() - bw, box.getHeight() - 2); } else { label.setBounds (1, 1, box.getWidth() + 3 - box.getHeight(), box.getHeight() - 2); } label.setFont (getComboBoxFont (box)); }
Result processResultsFromSetupItems (Component& setupComp) { ComboBox* cb = dynamic_cast<ComboBox*> (setupComp.findChildWithID ("filesToCreate")); jassert (cb != nullptr); createMainCpp = createWindow = false; switch (cb->getSelectedItemIndex()) { case 0: createMainCpp = true; break; case 1: createMainCpp = createWindow = true; break; case 2: break; default: jassertfalse; break; } return Result::ok(); }
void CCDFrameInterface::ComboItemSelected(ComboBox& sender, int itemIndex) { if (sender == GUI->CCDDevice_Combo){ m_Device = sender.ItemText(itemIndex); if (ThePixInsightINDIInterface != 0) { PixInsightINDIInstance* pInstance = &ThePixInsightINDIInterface->instance; if (pInstance==NULL) return; INDIPropertyListItem CCDProp; // check for cooler connection (e.g. Atik cameras) GUI->Temperature_Timer.Start(); if (pInstance->getINDIPropertyItem(m_Device, "COOLER_CONNECTION", "CONNECT_COOLER", CCDProp)) { if(CCDProp.PropertyValue==String("OFF")){ INDINewPropertyListItem newPropertyListItem; newPropertyListItem.Device=m_Device; newPropertyListItem.Property = String("COOLER_CONNECTION"); newPropertyListItem.Element = String("CONNECT_COOLER"); newPropertyListItem.PropertyType = String("INDI_SWITCH"); newPropertyListItem.NewPropertyValue = String("ON"); pInstance->sendNewPropertyValue(newPropertyListItem,true); } } } } }
void OptionsCommand::onResetCheckedBg() { // Default values m_checked_bg->setSelectedItem((int)RenderEngine::CHECKED_BG_16X16); m_checked_bg_zoom->setSelected(true); m_checked_bg_color1->setColor(app::Color::fromRgb(128, 128, 128)); m_checked_bg_color2->setColor(app::Color::fromRgb(192, 192, 192)); }
static void createFileCreationOptionComboBox (Component& setupComp, OwnedArray<Component>& itemsCreated, const char** fileOptions) { ComboBox* c = new ComboBox(); itemsCreated.add (c); setupComp.addChildAndSetID (c, "filesToCreate"); c->addItemList (StringArray (fileOptions), 1); c->setSelectedId (1, false); Label* l = new Label (String::empty, "Files to Auto-Generate:"); l->attachToComponent (c, true); itemsCreated.add (l); c->setBounds ("parent.width / 2 + 160, 10, parent.width - 10, top + 22"); }
void ComboBoxListBox::onChangeSelectedItem() { ListBox::onChangeSelectedItem(); int index = getSelectedIndex(); if (isValidItem(index)) m_comboBox->setSelectedItemIndex(index); }
void CtrlrFontManager::fillCombo (ComboBox &comboToFill, const bool showOsFonts, const bool showBuiltInFonts, const bool showImportedFonts, const bool showJuceFonts) { comboToFill.clear(); int i = 0; if (showJuceFonts) { comboToFill.addSectionHeading ("OS Default fonts"); for (i=0; i<juceFonts.size(); i++) { comboToFill.addItem (juceFonts[i].getTypefaceName(), allFontCount + i + 1); } allFontCount += i; } if (showBuiltInFonts) { comboToFill.addSectionHeading ("Ctrlr Built-In fonts"); for (i=0; i<builtInFonts.size(); i++) { comboToFill.addItem (builtInFonts[i].getTypefaceName(), allFontCount + i + 1); } allFontCount += i; } if (showImportedFonts) { reloadImportedFonts(); comboToFill.addSectionHeading ("Imported fonts (from resources)"); for (i=0; i<importedFonts.size(); i++) { comboToFill.addItem (importedFonts[i].getTypefaceName(), allFontCount + i + 1); } allFontCount += i; } if (showOsFonts) { comboToFill.addSectionHeading ("OS Fonts"); for (i=0; i<osFonts.size(); i++) { comboToFill.addItem (osFonts[i].getTypefaceName(), allFontCount + i + 1); } allFontCount += i; } }
//----------------------------------------------------------------------------- // Purpose: Called when the game dir combo box is changed //----------------------------------------------------------------------------- void CBaseGamesPage::OnTextChanged(Panel *panel, const char *text) { if (!stricmp(text, "<All>")) { ComboBox *box = dynamic_cast<ComboBox *>(panel); if (box) { box->SetText(""); text = ""; } } // get filter settings from controls UpdateFilterSettings(); // apply settings ApplyFilters(); }
void ViewerState::createOptions() { Vector2 labelOffset = Vector2(12, 8); GUIElement* optionsContainer = new GUIElement("optionsContainer", Vector2(-490, -370)); ComboBox* modelBox = new ComboBox("modelCombo", Vector2(83, 210), 165); modelBox->setOptions(8, "Crate", "Cone", "Cube", "Deathstar", "Deer", "TARDIS", "Teapot", "Teddy"); modelBox->setSelected("Teapot"); modelBox->attachChild(new Label("modelLabel", "Model:", Vector2(-45, 11))); optionsContainer->attachChild(modelBox); p_textureCombo = new ComboBox("textureCombo", Vector2(103, 175), 165); p_textureCombo->attachChild(new Label("texLabel", "Texture:", Vector2(-55, 11))); p_textureCombo->setOptions(5, "Untextured", "Crate", "Cone", "Deer", "Derby"); optionsContainer->attachChild(p_textureCombo); p_toggleSpinning = new Checkbox("togSpinning", Vector2(0, 40)); p_toggleSpinning->attachChild(new Label("spLabel", "Idle spin", 9, labelOffset)); p_toggleSpinning->setTicked(true); Checkbox* p_toggleWireframe = new Checkbox("togWireframe", Vector2(0, 10)); p_toggleWireframe->attachChild(new Label("wfLabel", "Wireframe", 9, labelOffset)); Checkbox* p_toggleLighting = new Checkbox("togLighting", Vector2(0, 70)); p_toggleLighting->attachChild(new Label("lightLabel", "Lighting", 9, labelOffset)); p_toggleLighting->setTicked(true); p_toggleClockwise = new Checkbox("togClockwise", Vector2(0, 100)); p_toggleClockwise->attachChild(new Label("togClockLabel", "Draw clockwise", 9, labelOffset)); p_toggleClockwise->setTicked(true); Checkbox* p_toggleCulling = new Checkbox("togCulling", Vector2(0, 130)); p_toggleCulling->attachChild(new Label("cullLabel", "Back-face culling", 9, labelOffset)); p_toggleCulling->setTicked(true); optionsContainer->attachChild(p_toggleSpinning); optionsContainer->attachChild(p_toggleWireframe); optionsContainer->attachChild(p_toggleLighting); optionsContainer->attachChild(p_toggleClockwise); optionsContainer->attachChild(p_toggleCulling); attachChild(optionsContainer); }
void Meal(void* args) { //Disable buttons/settings cButton.SetText("End Meal"); cEditDelay.SetEnabled(0); cComboDate.SetEnabled(0); cComboRecord.SetEnabled(0); cComboSensitivity.SetEnabled(0); mScale.EditItem(ID_SCALE_ZERO, "&Zero", MF_DISABLED); //Get Variables char* tmpWait = new char[255]; cEditDelay.GetText(tmpWait); iMealWait = atoi(tmpWait); if (iMealWait==0) iMealWait = 10; mCompare = cComboRecord.GetSelectedItem(); mSensitivity = ((float)cComboSensitivity.GetSelectedItem()+1.0)/100.0; //Initialize the first weight AddCurrentValue(); //Activate the meal bMealActive = true; while(bMealActive) { //So if the scale is not stable, set the current time to when the scale was last stable if (!scale->IsStable()) uLastStable = time(0); if (time(0) - uLastStable >= iMealWait) { if (scale!=NULL && scale->IsConnected()) { if (fabs(scale->GetWeight() - fLastWeight) >= mSensitivity) { if ((mCompare == 0 || mCompare == 2) && scale->GetWeight() > fLastWeight) AddCurrentValue(); if ((mCompare == 1 || mCompare == 2) && scale->GetWeight() < fLastWeight) AddCurrentValue(); } } } //Sleep for .1 second Sleep(100); } //Check and see if the person saved the file CheckAndSave(); //Enable them cButton.SetText("New Meal"); cEditDelay.SetEnabled(1); cComboDate.SetEnabled(1); cComboRecord.SetEnabled(1); cComboSensitivity.SetEnabled(1); mScale.EditItem(ID_SCALE_ZERO, "&Zero", 0); }
void ObjectEditorWidget::onAddItemActivated() { if (! mCurrentObject) return; Interaction::InputEvent event = mWidgetToEvent.value(sender()); AddActionDialog dialog(event); dialog.exec(); if (dialog.result() == QDialog::Accepted && dialog.selectedAction()) { Action* action = dialog.selectedAction(); action->setSceneObject(mCurrentObject); action->setParent(mCurrentObject); mCurrentObject->appendEventAction(event, action); ComboBox *comboBox = qobject_cast<ComboBox*>(sender()); if(comboBox) { comboBox->addItem(action->icon(), action->toString(), qVariantFromValue(static_cast<QObject*>(action))); } } }
ComboBox* FormWindow::CreateComboBox(const char* lbl_text, int ax, int ay, int aw, int ah, DWORD aid, DWORD pid) { ComboBox* combo = 0; ActiveWindow* parent = this; if (pid) parent = FindControl(pid); combo = new(__FILE__,__LINE__) ComboBox(parent, ax, ay, aw, ah, aid); if (combo) { combo->SetForm(this); combo->SetLabel(lbl_text); if (!shown) combo->Hide(); } return combo; }
void comboBoxChanged (ComboBox*) override { // This is called when the user chooses a camera from the drop-down list. cameraDevice = nullptr; cameraPreviewComp = nullptr; recordingMovie = false; if (cameraSelectorComboBox.getSelectedId() > 1) { // Try to open the user's choice of camera.. cameraDevice = CameraDevice::openDevice (cameraSelectorComboBox.getSelectedId() - 2); // and if it worked, create a preview component for it.. if (cameraDevice != nullptr) addAndMakeVisible (cameraPreviewComp = cameraDevice->createViewerComponent()); } snapshotButton.setEnabled (cameraDevice != nullptr); recordMovieButton.setEnabled (cameraDevice != nullptr); resized(); }
DemoState::DemoState(const std::string& stateID, GUI* gui) : GUIState(stateID, gui) { gui->formatTooltip("fonts/copperplate_gothic.glf", 10, ColourRGBA::YELLOW); /* Create the options area */ GUIElement* optionsContainer = new GUIElement("optionsContainer", Vector2(-470, 200)); // Empty element, used as a container optionsContainer->attachChild(new Label("state_title", "Demonstration", 14, Vector2(0, 70))); optionsContainer->attachChild(new Label("state_subtitle", "Press some buttons!", 9, Vector2(0, 55))); ComboBox* cursorCombo = new ComboBox("cursorCombo", Vector2(105, 40), 200); cursorCombo->attachChild(new Label("cursorLabel", "Cursor:", Vector2(-55, 11))); cursorCombo->setOptions(6, "Standard", "Arrow", "Diamond sword", "Dragon scimitar", "Portal gun", "Sonic screwdriver"); optionsContainer->attachChild(cursorCombo); cursorCombo->getDescendant("option_Standard")->setToolTip("Bug: might not re-appear."); cursorCombo->getDescendant("option_Portal gun")->setToolTip("Animated!"); ComboBox* imageCombo = new ComboBox("imageCombo", Vector2(85, 0), 150); imageCombo->attachChild(new Label("imageLabel", "Image:", Vector2(-45, 11))); imageCombo->setOptions(5, "Bat-smiley", "Derby", "Rage", "Red John", "You tried"); imageCombo->setSelected("Red John"); optionsContainer->attachChild(imageCombo); createImage("demo/images/redjohn.tga"); Button* demoAnim = createNiceButton("demoAnim", Vector2(0, -58), "Animation"); demoAnim->setToolTip("Opens the animation window."); demoAnim->resize(128, 37); optionsContainer->attachChild(demoAnim); optionsContainer->attachChild(createNiceButton("demoEffects", Vector2(0, -102), "Effects")) ->setToolTip("Opens the effects window."); optionsContainer->attachChild(createNiceButton("demoRGBA", Vector2(0, -146), "Colour")) ->setToolTip("Opens an RGBA colour picker."); optionsContainer->attachChild(createNiceButton("demoChatbox", Vector2(0, -190), "Chatbox")) ->setToolTip("Demonstrates TextField and ScrollPane."); attachChild(optionsContainer); }
//============================================================================== void HoaLookAndFeel::drawComboBox (Graphics& g, int width, int height, const bool isButtonDown, int buttonX, int buttonY, int buttonW, int buttonH, ComboBox& box) { g.fillAll(box.findColour (ComboBox::backgroundColourId)); g.setColour(Colours::black); g.drawRoundedRectangle(0, 0, width, height, 5., 1.); g.drawLine(buttonX, buttonY, buttonX, buttonH); const float arrowX = 0.3f; const float arrowH = 0.2f; if (box.isEnabled()) { Path p; p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH), buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f, buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f); p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH), buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f, buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f); g.setColour(Colours::black); g.fillPath(p); } }
void MenuPanel::onLoseFocus(const EventArgs& args) { if(mDesc->menupanel_owner != NULL) { Ogre::String ownerClass = mDesc->menupanel_owner->getClass(); if(ownerClass == "Menu") { ToolBar* tb = dynamic_cast<Menu*>(mDesc->menupanel_owner)->getToolBar(); if(tb != NULL) { if(mDesc->guiManager->getLastClickedWidget() == NULL) tb->closeMenus(); else if(!mDesc->guiManager->getLastClickedWidget()->isComponentOf(tb) && !mDesc->guiManager->getLastClickedWidget()->isChildOf(tb)) tb->closeMenus(); } else { ContextMenu* cm = dynamic_cast<Menu*>(mDesc->menupanel_owner)->getContextMenu(); if((cm != NULL) && (cm->findWidget(mDesc->sheet->getWindowInFocus()->getName()) == NULL)) cm->hide(); } } else if(ownerClass == "ComboBox") { ComboBox* cb = dynamic_cast<ComboBox*>(mDesc->menupanel_owner); // If we click a widget other than the combobox, hide the list. // If we did click the combobox, the combobox will hide the list automatically. if(mDesc->guiManager->getLastClickedWidget() == NULL) cb->hideDropDownList(); else if(!mDesc->guiManager->getLastClickedWidget()->isComponentOf(cb)) cb->hideDropDownList(); } } }