Пример #1
0
void Label::hideEditor (const bool discardCurrentEditorContents)
{
    if (editor != nullptr)
    {
        WeakReference<Component> deletionChecker (this);

        ScopedPointer<TextEditor> outgoingEditor (editor);

        editorAboutToBeHidden (outgoingEditor);

        const bool changed = (! discardCurrentEditorContents)
                               && updateFromTextEditorContents (*outgoingEditor);
        outgoingEditor = nullptr;
        repaint();

        if (changed)
            textWasEdited();

        if (deletionChecker != nullptr)
            exitModalState (0);

        if (changed && deletionChecker != nullptr)
            callChangeListeners();
    }
}
//==============================================================================
void FileChooserDialogBox::buttonClicked (Button* button)
{
    if (button == content->okButton)
    {
        if (warnAboutOverwritingExistingFiles
             && content->chooserComponent->isSaveMode()
             && content->chooserComponent->getSelectedFile(0).exists())
        {
            if (! AlertWindow::showOkCancelBox (AlertWindow::WarningIcon,
                                                TRANS("File already exists"),
                                                TRANS("There's already a file called:\n\n")
                                                + content->chooserComponent->getSelectedFile(0).getFullPathName()
                                                + T("\n\nAre you sure you want to overwrite it?"),
                                                TRANS("overwrite"),
                                                TRANS("cancel")))
            {
                return;
            }
        }

        exitModalState (1);
    }
    else if (button == content->cancelButton)
        closeButtonPressed();
}
Пример #3
0
bool AlertWindow::keyPressed (const KeyPress& key)
{
    for (int i = buttons.size(); --i >= 0;)
    {
        TextButton* const b = buttons.getUnchecked(i);

        if (b->isRegisteredForShortcut (key))
        {
            b->triggerClick();
            return true;
        }
    }

    if (key.isKeyCode (KeyPress::escapeKey) && escapeKeyCancels && buttons.size() == 0)
    {
        exitModalState (0);
        return true;
    }
    else if (key.isKeyCode (KeyPress::returnKey) && buttons.size() == 1)
    {
        buttons.getUnchecked(0)->triggerClick();
        return true;
    }

    return false;
}
Пример #4
0
/// Called when a button is clicked.
///
/// @param button clicked button
///
void GenericWindowSkin::buttonClicked(Button *button)
{
    // user has selected a skin
    if (button == &buttonSelect)
    {
        // exit code 1: user has selected a skin
        int exitValue = 1;

        // close window and return exit value -- the selected skin's
        // name may be obtained from the plug-in's GUI window
        exitModalState(exitValue);
    }
    // user has selected a default skin
    else if (button == &buttonDefault)
    {
        // get first selected row index from list box
        int selectedRow = listBox.getSelectedRow(0);

        // update default skin
        listBoxModel.setDefault(selectedRow);

        // redraw list box
        listBox.repaint();
    }
}
Пример #5
0
/// This method is called when the user tries to close the window "by
/// force".  For example, this may be achieved by pressing the close
/// button on the title bar.
///
void GenericWindowSkin::closeButtonPressed()
{
    // exit code 0: skin selection has been cancelled
    int exitValue = 0;

    // close window and return exit value
    exitModalState(exitValue);
}
Пример #6
0
void CallOutBox::handleCommandMessage (int commandId)
{
    Component::handleCommandMessage (commandId);

    if (commandId == callOutBoxDismissCommandId)
    {
        exitModalState (0);
        setVisible (false);
    }
}
Пример #7
0
void CallOutBox::inputAttemptWhenModal()
{
    if (dismissalMouseClicksAreAlwaysConsumed
         || targetArea.contains (getMouseXYRelative() + getBounds().getPosition()))
    {
        // if you click on the area that originally popped-up the callout, you expect it
        // to get rid of the box, but deleting the box here allows the click to pass through and
        // probably re-trigger it, so we need to dismiss the box asynchronously to consume the click..
        dismiss();
    }
    else
    {
        exitModalState (0);
        setVisible (false);
    }
}
Пример #8
0
void CallOutBox::inputAttemptWhenModal()
{
    const Point<int> mousePos (getMouseXYRelative() + getBounds().getPosition());

    if (targetArea.contains (mousePos))
    {
        // if you click on the area that originally popped-up the callout, you expect it
        // to get rid of the box, but deleting the box here allows the click to pass through and
        // probably re-trigger it, so we need to dismiss the box asynchronously to consume the click..
        postCommandMessage (callOutBoxDismissCommandId);
    }
    else
    {
        exitModalState (0);
        setVisible (false);
    }
}
Пример #9
0
void CtrlrLuaMethodEditor::menuItemSelected(int menuItemID, int topLevelMenuIndex)
{
	if (menuItemID == 1 && topLevelMenuIndex == 0)
	{
		if (isCurrentlyModal())
			exitModalState(-1);

		owner.getWindowManager().toggle (CtrlrPanelWindowManager::LuaMethodEditor, false);
	}
	if (menuItemID == 2 && topLevelMenuIndex == 0)
	{
		if (getCurrentEditor())
		{
			getCurrentEditor()->saveDocument();
		}
	}
	else if (menuItemID == 3 && topLevelMenuIndex == 0)
	{
		if (getCurrentEditor())
		{
			getCurrentEditor()->saveAndCompileDocument();
		}
	}
	else if (menuItemID == 4 && topLevelMenuIndex == 0)
	{
		saveAndCompilAllMethods();
	}
	else if (menuItemID == 4 && topLevelMenuIndex == 1)
	{
		methodEditArea->showFindDialog();
	}
	else if (menuItemID == 5 && topLevelMenuIndex == 1)
	{
		methodEditArea->clearOutputText();
	}
	else if (menuItemID == 6 && topLevelMenuIndex == 1)
	{
		CtrlrLuaMethodCodeEditorSettings s(*this);
		CtrlrDialogWindow::showModalDialog ("Code editor settings", &s, false, this);

		componentTree.setProperty (Ids::luaMethodEditorFont, owner.getOwner().getFontManager().getStringFromFont (s.getFont()), nullptr);
		componentTree.setProperty (Ids::luaMethodEditorBgColour, COLOUR2STR (s.getColour()), nullptr);
	}
}
void FileChooserDialogBox::okButtonPressed()
{
    if (warnAboutOverwritingExistingFiles
         && content->chooserComponent.isSaveMode()
         && content->chooserComponent.getSelectedFile(0).exists())
    {
        AlertWindow::showOkCancelBox (AlertWindow::WarningIcon,
                                         TRANS("File already exists"),
                                         TRANS("There's already a file called:")
                                           + "\n\n" + content->chooserComponent.getSelectedFile(0).getFullPathName()
                                           + "\n\n" + TRANS("Are you sure you want to overwrite it?"),
                                         TRANS("overwrite"),
                                         TRANS("cancel"),
                                      this,
                                      ModalCallbackFunction::forComponent (okToOverwriteFileCallback, this));
    }
    else
    {
        exitModalState (1);
    }
}
Пример #11
0
void CallOutBox::inputAttemptWhenModal()
{
    if (dismissalMouseClicksAreAlwaysConsumed
         || targetArea.contains (getMouseXYRelative() + getBounds().getPosition()))
    {
        // if you click on the area that originally popped-up the callout, you expect it
        // to get rid of the box, but deleting the box here allows the click to pass through and
        // probably re-trigger it, so we need to dismiss the box asynchronously to consume the click..

        // For touchscreens, we make sure not to dismiss the CallOutBox immediately,
        // as Windows still sends touch events before the CallOutBox had a chance
        // to really open.

        RelativeTime elapsed = Time::getCurrentTime() - creationTime;
        if (elapsed.inMilliseconds() > 200)
            dismiss();
    }
    else
    {
        exitModalState (0);
        setVisible (false);
    }
}
Пример #12
0
void UploadDialog::closeButtonPressed()
{
	exitModalState(0);
	delete this;
}
Пример #13
0
 void inputAttemptWhenModal() override   { exitModalState (0); }
Пример #14
0
void AlertWindow::userTriedToCloseWindow()
{
    if (escapeKeyCancels || buttons.size() > 0)
        exitModalState (0);
}
 void mouseDown (const MouseEvent&) override     { exitModalState (0); }
Пример #16
0
 void closeButtonPressed ()
 {
   exitModalState (0);
 }
Пример #17
0
void AlertWindow::userTriedToCloseWindow()
{
    exitModalState (0);
}