Пример #1
0
	virtual void CreateUI(const GamePtr& game, wxAuiManager& manager)
	{
		// Create all of the UI needed for network games.
		wxWindow* frame = GetMainFrame();

		wxSize minSize = wxSize(165, 150);

		// Create the notebook off screen to avoid flicker.
		wxSize size = frame->GetClientSize();

		wxAuiNotebook* notebook = new wxAuiNotebook(frame, wxID_ANY,
			wxPoint(size.x, size.y), minSize, wxAUI_NB_TOP | 
			wxAUI_NB_TAB_SPLIT |wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS |
			wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER);

		// Chat window.
		wxChatUI* chat = new wxChatUI(notebook);
		notebook->AddPage(chat, stChat);

        // Event window.
        wxEventUI* event = new wxEventUI(notebook);
        notebook->AddPage(event, stEvents);
		
		// Spectator window.
		wxSpectatorUI* spectators = new wxSpectatorUI(notebook);
		notebook->AddPage(spectators, stSpectators);

		manager.AddPane(notebook, wxAuiPaneInfo().MinSize(minSize)
			.Caption(stNetwork).CloseButton(false)
			.MaximizeButton(false).Dockable(true).Right()
			.Name(swNetwork));
	}
Пример #2
0
    virtual void HandleGameMenuClick(const wxString& key,
                                     wxAuiManager& manager, wxMenuItem* item)
    {
        wxASSERT(swSettings == key);
        wxASSERT(NULL != item);

        if(true == item->IsChecked())
        {
            wxSettingsPane* pane = new wxSettingsPane(GetMainFrame(),
                    item->GetId());

            // Add it as a popup window.
            manager.AddPane(pane, wxAuiPaneInfo().Caption(stSettings)
                            .CloseButton(true).MaximizeButton(false).DestroyOnClose()
                            .Float().Dockable(false).Name(swSettings));
        }
        else
        {
            wxAuiPaneInfo& pane = manager.GetPane(swSettings);
            manager.ClosePane(pane);
        }

        manager.Update();
    }
/**
 * Moves all of the code notebooks from the hidden notebooks into the
 * first visible notebook
 *
 * @param auiManager the AUI manager of the main frame
 * @param ctrls all of the opened code controls
 */
static void RedistributeCodeControls(wxAuiManager& auiManager, std::vector<t4p::CodeControlClass*> ctrls) {
    std::vector<t4p::NotebookClass*> visible = t4p::AuiVisibleCodeNotebooks(auiManager);
    std::vector<t4p::NotebookClass*> all = t4p::AuiAllCodeNotebooks(auiManager);
    std::vector<t4p::NotebookClass*> hidden;
    for (size_t i = 0; i < all.size(); i++) {
        t4p::NotebookClass* notebook = all[i];
        if (!auiManager.GetPane(notebook).IsShown()) {
            hidden.push_back(notebook);
        }
    }

    // go through the hidden notebooks and move code controls
    // from the hidden notebook into a visible notebook
    for (size_t i = 0; i < hidden.size(); i++) {
        t4p::NotebookClass* notebook = hidden[i];

        // if a notebook is no longer shown we want to move the code controls
        // that it had to another notebook (one that is shown).
        // in the rare case that there are no shown notebooks, just remove them
        // (closing will trigger a save prompt if needed)
        while (notebook->GetPageCount() > 0) {
            t4p::CodeControlClass* code = notebook->GetCodeControl(0);
            if (!visible.empty()) {
                visible[0]->Adopt(code, notebook);
            } else {
                notebook->ClosePage(0);
            }
        }
    }

    // special case: if there are N visible code controls
    // and we have N visible notebooks, put 1 code control
    // in each notebook.
    if (ctrls.size() == visible.size()) {
        for (size_t i = 0; i < ctrls.size(); i++) {
            t4p::CodeControlClass* ctrl = ctrls[i];
            bool moved = false;
            for (size_t a = 0; !moved && a < all.size(); a++) {
                t4p::NotebookClass* ctrlNotebook = all[a];
                int index = ctrlNotebook->GetPageIndex(ctrl);
                if (index != wxNOT_FOUND && visible[i] != ctrlNotebook) {
                    visible[i]->Adopt(ctrl, ctrlNotebook);
                    moved = true;
                    break;
                } else if (visible[i] == ctrlNotebook) {
                    // the code control is already at a visible notebook.
                    // move on to the next code control
                    moved = true;
                    break;
                }
            }
        }
    }

    // in case that a notebook does not have any code controls
    // add an empty file, this is for asthetic purposes
    for (size_t i = 0; i < visible.size(); i++) {
        t4p::NotebookClass* notebook = visible[i];
        if (notebook->GetPageCount() == 0) {
            notebook->AddTriumphPage(t4p::FILE_TYPE_PHP);
        }
    }
}
Пример #4
0
MyFrame::~MyFrame()
{
    m_mgr.UnInit();
}
Пример #5
0
MyFrame::MyFrame()
        
{
	HoeEditor::BaseEditor::Create("Theatre Editor");
    // tell wxAuiManager to manage this frame
    m_mgr.SetManagedWindow(this);

    // min size for the frame itself isn't completely done.
    // see the end up wxAuiManager::Update() for the test
    // code. For now, just hard code a frame minimum size
    SetMinSize(wxSize(400,300));

	// vytvorit menu
    // file
    wxMenu * menuFile = new wxMenu;
	menuFile->Append(HoeEditor::ID_NEW, _("&New...\tCtrl+N"), _("Creates a new file or project."));
	menuFile->Append(HoeEditor::ID_OPEN, _("&Open...\tCtrl+O"), _("Open an existing file."));
	menuFile->AppendSeparator();
	menuFile->Append(HoeEditor::ID_SAVE, _("&Save\tCtrl+S"), _("Save file."));
	menuFile->Append(HoeEditor::ID_SAVEAS, _("Save &As..."), _("Save file."));
	menuFile->AppendSeparator();
	menuFile->Append(HoeEditor::ID_QUIT, _("E&xit\tAlt-F4"), _("Quit this program")); 

    wxMenu * menuView = new wxMenu;
	menuView->AppendCheckItem(HoeEditor::ID_VIEWFULLSCREEN, _("F&ull Screen\tF12"), _("Switch to fullscreen."));
	menuView->AppendCheckItem(ID_BACKGROUND, _("Change Background Image..."), _("Load background image."));

	wxMenu * menuTools = new wxMenu;
	menuTools->Append(ID_SHOWRES, _("&Resource Manager..."), _("Resource Manager"));
#ifndef HOE_STATIC
	menuTools->Append(HoeEditor::ID_ENGINE, _("&Load Engine...\tF10"), _("Load engine from library"));
#endif

	wxMenu * menuInsert = new wxMenu;
	menuInsert->Append(ID_STATICITEM, _("Picture Item"),_("New picture item."));
	menuInsert->Append(ID_COLORRECT, _("Color Rect Item"),_("New color Rect item."));
	menuInsert->Append(ID_INFOITEM, _("Info Item"),_("New info item."));
	menuInsert->Append(ID_BUTTONITEM, _("Button Item"),_("New button item."));
	menuInsert->Append(ID_DIGICOUNTERITEM, _("Digi counter Item"),_("New digi counter item."));
	menuInsert->Append(ID_FONTITEM, _("Font Item"),_("New font item."));

    // now append the freshly created menu to the menu bar...
    m_menu = new wxMenuBar(/*wxMB_DOCKABLE*/);
    m_menu->Append(menuFile, _("&File"));
    m_menu->Append(menuInsert, _("&Insert"));
    m_menu->Append(menuView, _("&View"));
    m_menu->Append(menuTools, _("&Tools"));
	
    // ... and attach this menu bar to the frame
    SetMenuBar(m_menu); 

	wxStatusBar *statbar = CreateStatusBar();
	statbar->SetFieldsCount(3);

    // create some center panes
    /*wxTextCtrl* text1 = new wxTextCtrl(this, -1, _("Pane 1 - sample text"),
                     wxDefaultPosition, wxSize(200,150),
                     wxNO_BORDER | wxTE_MULTILINE);
                                       
    wxTextCtrl* text3 = new wxTextCtrl(this, -1, _("Main content window"),
                     wxDefaultPosition, wxSize(200,150),
                     wxNO_BORDER | wxTE_MULTILINE);*/
	wxTreeCtrl * tree = new wxTreeCtrl(this);
	wxTreeItemId r = tree->AddRoot("root");
	tree->AppendItem(r,"item");
	tree->AppendItem(r,"item");
	tree->AppendItem(r,"item");
    HoeEditor::PropertyGrid * prop = new HoeEditor::PropertyGrid();
    prop->Create(this);
    view = new HoeEditor::EngineView();
    view->Create(this);
    //wx engine 
    // add the panes to the manager
    //m_mgr.AddPane(text1, wxLEFT, wxT("Pane Number One"));
    m_mgr.AddPane(tree, wxAuiPaneInfo().
                  Name(wxT("test7")).Caption(wxT("Client Size Reporter")).
                  CloseButton(true).MaximizeButton(true).MinimizeButton(true));
    m_mgr.AddPane(prop, wxLEFT, wxT("Properties"));
    m_mgr.AddPane(view, wxAuiPaneInfo().Centre().MaximizeButton(true).MinimizeButton(true));

    prop->Begin(NULL);
    prop->AppendCategory("Kategorie");
    prop->AppendString(0, "String", "hodnota", 0, "Nastavuje jen testovaci hodnotu");
	prop->AppendAngle(1, "Uhel", 2.1f, 0, "Nastaveni uhlu");
	prop->AppendColor(2, "Barva", 0xff00eecc, 0, "Vyber barvy");
	const char * list[] = {"A","B","C",NULL}; long values[] = {1,0,2,0};
	prop->AppendList(3, "Vyber", list, values, 0, 0, "Vyber z listu hodno (maskovane jako cisla)");
    prop->End();
    
    // "commit" all changes made to wxAuiManager
    m_mgr.Update();

    view->SetEnginePath("../Hoe/bin/Hoe3Dd_D3D9.dll");
    
}