//============================================================================== void DialogWindow::resized() { DocumentWindow::resized(); const KeyPress esc (KeyPress::escapeKey, 0, 0); if (escapeKeyTriggersCloseButton && getCloseButton() != nullptr && ! getCloseButton()->isRegisteredForShortcut (esc)) { getCloseButton()->addShortcut (esc); } }
//============================================================================== void EdoFileEditor::resized() { //[UserResized] Add your own custom resize handling here.. DocumentWindow::resized(); const KeyPress esc (KeyPress::escapeKey, 0, 0); if (getCloseButton() != 0 && ! getCloseButton()->isRegisteredForShortcut (esc)) { getCloseButton()->addShortcut (esc); } //[/UserResized] }
void DocumentWindow::lookAndFeelChanged() { int i; for (i = numElementsInArray (titleBarButtons); --i >= 0;) titleBarButtons[i] = 0; if (! isUsingNativeTitleBar()) { titleBarButtons[0] = ((requiredButtons & minimiseButton) != 0) ? getLookAndFeel().createDocumentWindowButton (minimiseButton) : 0; titleBarButtons[1] = ((requiredButtons & maximiseButton) != 0) ? getLookAndFeel().createDocumentWindowButton (maximiseButton) : 0; titleBarButtons[2] = ((requiredButtons & closeButton) != 0) ? getLookAndFeel().createDocumentWindowButton (closeButton) : 0; for (i = 0; i < 3; ++i) { if (titleBarButtons[i] != 0) { buttonListener.owner = this; titleBarButtons[i]->addButtonListener (&buttonListener); titleBarButtons[i]->setWantsKeyboardFocus (false); // (call the Component method directly to avoid the assertion in ResizableWindow) Component::addAndMakeVisible (titleBarButtons[i]); } } if (getCloseButton() != 0) { #if JUCE_MAC getCloseButton()->addShortcut (KeyPress (T('w'), ModifierKeys::commandModifier, 0)); #else getCloseButton()->addShortcut (KeyPress (KeyPress::F4Key, ModifierKeys::altModifier, 0)); #endif } } activeWindowStatusChanged(); ResizableWindow::lookAndFeelChanged(); }
static void task_title_setup (TaskTitle *title) { TaskTitlePrivate *priv = title->priv; priv->screen = wnck_screen_get_default (); priv->window = NULL; gtk_widget_add_events (GTK_WIDGET (title), GDK_ALL_EVENTS_MASK); priv->align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); gtk_alignment_set_padding (GTK_ALIGNMENT (priv->align), 0, 0, 6, 6); gtk_container_add (GTK_CONTAINER (title), priv->align); priv->grid = gtk_grid_new(); gtk_grid_set_row_spacing (GTK_GRID(priv->grid), 2); gtk_container_add (GTK_CONTAINER (priv->align), priv->grid); gtk_widget_set_no_show_all (priv->grid, TRUE); gtk_widget_show (priv->grid); //Prepare and show the title label priv->label = getTitleLabel(); gtk_grid_attach (GTK_GRID(priv->grid), priv->label, 0, 0, 1, 1); gtk_widget_show (priv->label); //Create the close button priv->button = getCloseButton (title); gtk_grid_attach (GTK_GRID(priv->grid), priv->button, 1, 0, 1, 1); gtk_widget_show (priv->button); g_signal_connect (GTK_WIDGET(title), "draw", G_CALLBACK (on_draw), title); // Prepare and add the logoff icon to the title GdkScreen *gdkscreen = gtk_widget_get_screen (GTK_WIDGET (title)); GtkIconTheme *theme = gtk_icon_theme_get_for_screen (gdkscreen); //this shows a little green exit icon, like the ones on emergency exits priv->quit_icon = gtk_icon_theme_load_icon ( theme, "gnome-logout", 16, 0, NULL ); priv->button_image = gtk_image_new_from_pixbuf (priv->quit_icon); gtk_container_add (GTK_CONTAINER (priv->button), priv->button_image); gtk_widget_show (priv->button_image); gtk_widget_set_tooltip_text (priv->button, _("Log off, switch user, lock screen or " "power down the computer") ); gtk_widget_set_tooltip_text (GTK_WIDGET (title), _("Home")); gtk_widget_add_events (GTK_WIDGET (title), GDK_ALL_EVENTS_MASK); g_signal_connect (priv->screen, "active-window-changed", G_CALLBACK (on_active_window_changed), title); g_signal_connect (title, "button-press-event", G_CALLBACK (on_button_press), NULL); }
CNrpBrowserWindow::CNrpBrowserWindow( gui::IGUIEnvironment* env, video::ITexture* texture, s32 id, core::position2di pos, core::dimension2du size ) : CNrpWindow( env, env->getRootGUIElement(), texture, id, core::recti( pos, size+core::dimension2du( 10, 25 ) ) ) { _ApplyViewerStyle( size, dynamic_cast< CImageGUISkin* >( Environment->getSkin() ) ); bringToFront( getCloseButton() ); setDraggable( true ); drop(); }
/************************************************************************* Initialises the Window based object ready for use. *************************************************************************/ void FrameWindow::initialiseComponents(void) { // get component windows Titlebar* titlebar = getTitlebar(); PushButton* closeButton = getCloseButton(); // configure titlebar titlebar->setDraggingEnabled(d_dragMovable); titlebar->setText(d_text); // bind handler to close button 'Click' event closeButton->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&CEGUI::FrameWindow::closeClickHandler, this)); performChildWindowLayout(); }
void DialogWindow::resized() { DocumentWindow::resized(); if (escapeKeyTriggersCloseButton) { if (Button* const close = getCloseButton()) { const KeyPress esc (KeyPress::escapeKey, 0, 0); if (! close->isRegisteredForShortcut (esc)) close->addShortcut (esc); } } }
StoreScreen::StoreScreen() : Panel(), mStoreInventoryIndex(-1) { setName("StoreScreen"); mInventoryRenderer = new InventoryRenderer(); mInventoryRenderer->setName("InventoryRenderer"); addChild(mInventoryRenderer); mInventoryRenderer->setOffset(-16.0f, 16.0f); mInventoryRenderer->setAnchorY(Y_BOTTOM); mInventoryRenderer->setParentAnchorY(Y_BOTTOM); setInteractive(true); mInventoryRenderer->setInteractive(true); updateStoreTitle(); getCloseButton()->setVisible(true); }
/************************************************************************* Initialises the Window based object ready for use. *************************************************************************/ void FrameWindow::initialiseComponents(void) { // get component windows Titlebar* titlebar = getTitlebar(); PushButton* closeButton = getCloseButton(); // configure titlebar titlebar->setDraggingEnabled(d_dragMovable); titlebar->setText(getText()); // ban some properties on components, since they are linked to settings // defined here. titlebar->banPropertyFromXML("Text"); titlebar->banPropertyFromXML("Visible"); titlebar->banPropertyFromXML("Disabled"); closeButton->banPropertyFromXML("Visible"); closeButton->banPropertyFromXML("Disabled"); // bind handler to close button 'Click' event closeButton->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&CEGUI::FrameWindow::closeClickHandler, this)); performChildWindowLayout(); }
/************************************************************************* Enables or disables the close button for the frame window. *************************************************************************/ void FrameWindow::setCloseButtonEnabled(bool setting) { Window* closebtn = getCloseButton(); closebtn->setEnabled(setting); closebtn->setVisible(setting); }
/************************************************************************* Return whether this close button for this window is enabled. *************************************************************************/ bool FrameWindow::isCloseButtonEnabled(void) const { return !getCloseButton()->isDisabled(); }