void ProfileChooser::show ( std::string title, std::string sql, std::string current_message, bool show_new )
{
	struct generic_node *nodeptr = 0;

	mCancelPressed = false;

	mProfileList.deleteAll();
	db_if_get_profile_names ( sql.c_str(), &nodeptr );
	mProfileList.setList ( nodeptr );

	mProfile.setSelected ( mProfileList.getIndexFromLabel(current_message.c_str()) );

	mCreateNew.setSelected ( false );
	mNewProfile.setText ( "" );

	mCreateNew.setVisible ( show_new );
	mNewProfile.setVisible ( false );
	mNewProfileLabel.setVisible ( false );

	requestModalFocus ();
	setCaption ( title );
	setVisible ( true );
	if ( getParent () )
		getParent()->moveToTop (this);
}
Esempio n. 2
0
void QuitDialog::postInit()
{
    setLocationRelativeTo(getParent());
    setVisible(true);
    soundManager.playGuiSound(SOUND_SHOW_WINDOW);
    requestModalFocus();
    mOkButton->requestFocus();
}
Esempio n. 3
0
Window::Window(const std::string& caption, bool modal, Window *parent,
               const std::string& skin, bool visible):
    gcn::Window(caption),
    mOldVisibility(false),
    mGrip(NULL),
    mClose(NULL),
    mParent(parent),
    mLayout(NULL),
    mWindowName("window"),
    mDefaultSkinPath(skin),
    mShowTitle(true),
    mModal(modal),
    mDefaultVisible(visible),
    mSaveVisibility(true),
    mHasMaxDimensions(false),
    mMinWinWidth(100),
    mMinWinHeight(40),
    mMaxWinWidth(graphics->getWidth()),
    mMaxWinHeight(graphics->getHeight())
{
    logger->log("Window::Window(\"%s\")", caption.c_str());

    if (!windowContainer)
        throw GCN_EXCEPTION("Window::Window(): no windowContainer set");

    if (!skinLoader)
        skinLoader = new SkinLoader();

    instances++;

    setFrameSize(0);
    setPadding(3);
    setTitleBarHeight(20);

    // Loads the skin
    mSkin = skinLoader->load(skin, mDefaultSkinPath);

    // Add this window to the window container
    windowContainer->add(this);

    if (mModal)
    {
        gui->setCursorType(Gui::CURSOR_POINTER);
        requestModalFocus();
    }

    // Windows are invisible by default
    setVisible(false);

    addWidgetListener(this);
}
Esempio n. 4
0
QuitDialog::QuitDialog(QuitDialog** pointerToMe):
    Window(_("Quit"), true, NULL), mMyPointer(pointerToMe)
{
    mForceQuit = new RadioButton(_("Quit"), "quitdialog");
    mLogoutQuit = new RadioButton(_("Quit"), "quitdialog");
    mSwitchAccountServer = new RadioButton(_("Switch server"), "quitdialog");
    mSwitchCharacter = new RadioButton(_("Switch character"), "quitdialog");
    mOkButton = new Button(_("OK"), "ok", this);
    mCancelButton = new Button(_("Cancel"), "cancel", this);

    addKeyListener(this);

    ContainerPlacer place = getPlacer(0, 0);

    const State state = Client::getState();

    // All states, when we're not logged in to someone.
    if (state == STATE_CHOOSE_SERVER ||
        state == STATE_CONNECT_SERVER ||
        state == STATE_LOGIN ||
        state == STATE_LOGIN_ATTEMPT ||
        state == STATE_UPDATE ||
        state == STATE_LOAD_DATA)
    {
        placeOption(place, mForceQuit);
    }
    else
    {
        // Only added if we are connected to an accountserver or gameserver
        placeOption(place, mLogoutQuit);
        placeOption(place, mSwitchAccountServer);

        // Only added if we are connected to a gameserver
        if (state == STATE_GAME) placeOption(place, mSwitchCharacter);
    }

    mOptions[0]->setSelected(true);

    place = getPlacer(0, 1);

    place(1, 0, mOkButton);
    place(2, 0, mCancelButton);

    reflowLayout(150, 0);
    setLocationRelativeTo(getParent());
    setVisible(true);
    requestModalFocus();
    mOkButton->requestFocus();
}
Esempio n. 5
0
void FocusHandler::releaseModalFocus(Widget *const widget)
{
    mModalStack.remove(widget);

    if (mModalFocusedWidget == widget)
    {
        mModalFocusedWidget = nullptr;

        /* Check if there were any previously modal widgets that'd still like
         * to regain their modal focus.
         */
        if (!mModalStack.empty())
        {
            requestModalFocus(mModalStack.front());
            mModalStack.pop_front();
        }
    }
}
Esempio n. 6
0
void PopupList::show(int x, int y)
{
    int len = mListBox->getHeight() + 8;
    if (len > 250)
        len = 250;
    setContentSize(mListBox->getWidth() + 8, len);
    const int width = mDimension.width;
    const int height = mDimension.height;
    if (mainGraphics->mWidth < (x + width + 5))
        x = mainGraphics->mWidth - width;
    if (mainGraphics->mHeight < (y + height + 5))
        y = mainGraphics->mHeight - height;
    setPosition(x, y);
    setVisible(true);
    requestMoveToTop();
    if (mModal)
        requestModalFocus();
}
	void MessageBoxContainer::showMessage( const std::string& title, const std::string& message, MessageBox::MessageType type, MessageBoxResultReceiver* rec, int tag )
	{
		if(getGui())
		{
			if(m_msg->getModalContainer()->getParent() == NULL)
				getGui()->add(m_msg->getModalContainer());

			m_msg->getModalContainer()->bringToFront();
			m_msg->getModalContainer()->setVisibility(true);
		}

		setGlobalOpacity(0.0f);
		bringToFront();
		m_msg->showMessage(title,message,m_frame,type,rec,tag);
		setSize(m_frame->getSize());
		recenter();
		setVisibility(true);
		bool gotFocus = requestModalFocus();
	}
Esempio n. 8
0
Windowiki::Windowiki(const std::string& caption, bool modal, Windowiki *parent):
    gcn::Window(caption),
    mGrip(0),
    mParent(parent),
    mWindowName("Window iki"),
    mShowTitle(true),
    mModal(modal),
    mResizable(true),
    mMouseResize(0),
    mSticky(false),
    mMinWinWidth(125),
    mMinWinHeight(250),
    mMaxWinWidth(INT_MAX),
    mMaxWinHeight(INT_MAX),
    mCloseButton(false)
{



   if (!windowikiContainer) {
        throw GCN_EXCEPTION("Window::Window. no windowContainer set");
   }
    if (instancesiki == 0)
    {
        // Load static resources
        ResourceManager *resman = ResourceManager::getInstance();
        Image *dBorders = resman->getImage("graphics/gui/ppp.png");
        borderiki.grid[0] = dBorders->getSubImage(0, 0, 15, 24); //sol üst taraf
        borderiki.grid[1] = dBorders->getSubImage(50, 0, 5, 48); //üst tarafýn devamlýlýðý
        borderiki.grid[2] = dBorders->getSubImage(15, 0, 15, 25); // sað üst taraf
        borderiki.grid[3] = dBorders->getSubImage(0, 110, 44, 5); // sol taraf devamlýlýk
        borderiki.grid[4] = resman->getImage("graphics/gui/ff.png");
        borderiki.grid[5] = dBorders->getSubImage(115, 210, 42, 10); // sað taraf devamlýlýk
        borderiki.grid[6] = dBorders->getSubImage(0, 30, 15, 30); //sol alt taraf
        borderiki.grid[7] = dBorders->getSubImage(89, 0, 5, 61); //alt taraf devamlýlýk
        borderiki.grid[8] = dBorders->getSubImage(0, 15, 0, 55); //sað alt taraf
        dBorders->decRef();

        closeImage = resman->getImage("graphics/gui/close_button.png");
        solustImage = resman->getImage("graphics/gui/solust.png");
        sagustImage = resman->getImage("graphics/gui/sagust.png");
        solaltImage = resman->getImage("graphics/gui/solalt.png");
        sagaltImage = resman->getImage("graphics/gui/sagalt.png");

        windowikiConfigListener = new WindowikiConfigListener();
        // Send GUI alpha changed for initialization
//þeffaf pencereyi kapattým.
//        windowikiConfigListener->optionChanged("guialpha");
//        config.addListener("guialpha", windowikiConfigListener);
    }
    instancesiki++;
    setPadding(5);
    setTitleBarHeight(30);
    // Add chrome
//    mChrome = new GCContainer();
//    mChrome->setOpaque(false);
//    gcn::Window::add(mChrome);

    // Add this window to the window container

    windowikiContainer->add(this);

    if (mModal)
    {
        requestModalFocus();
    }

    // Windows are invisible by default
    setVisible(false);
}