Esempio n. 1
0
Client *Client::create(const Rect& rect, int screenNumber, const String &clazz, const String &instance, bool movable)
{
    WindowManager *wm = WindowManager::instance();
    xcb_connection_t* conn = wm->connection();
    xcb_screen_t* scr = wm->screens().at(screenNumber);

    xcb_window_t window = xcb_generate_id(conn);
    const uint32_t values[] = {
        scr->black_pixel,
        XCB_GRAVITY_NORTH_WEST,
        XCB_GRAVITY_NORTH_WEST,
        1,
        (XCB_EVENT_MASK_STRUCTURE_NOTIFY
         | XCB_EVENT_MASK_ENTER_WINDOW
         | XCB_EVENT_MASK_LEAVE_WINDOW
         | XCB_EVENT_MASK_EXPOSURE
         | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT
         | XCB_EVENT_MASK_POINTER_MOTION
         | XCB_EVENT_MASK_BUTTON_PRESS
         | XCB_EVENT_MASK_BUTTON_RELEASE)
    };
    warning() << "creating client window" << rect;
    xcb_create_window(conn, XCB_COPY_FROM_PARENT, window, scr->root,
                      rect.x, rect.y, rect.width, rect.height, 0,
                      XCB_COPY_FROM_PARENT, XCB_COPY_FROM_PARENT,
                      XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | XCB_CW_WIN_GRAVITY
                      | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK, values);

    xcb_icccm_wm_hints_t wmHints;
    xcb_icccm_wm_hints_set_none(&wmHints);
    xcb_icccm_wm_hints_set_input(&wmHints, 0);
    xcb_icccm_set_wm_hints(conn, window, &wmHints);

    xcb_size_hints_t wmNormalHints;
    memset(&wmNormalHints, 0, sizeof(wmNormalHints));
    xcb_icccm_size_hints_set_position(&wmNormalHints, 1, rect.x, rect.y);
    xcb_icccm_size_hints_set_size(&wmNormalHints, 1, rect.width, rect.height);
    xcb_icccm_set_wm_normal_hints(conn, window, &wmNormalHints);

    String className = clazz + ' ' + instance;
    className[clazz.size()] = '\0';
    xcb_icccm_set_wm_class(conn, window, className.size(), className.constData());
    Client *ptr = new Client(window);
    ptr->mMovable = movable;
    ptr->mRect = rect;
    ptr->mOwned = true;
    ptr->mScreenNumber = screenNumber;
    ptr->init();
    ptr->mNoFocus = true;
    Workspace *ws = wm->activeWorkspace(screenNumber);
    assert(ws);
    ptr->mWorkspace = ws;
    ws->addClient(ptr);

    wm->js().onClient(ptr);
    ptr->complete();

    sClients[window] = ptr;
    return ptr;
}
Esempio n. 2
0
bool WindowManager::Close()
{
    QList<Window::Pointer> t = windows; // make iteration robust
    for (QList<Window::Pointer>::iterator iter = t.begin();
            iter != t.end(); ++iter)
    {
        bool closed = (*iter)->Close();
        if (!closed)
        {
            return false;
        }
    }

    if (!subManagers.empty())
    {
        for (QList<WindowManager*>::iterator iter = subManagers.begin();
                iter != subManagers.end(); ++iter)
        {
            WindowManager* wm = *iter;
            bool closed = wm->Close();
            if (!closed)
            {
                return false;
            }
        }
    }
    return true;
}
Esempio n. 3
0
SelectAttributeDialog::SelectAttributeDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
  : WindowBase("openmw_chargen_select_attribute_layout.xml", environment)
{
    // Centre dialog
    center();

    WindowManager *wm = environment.mWindowManager;

    setText("LabelT", wm->getGameSettingString("sAttributesMenu1", ""));

    for (int i = 0; i < 8; ++i)
    {
        Widgets::MWAttributePtr attribute;
        char theIndex = '0'+i;

        getWidget(attribute,  std::string("Attribute").append(1, theIndex));
        attribute->setWindowManager(wm);
        attribute->setAttributeId(ESM::Attribute::attributeIds[i]);
        attribute->eventClicked = MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked);
    }

    // TODO: These buttons should be managed by a Dialog class
    MyGUI::ButtonPtr cancelButton;
    getWidget(cancelButton, "CancelButton");
    cancelButton->setCaption(wm->getGameSettingString("sCancel", ""));
    cancelButton->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked);
}
Esempio n. 4
0
void PickClassDialog::updateStats()
{
    if (currentClassId.empty())
        return;
    WindowManager *wm = environment.mWindowManager;
    ESMS::ESMStore &store = environment.mWorld->getStore();
    const ESM::Class *klass = store.classes.search(currentClassId);
    if (!klass)
        return;

    ESM::Class::Specialization specialization = static_cast<ESM::Class::Specialization>(klass->data.specialization);

    static const char *specIds[3] = {
        "sSpecializationCombat",
        "sSpecializationMagic",
        "sSpecializationStealth"
    };
    specializationName->setCaption(wm->getGameSettingString(specIds[specialization], specIds[specialization]));

    favoriteAttribute[0]->setAttributeId(klass->data.attribute[0]);
    favoriteAttribute[1]->setAttributeId(klass->data.attribute[1]);

    for (int i = 0; i < 5; ++i)
    {
        majorSkill[i]->setSkillNumber(klass->data.skills[i][0]);
        minorSkill[i]->setSkillNumber(klass->data.skills[i][1]);
    }

    classImage->setImageTexture(std::string("textures\\levelup\\") + currentClassId + ".dds");
}
void Helium::RendererInitializationWin::Shutdown()
{
	DynamicDrawer::DestroyStaticInstance();
	RenderResourceManager::DestroyStaticInstance();

	Renderer* pRenderer = Renderer::GetStaticInstance();
	if( pRenderer )
	{
		pRenderer->Shutdown();
		Renderer::DestroyStaticInstance();
	}

	WindowManager* pWindowManager = WindowManager::GetStaticInstance();
	if( pWindowManager )
	{
		if( m_pMainWindow )
		{
			m_pMainWindow->Destroy();
			while( m_pMainWindow )
			{
				pWindowManager->Update();
			}
		}

		pWindowManager->Shutdown();
		WindowManager::DestroyStaticInstance();
	}
}
Esempio n. 6
0
void Client::close()
{
    WindowManager *wm = WindowManager::instance();
    if (mOwned) {
        EventLoop::eventLoop()->callLater([this, wm] {
                delete this;
                xcb_flush(wm->connection());
            });
    } else {
        if (mProtocols.contains(Atoms::WM_DELETE_WINDOW)) {
            // delete
            xcb_client_message_event_t event;
            memset(&event, '\0', sizeof(event));
            event.response_type = XCB_CLIENT_MESSAGE;
            event.window = mWindow;
            event.format = 32;
            event.type = Atoms::WM_PROTOCOLS;
            event.data.data32[0] = Atoms::WM_DELETE_WINDOW;
            event.data.data32[1] = wm->timestamp();

            xcb_send_event(wm->connection(), false, mWindow, XCB_EVENT_MASK_NO_EVENT,
                           reinterpret_cast<char*>(&event));

        } else {
            xcb_kill_client(wm->connection(), mWindow);
        }
    }
}
Esempio n. 7
0
LRESULT CALLBACK WindowManager::WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    WindowManager *view;

    if (message == WM_NCCREATE)
    {
        CREATESTRUCT *cs = (CREATESTRUCT*) lParam; 
        view = (WindowManager*) cs->lpCreateParams;

        SetLastError(0);
        if (SetWindowLongPtr(hwnd, GWL_USERDATA, (LONG_PTR) view) == 0)
        {
            if (GetLastError() != 0)
                return FALSE;
        }
    }
    else
    {
        view = (WindowManager*) GetWindowLongPtr(hwnd, GWL_USERDATA);
    }

    if (view)
        return view->WindowProc(hwnd, message, wParam, lParam);

    return DefWindowProc(hwnd, message, wParam, lParam);
}
Esempio n. 8
0
void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
{
    WindowManager *wm = environment.mWindowManager;

    // Add a line separator if there are items above
    if (!skillWidgets.empty())
    {
        addSeparator(coord1, coord2);
    }

    addGroup(wm->getGameSettingString(titleId, titleDefault), coord1, coord2);

    SkillList::const_iterator end = skills.end();
    for (SkillList::const_iterator it = skills.begin(); it != end; ++it)
    {
        int skillId = *it;
        if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
            continue;
        assert(skillId >= 0 && skillId < ESM::Skill::Length);
        const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId];
        const MWMechanics::Stat<float> &stat = skillValues.find(skillId)->second;
        float base = stat.getBase();
        float modified = stat.getModified();

        ColorStyle style = CS_Normal;
        if (modified > base)
            style = CS_Super;
        else if (modified < base)
            style = CS_Sub;
        MyGUI::StaticTextPtr widget = addValueItem(wm->getGameSettingString(skillNameId, skillNameId), boost::lexical_cast<std::string>(static_cast<int>(modified)), style, coord1, coord2);
        skillWidgetMap[skillId] = widget;
    }
}
void FrameAttachmentPoint::showContextMenu(QPoint point)
{
    //Show menus with all attached frames and submenu where to attach it to
    clearActionReceivers();

    WindowManager* windowManager = Carbon::get()->getWindowManager();
    QMenu menu(windowManager->getMainWindow());
    QMenu* submenu;
    QAction* action;

    //For all attached frames, add frame menu
    int frame = 0;
    for (auto it = mAttachedFrames.begin(); it != mAttachedFrames.end(); it++) 
    {
        submenu = menu.addMenu((*it)->getCaption());
     
        //for all possible targets, add commands
        {
            NumberedActionReceiver* receiver;
            
            //Copy command
            receiver = new NumberedActionReceiver(frame, COMMAND_COPY);
            mActionReceivers.push_back(receiver);
            connect(receiver, SIGNAL(actionReceived(int,int)), this, SLOT(onContextMenuClick(int,int)));
            action = submenu->addAction(QIcon(":copy"), "Copy", receiver, SLOT(receiveAction()));
            action->setToolTip("Create a copy of the plugin.");
            if (!PluginFactory::getFactory().canCreatePlugin((*it)->getClassId())) //Disable copy if plugin cant be created anymore
                action->setEnabled(false);

            //Delete command
            receiver = new NumberedActionReceiver(frame, COMMAND_DELETE);
            mActionReceivers.push_back(receiver);
            connect(receiver, SIGNAL(actionReceived(int,int)), this, SLOT(onContextMenuClick(int,int)));
            action = submenu->addAction(QIcon(":delete"), "Delete", receiver, SLOT(receiveAction()));
            action->setToolTip("Delete the plugin.");
        }

        submenu->addSeparator();

        //for all possible targets, add target frames
        int target = COMMAND_MAX_ID;
        for (auto tar_it = windowManager->getFrameAttachmentPoints().begin(); tar_it != windowManager->getFrameAttachmentPoints().end(); tar_it++)
        {
            NumberedActionReceiver* receiver = new NumberedActionReceiver(frame, target);
            mActionReceivers.push_back(receiver);

            connect(receiver, SIGNAL(actionReceived(int,int)), this, SLOT(onContextMenuClick(int,int)));

            if (tar_it->second == this)
                action = submenu->addAction(QIcon(":accept"), tar_it->second->getName(), receiver, SLOT(receiveAction()));
            else
                action = submenu->addAction(tar_it->second->getName(), receiver, SLOT(receiveAction()));
            
            target++;
        }
        frame++;
    }

    menu.exec(mAttachmentPoint->mapToGlobal(point));
}
Esempio n. 10
0
void Client::init()
{
    WindowManager *wm = WindowManager::instance();
    xcb_ewmh_connection_t* ewmhConn = wm->ewmhConnection();
    updateState(ewmhConn);
    wm->bindings().rebind(mWindow);
}
Esempio n. 11
0
Client *Client::manage(xcb_window_t window, int screenNumber)
{
    assert(sClients.count(window) == 0);
    Client *ptr = new Client(window);
    ptr->mScreenNumber = screenNumber;
    ptr->init();
    WindowManager *wm = WindowManager::instance();
    wm->js().onClient(ptr);

    xcb_ewmh_connection_t* ewmhConn = wm->ewmhConnection();
    bool focus = false;
    if (!ptr->mEwmhState.contains(ewmhConn->_NET_WM_STATE_STICKY)) {
        Workspace *ws = wm->activeWorkspace(screenNumber);
        assert(ws);
        ptr->mWorkspace = ws;
        ws->addClient(ptr);
        focus = true;
    }
    ptr->complete();
    if (focus)
        ptr->focus();

    sClients[window] = ptr;
    return ptr;
}
    WindowManager::WindowManager (const WindowManager& other)
    {
      init ((unsigned int) other.getWindowPosition().x(),
	    (unsigned int) other.getWindowPosition().y(),
	    (unsigned int) other.getWindowDimension().x(),
	    (unsigned int) other.getWindowDimension().y());
    }
Esempio n. 13
0
ExampleApplication::ExampleApplication(const std::string& caption, int argc, const char* argv[])
{
	std::string title = caption + " - Open Graphics Framework";
	bool fullscreen = false;
	int width = 800;
	int height = 600;
	int samples = 0;
	
	for (int i = 1; i < argc; ++i)
	{
		if (std::strcmp(argv[i], "--fullscreen") == 0 || std::strcmp(argv[i], "-f") == 0)
		{
			fullscreen = true;
			continue;
		}
		
		if (std::sscanf(argv[i], "--width=%d", &width) == 1)
			continue;
		
		if (std::sscanf(argv[i], "-w=%d", &width) == 1)
			continue;
		
		if (std::sscanf(argv[i], "--height=%d", &height) == 1)
			continue;
		
		if (std::sscanf(argv[i], "-h=%d", &height) == 1)
			continue;
		
		if (std::sscanf(argv[i], "--samples=%d", &samples) == 1)
			continue;
		
		std::sscanf(argv[i], "-s=%d", &samples);
	}
	
	WindowManager* windowManager = getWindowManager();
	windowManager->setWindowHint(WindowHint::RESIZABLE, 1);
	windowManager->setWindowHint(WindowHint::SAMPLES, samples);

	const Display* display = windowManager->getDisplay(0);
	window = windowManager->createWindow(title, width, height);
	window->setDisplayMode(display->getMode(0));
	window->setSwapInterval(1);
	
	graphicsContext = window->getGraphicsContext();
	
	resourceContext = new ResourceContext(graphicsContext);
	
	// Create renderer
	renderer = new Renderer(graphicsContext);
	
	// Setup screen recording
	screenRecorder.setGraphicsContext(graphicsContext);
		
	window->addObserver(this);
	getInputManager()->getKeyboard(0)->addObserver(this);
}
Esempio n. 14
0
/// Deserializes the given application state
/// @param app a reference to the application
/// @param map the map with serialized data
void WorkspaceSerializer::deserializeWorkspace(Workspace* workspace, const QVariantMap& map)
{
    WindowManager* winManager = edbeeApp()->windowManager();
    QVariantList windows = map.value("windows").toList();
    foreach( QVariant winVar, windows ) {
        QVariantMap winMap = winVar.toMap();
        MainWindow* win = winManager->createWindow( workspace );
        deserializeMainWindow( win, winMap );
        win->show();
    }
Esempio n. 15
0
Window * GroupBox::getContentPane() const
{
    String paneName = d_name + ContentPaneNameSuffix;
    WindowManager* winMgr = WindowManager::getSingletonPtr();
    if (winMgr->isWindowPresent(paneName))
    {
        return winMgr->getWindow(paneName);
    }
    return 0;
}
/// Callback executed when the main window is actually destroyed.
///
/// @param[in] pWindow  Pointer to the destroyed Window instance.
void RendererInitializationWin::OnMainWindowDestroyed( Window* pWindow )
{
	HELIUM_ASSERT( m_pMainWindow == pWindow );
	HELIUM_UNREF( pWindow );

	m_pMainWindow = NULL;
	WindowManager* pWindowManager = WindowManager::GetStaticInstance();
	HELIUM_ASSERT( pWindowManager );
	pWindowManager->RequestQuit();
}
Esempio n. 17
0
    PaintToolGL(const Gdk::Region& invalid_region, const WindowManager& wm) : PaintTool(invalid_region, wm)
    {
      _full_area_height  = wm.get_height();
      _full_area_width   = wm.get_width();

      glViewport(0.f, 0.f, _full_area_width, _full_area_height);

      glDisable(GL_SCISSOR_TEST);
      Gdk::Rectangle area;
      /*get_invalid_region().get_clipbox(area);*/area  = Gdk::Rectangle(0, 0, _full_area_width, _full_area_height);
      g_assert(get_scissor_stack_depth()==0);
      push_scissor(area);

      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(0.f, _full_area_width, _full_area_height, 0.f, -1.f, 1.f);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();

      glClearStencil(0);
      glClear(GL_STENCIL_BUFFER_BIT);
      glDisable(GL_STENCIL_TEST);
      glStencilFunc(GL_EQUAL, 1, 1);
      glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);

      Glib::ArrayHandle<Gdk::Rectangle> invalid_rectangles  = invalid_region.get_rectangles();

      glBegin(GL_QUADS);
        for(Glib::ArrayHandle<Gdk::Rectangle>::const_iterator r_iter  = invalid_rectangles.begin(); r_iter  != invalid_rectangles.end(); ++r_iter)
        {
          const Gdk::Rectangle& rect  = *r_iter;
          gfloat x  = rect.get_x();
          gfloat y  = rect.get_y();
          gfloat x2  = x+rect.get_width();
          gfloat y2  = y+rect.get_height();

          glVertex3f(x , y , 0.f);
          glVertex3f(x , y2, 0.f);
          glVertex3f(x2, y2, 0.f);
          glVertex3f(x2, y , 0.f);
        }
      glEnd();

      glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
      glEnable(GL_STENCIL_TEST);

      glClearColor(0.f, 0.f, 0.f, 1.f);
      glClear(GL_COLOR_BUFFER_BIT);

      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

      glEnable(GL_SCISSOR_TEST);
      glDisable(GL_STENCIL_TEST);
    }
Esempio n. 18
0
/// Callback executed when the main window is actually destroyed.
///
/// @param[in] pWindow  Pointer to the destroyed Window instance.
void GameSystem::OnMainWindowDestroyed( Window* pWindow )
{
    HELIUM_ASSERT( m_pMainWindow == pWindow );
    HELIUM_UNREF( pWindow );

    m_pMainWindow = NULL;

    WindowManager* pWindowManager = WindowManager::GetStaticInstance();
    HELIUM_ASSERT( pWindowManager );
    pWindowManager->RequestQuit();
}
Esempio n. 19
0
ClassChoiceDialog::ClassChoiceDialog(MWWorld::Environment& environment)
    : InfoBoxDialog(environment)
{
    WindowManager *mw = environment.mWindowManager;
    setText("");
    ButtonList buttons;
    buttons.push_back(mw->getGameSettingString("sClassChoiceMenu1", ""));
    buttons.push_back(mw->getGameSettingString("sClassChoiceMenu2", ""));
    buttons.push_back(mw->getGameSettingString("sClassChoiceMenu3", ""));
    buttons.push_back(mw->getGameSettingString("sBack", ""));
    setButtons(buttons);
}
void LobbyEvent::Destroy()
{
	if(gLobbyData.get()==NULL)
		return;

	gLobbyData->mLobbyContainer->SetListener(NULL);
	WindowManager *aWindowMgr = WindowManager::GetDefaultWindowManager();
	if(aWindowMgr!=NULL)
	{
		aWindowMgr->RemoveTimerEvent(gLobbyData->mTimerEvent);
		aWindowMgr->ClearSubscriptions(); // FIXME, just clear lobby subscriptions
	}
}
Esempio n. 21
0
int main(int argc,char** argv)
{
    WindowManager *pWinManager = KaMiWindowManager::Instance(argc,argv);
    WindowData winData("KaMiWindow",500,500,GLUT_SINGLE|GLUT_RGB |GLUT_DEPTH,GePoint2D(0.0,0.0));
    winData.winName = "KamiWindow";
   
    GeWindow *pWin = pWinManager->createWindow(winData);
    pWin->setRender(new KaMiRender);
    pWin->setBlankgroundColor(0.0,1.0,0.0);
    pWin->moveTo(GePoint2D(200,200));
    glClearColor(0.0, 0.0, 0.0, 1.0);
    pWin->show();
}
Esempio n. 22
0
static inline void handleXkb(_xkb_event* event)
{
    WindowManager *wm = WindowManager::instance();
    if (event->any.deviceID == wm->xkbDevice()) {
        switch (event->any.xkbType) {
        case XCB_XKB_STATE_NOTIFY:
            wm->updateXkbState(&event->state_notify);
            break;
        case XCB_XKB_MAP_NOTIFY:
            wm->updateXkbMap(&event->map_notify);
            break;
        }
    }
}
Esempio n. 23
0
int _tmain(int argc, _TCHAR* argv[])
{
	WindowManager manager;
	manager.CreateWindow(640, 480);
	ImagePainter painter(640, 480);
	FormulaGenerator generator;
	auto red = generator.createFormula(10);
	auto green = generator.createFormula(10);
	auto blue = generator.createFormula(10);
	std::cout << red->toString() << endl << green->toString() << endl << blue->toString() << endl;
	ImageData image = painter.CreateFromFormula(*red, *green, *blue);
	manager.PaintImage(image);
	manager.RunMainLoop();
}
Esempio n. 24
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	WindowManager* windowManager;

	windowManager = new WindowManager();
	if (!windowManager)
		return 1;
	
	if (windowManager->Init(hInstance, nCmdShow))
		windowManager->Run();

	delete windowManager;

	return 0;
}
Esempio n. 25
0
int Window::moveTo(const yguipp::Point& p) {
    WindowManager* windowManager = m_guiServer->getWindowManager();

    if (m_visible) {
        windowManager->lock();
    }

    doMoveTo(p);

    if (m_visible) {
        windowManager->unLock();
    }

    return 0;
}
Esempio n. 26
0
/// Serializes the application
/// @paramapp the application to serialize
QVariantMap WorkspaceSerializer::serializeWorkspace(Workspace* workspace)
{
    QVariantMap result;

    // 'remember' all open files per window
    QVariantList windowList;
    WindowManager* wm = edbeeApp()->windowManager();
    for( int i=0,cnt=wm->size(); i<cnt; ++i ) {
        MainWindow* window = wm->window(i);
        if( window->workspace() == workspace ) {
            windowList.append( serializeMainWindow( window ));
        }
    }
    result.insert("windows",windowList);
    return result;
}
Esempio n. 27
0
PickClassDialog::PickClassDialog(MWWorld::Environment& environment)
  : WindowBase("openmw_chargen_class_layout.xml", environment)
{
    // Centre dialog
    center();

    WindowManager *wm = environment.mWindowManager;
    setText("SpecializationT", wm->getGameSettingString("sChooseClassMenu1", "Specialization"));
    getWidget(specializationName, "SpecializationName");

    setText("FavoriteAttributesT", wm->getGameSettingString("sChooseClassMenu2", "Favorite Attributes:"));
    getWidget(favoriteAttribute[0], "FavoriteAttribute0");
    getWidget(favoriteAttribute[1], "FavoriteAttribute1");
    favoriteAttribute[0]->setWindowManager(wm);
    favoriteAttribute[1]->setWindowManager(wm);

    setText("MajorSkillT", wm->getGameSettingString("sChooseClassMenu3", "Major Skills:"));
    setText("MinorSkillT", wm->getGameSettingString("sChooseClassMenu4", "Minor Skills:"));
    for(int i = 0; i < 5; i++)
    {
        char theIndex = '0'+i;
        getWidget(majorSkill[i], std::string("MajorSkill").append(1, theIndex));
        getWidget(minorSkill[i], std::string("MinorSkill").append(1, theIndex));
        majorSkill[i]->setWindowManager(wm);
        minorSkill[i]->setWindowManager(wm);
    }

    getWidget(classList, "ClassList");
    classList->setScrollVisible(true);
    classList->eventListSelectAccept = MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
    classList->eventListMouseItemActivate = MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
    classList->eventListChangePosition = MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);

    getWidget(classImage, "ClassImage");

    // TODO: These buttons should be managed by a Dialog class
    MyGUI::ButtonPtr backButton;
    getWidget(backButton, "BackButton");
    backButton->eventMouseButtonClick = MyGUI::newDelegate(this, &PickClassDialog::onBackClicked);

    MyGUI::ButtonPtr okButton;
    getWidget(okButton, "OKButton");
    okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &PickClassDialog::onOkClicked);

    updateClasses();
    updateStats();
}
Esempio n. 28
0
/// Run the application loop.
///
/// This will not return until the application is ready to shut down and terminate.
///
/// @return  Result code of application execution.
int32_t GameSystem::Run()
{
    WindowManager* pWindowManager = WindowManager::GetStaticInstance();
    if( !pWindowManager )
    {
        return 0;
    }

    WorldManager& rWorldManager = WorldManager::GetStaticInstance();

    while( pWindowManager->Update() )
    {
        rWorldManager.Update();
    }

    return 0;
}
Esempio n. 29
0
void Client::focus()
{
    const bool takeFocus = mProtocols.count(Atoms::WM_TAKE_FOCUS) > 0;
    if (mNoFocus && !takeFocus)
        return;
    WindowManager *wm = WindowManager::instance();
    if (takeFocus) {
        xcb_client_message_event_t event;
        memset(&event, '\0', sizeof(event));
        event.response_type = XCB_CLIENT_MESSAGE;
        event.window = mWindow;
        event.format = 32;
        event.type = Atoms::WM_PROTOCOLS;
        event.data.data32[0] = Atoms::WM_TAKE_FOCUS;
        event.data.data32[1] = wm->timestamp();

        xcb_send_event(wm->connection(), false, mWindow, XCB_EVENT_MASK_NO_EVENT,
                       reinterpret_cast<char*>(&event));
    }
    xcb_set_input_focus(wm->connection(), XCB_INPUT_FOCUS_PARENT, mWindow, wm->timestamp());
    //error() << "Setting input focus to client" << mWindow << mClass.className;
    xcb_ewmh_set_active_window(wm->ewmhConnection(), mScreenNumber, mWindow);
    wm->setFocusedClient(this);
    if (mWorkspace)
        mWorkspace->updateFocus(this);
}
/// Callback executed when the main window is actually destroyed.
///
/// @param[in] pWindow  Pointer to the destroyed Window instance.
void RendererInitializationImpl::OnMainWindowDestroyed( Window* pWindow )
{
	HELIUM_ASSERT( m_pMainWindow == pWindow );
	HELIUM_UNREF( pWindow );

#if HELIUM_OPENGL
	// Immediately shut down, since we use GLFW to manage windows, and GLFW
	// windows are inseparable from their render contexts.  Therefore, by the
	// time we've received this callback, our renderer had better be shutting down.
	Renderer* pRenderer = Renderer::GetStaticInstance();
	pRenderer->Shutdown();
#endif

	m_pMainWindow = NULL;
	WindowManager* pWindowManager = WindowManager::GetStaticInstance();
	HELIUM_ASSERT( pWindowManager );
	pWindowManager->RequestQuit();
}