예제 #1
0
wxraytracerFrame::wxraytracerFrame(const wxPoint& pos, const wxSize& size)
    : wxFrame((wxFrame *)NULL, -1, wxT( "Ray Tracer" ), pos, size)
{
    wxMenu *menuFile = new wxMenu;

    menuFile->Append(Menu_File_Open, wxT("&Open..."   ));
    menuFile->Append(Menu_File_Save, wxT("&Save As..."));
    menuFile->AppendSeparator();
    menuFile->Append(Menu_File_Quit, wxT("E&xit"));

    menuFile->Enable(menuFile->FindItem(wxT("&Save As...")), FALSE);

    wxMenu *menuRender = new wxMenu;

    menuRender->Append(Menu_Render_Start , wxT("&Start" ));
    menuRender->Append(Menu_Render_Pause , wxT("&Pause" ));
    menuRender->Append(Menu_Render_Resume, wxT("&Resume"));

    menuRender->Enable(menuRender->FindItem(wxT("&Start" )), TRUE );
    menuRender->Enable(menuRender->FindItem(wxT("&Pause" )), FALSE);
    menuRender->Enable(menuRender->FindItem(wxT("&Resume")), FALSE);

    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append(menuFile  , wxT("&File"  ));
    menuBar->Append(menuRender, wxT("&Render"));

    SetMenuBar( menuBar );

    canvas = new RenderCanvas(this);

    CreateStatusBar();
    SetStatusText(wxT("Ready"));

    wxIcon icon(main_xpm);
    SetIcon(icon);

    wxStatusBar* statusBar = GetStatusBar();
    int widths[] = {150,300};
    statusBar->SetFieldsCount(2, widths);
}
예제 #2
0
// Create the CProgressCtrl as a child of the status bar positioned
// over the first pane, extending "nSize" percentage across pane.
// Sets the range to be 0 to MaxValue, with a step of 1.
BOOL CProgressBar::Create(LPCTSTR strMessage, int nSize /*=100*/, 
						  int MaxValue /*=100*/, BOOL bSmooth /*=FALSE*/, 
                          int nPane /*=0*/)
{
	BOOL bSuccess = FALSE;
	
	CStatusBar *pStatusBar = GetStatusBar();
	if (!pStatusBar)
		return FALSE;

	DWORD dwStyle = WS_CHILD|WS_VISIBLE;
#ifdef PBS_SMOOTH	 
	if (bSmooth)
		dwStyle |= PBS_SMOOTH;
#endif

	// Get CRect coordinates for requested status bar pane
	CRect PaneRect;
	pStatusBar->GetItemRect(nPane, &PaneRect);

	// Create the progress bar
	bSuccess = CProgressCtrl::Create(dwStyle, PaneRect, pStatusBar, 1);
	ASSERT(bSuccess);
	if (!bSuccess)
		return FALSE;

	// Set range and step
	SetRange(0, MaxValue);
	SetStep(1);

	m_strMessage  = strMessage;
	m_nSize 	  = nSize;
	m_nPane 	  = nPane;
    m_strPrevText = pStatusBar->GetPaneText(m_nPane); 

	// Resize the control to its desired width
	Resize();

	return TRUE;
}
예제 #3
0
void MainFrame::OnUpdateUI(wxUpdateUIEvent& event)
{
    PicViewCtrl* pCtrl = m_pCenterPageManager->GetPicViewCtrl(0);
    wxSlider* pSlider = ((HEVCStatusBar*)GetStatusBar())->GetSlider();
    switch(event.GetId())
    {
    case ID_ReOpenWrongConfigYUVFile:
    case ID_GoToNextFrame:
    case ID_GoToPreFrame:
    case ID_Play_Pause:
    case ID_FastForward:
    case ID_FastBackward:
        if(!m_bOPened)
            pSlider->SetValue(0);
        pSlider->Enable(m_bOPened);
        event.Enable(m_bOPened);
        break;
    case ID_SwitchGrid:
        event.Check(pCtrl->IsShowGrid());
        break;
    case ID_Switch_YUV:
        event.Check(m_eYUVComponentChoose == MODE_ORG);
        break;
    case ID_Switch_Y:
        event.Check(m_eYUVComponentChoose == MODE_Y);
        break;
    case ID_Switch_U:
        event.Check(m_eYUVComponentChoose == MODE_U);
        break;
    case ID_Switch_V:
        event.Check(m_eYUVComponentChoose == MODE_V);
        break;
    case ID_SwitchfitMode:
        event.Check(pCtrl->GetFitMode());
        break;
    case ID_SwitchHEXPixel:
        event.Check(m_pPixelViewCtrl->GetHEXFormat());
        break;
    }
}
예제 #4
0
파일: fdcframe.cpp 프로젝트: aladur/flexemu
void FlexChildFrame::UpdateFrom(NotifyId id, void *)
{
    if (!listCtrl)
    {
        return;
    }

    if (id == NotifyId::UpdateStatusBar)
    {        
        wxStatusBar *sBar = GetStatusBar();

        if (sBar != nullptr)
        {
            wxString buf;

            buf.Printf(_("%d File(s) selected"), listCtrl->GetFileCount());
            sBar->SetStatusText(buf, 1);
            buf.Printf(_("%d Byte"), listCtrl->GetTotalSize());
            sBar->SetStatusText(buf, 2);
        }
    }
}
예제 #5
0
// Default menu selection behaviour - display a help string
void wxMDIParentFrame::OnMenuHighlight(wxMenuEvent& event)
{
    if (GetStatusBar())
    {
        if (event.GetMenuId() == -1)
            SetStatusText("");
        else
        {
            wxMenuBar *menuBar = (wxMenuBar*) NULL;
            if (GetActiveChild())
                menuBar = GetActiveChild()->GetMenuBar();
            else
                menuBar = GetMenuBar();
            if (menuBar)
            {
                wxString helpString(menuBar->GetHelpString(event.GetMenuId()));
                if (helpString != "")
                    SetStatusText(helpString);
            }
        }
    }
}
예제 #6
0
void CFrame::OnEditPaste() 
{
   CImageDoc* pDoc = (CImageDoc*)CApp::GetApp().demoTemplate->OpenDocumentFile(NULL); 
   BOOL bOK = (pDoc != NULL);
	if (bOK)
   {
      bOK = OpenClipboard();
      if (bOK)
      {
			CImage((HBITMAP)::GetClipboardData(CF_BITMAP)).Detach(&pDoc->m_image);
         ::CloseClipboard();

		   CString str;
		   str.Format(_T("Clipboard Image %d"),CApp::GetApp().m_nDocCount++);
		   pDoc->SetTitle(str);
         pDoc->UpdateAllViews(NULL, CImageDoc::ENUM_hint_newimage);
		   
		   str.Format(_T("(%dx%dx%d)"),pDoc->GetImage().GetWidth(),pDoc->GetImage().GetHeight(),pDoc->GetImage().GetBPP());
		   CStatusBar& statusBar = GetStatusBar();
		   statusBar.SetPaneText(2, str);
      }
	}
}
예제 #7
0
void MyFrame::OnSetStatusText(wxCommandEvent& WXUNUSED(event))
{
    wxStatusBar *sb = GetStatusBar();
    if (!sb)
        return;

    wxString txt = wxGetTextFromUser
                   (
                        wxString::Format
                        (
                            "Enter the text from for the field #%d",
                            m_field
                        ),
                        SAMPLE_DIALOGS_TITLE,
                        sb->GetStatusText(m_field),
                        this
                   );

    if ( txt.empty() )
        return;

    sb->SetStatusText(txt, m_field);
}
예제 #8
0
파일: mdi.cpp 프로젝트: beanhome/dev
bool wxMDIParentFrame::ShouldBeVisible() const
{
    for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
          node;
          node = node->GetNext() )
    {
        wxWindow *win = node->GetData();

        if ( win->IsShown()
                && !wxDynamicCast(win, wxMDIChildFrame)
#if wxUSE_STATUSBAR
                && win != (wxWindow*) GetStatusBar()
#endif
                && win != GetClientWindow() )
        {
            // if we have a non-MDI child, do remain visible so that it could
            // be used
            return true;
        }
    }

    return false;
}
예제 #9
0
void CProgressBar::Clear()
{
	if (!IsWindow(GetSafeHwnd()))
		return;

	// Hide the window. This is necessary so that a cleared
	// window is not redrawn if "Resize" is called
	ModifyStyle(WS_VISIBLE, 0);

	CString str;
	if (m_nPane == 0)
		str.LoadString(AFX_IDS_IDLEMESSAGE);   // Get the IDLE_MESSAGE
      else
		str = m_strPrevText;                   // Restore previous text

	// Place the IDLE_MESSAGE in the status bar 
	CStatusBar *pStatusBar = GetStatusBar();
	if (pStatusBar)
	{
		pStatusBar->SetPaneText(m_nPane, str);
		pStatusBar->UpdateWindow();
	}
}
예제 #10
0
// Pass true to show full screen, false to restore.
bool wxFrame::ShowFullScreen( bool bShow, long lStyle )
{
    if (bShow)
    {
        if (IsFullScreen())
            return false;

        m_bFsIsShowing = true;
        m_lFsStyle = lStyle;

#if wxUSE_TOOLBAR
        wxToolBar*                  pTheToolBar = GetToolBar();
#endif //wxUSE_TOOLBAR

#if wxUSE_STATUSBAR
        wxStatusBar*                pTheStatusBar = GetStatusBar();
#endif //wxUSE_STATUSBAR

        int                         nDummyWidth;

#if wxUSE_TOOLBAR
        if (pTheToolBar)
            pTheToolBar->GetSize(&nDummyWidth, &m_nFsToolBarHeight);
#endif //wxUSE_TOOLBAR

#if wxUSE_STATUSBAR
        if (pTheStatusBar)
            pTheStatusBar->GetSize(&nDummyWidth, &m_nFsStatusBarHeight);
#endif //wxUSE_STATUSBAR

#if wxUSE_TOOLBAR
        //
        // Zap the toolbar, menubar, and statusbar
        //
        if ((lStyle & wxFULLSCREEN_NOTOOLBAR) && pTheToolBar)
        {
            pTheToolBar->SetSize(wxDefaultCoord,0);
            pTheToolBar->Show(false);
        }
#endif //wxUSE_TOOLBAR

        if (lStyle & wxFULLSCREEN_NOMENUBAR)
        {
            ::WinSetParent(m_hMenu, m_hFrame, FALSE);
            ::WinSetOwner(m_hMenu, m_hFrame);
            ::WinSendMsg((HWND)m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
        }

#if wxUSE_STATUSBAR
        //
        // Save the number of fields in the statusbar
        //
        if ((lStyle & wxFULLSCREEN_NOSTATUSBAR) && pTheStatusBar)
        {
            m_nFsStatusBarFields = pTheStatusBar->GetFieldsCount();
            SetStatusBar(NULL);
            delete pTheStatusBar;
        }
        else
            m_nFsStatusBarFields = 0;
#endif //wxUSE_STATUSBAR

        //
        // Zap the frame borders
        //

        //
        // Save the 'normal' window style
        //
        m_lFsOldWindowStyle = ::WinQueryWindowULong(m_hFrame, QWL_STYLE);

        //
        // Save the old position, width & height, maximize state
        //
        m_vFsOldSize = GetRect();
        m_bFsIsMaximized = IsMaximized();

        //
        // Decide which window style flags to turn off
        //
        LONG lNewStyle = m_lFsOldWindowStyle;
        LONG lOffFlags = 0;

        if (lStyle & wxFULLSCREEN_NOBORDER)
            lOffFlags |= FCF_BORDER;
        if (lStyle & wxFULLSCREEN_NOCAPTION)
            lOffFlags |= (FCF_TASKLIST | FCF_SYSMENU);

        lNewStyle &= (~lOffFlags);

        //
        // Change our window style to be compatible with full-screen mode
        //
        ::WinSetWindowULong((HWND)m_hFrame, QWL_STYLE, (ULONG)lNewStyle);

        //
        // Resize to the size of the desktop
        int                         nWidth;
        int                         nHeight;

        RECTL                       vRect;

        ::WinQueryWindowRect(HWND_DESKTOP, &vRect);
        nWidth = vRect.xRight - vRect.xLeft;
        //
        // Remember OS/2 is backwards!
        //
        nHeight = vRect.yTop - vRect.yBottom;

        SetSize( nWidth, nHeight);

        //
        // Now flush the window style cache and actually go full-screen
        //
        ::WinSetWindowPos( (HWND) GetParent()->GetHWND()
                          ,HWND_TOP
                          ,0
                          ,0
                          ,nWidth
                          ,nHeight
                          ,SWP_SIZE | SWP_SHOW
                         );

        wxSize sz( nWidth, nHeight );
        wxSizeEvent vEvent( sz, GetId() );

        HandleWindowEvent(vEvent);
        return true;
    }
    else
    {
        if (!IsFullScreen())
            return false;

        m_bFsIsShowing = false;

#if wxUSE_TOOLBAR
        wxToolBar*                  pTheToolBar = GetToolBar();

        //
        // Restore the toolbar, menubar, and statusbar
        //
        if (pTheToolBar && (m_lFsStyle & wxFULLSCREEN_NOTOOLBAR))
        {
            pTheToolBar->SetSize(wxDefaultCoord, m_nFsToolBarHeight);
            pTheToolBar->Show(true);
        }
#endif //wxUSE_TOOLBAR

#if wxUSE_STATUSBAR
        if ((m_lFsStyle & wxFULLSCREEN_NOSTATUSBAR) && (m_nFsStatusBarFields > 0))
        {
            CreateStatusBar(m_nFsStatusBarFields);
//          PositionStatusBar();
        }
#endif //wxUSE_STATUSBAR

        if ((m_lFsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
        {
            ::WinSetParent(m_hMenu, m_hFrame, FALSE);
            ::WinSetOwner(m_hMenu, m_hFrame);
            ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
        }
        Maximize(m_bFsIsMaximized);

        ::WinSetWindowULong( m_hFrame
                            ,QWL_STYLE
                            ,(ULONG)m_lFsOldWindowStyle
                           );
        ::WinSetWindowPos( (HWND) GetParent()->GetHWND()
                          ,HWND_TOP
                          ,m_vFsOldSize.x
                          ,m_vFsOldSize.y
                          ,m_vFsOldSize.width
                          ,m_vFsOldSize.height
                          ,SWP_SIZE | SWP_SHOW
                         );
    }
    return wxFrameBase::ShowFullScreen(bShow, lStyle);
} // end of wxFrame::ShowFullScreen
예제 #11
0
파일: frame.cpp 프로젝트: hfvw/wxExtension
void wxExFrame::OnCommand(wxCommandEvent& command)
{
    m_IsCommand = true;

    switch (command.GetId())
    {
    case wxID_FIND:
    {
        if (m_FindReplaceDialog != NULL)
        {
            m_FindReplaceDialog->Destroy();
        }

        m_FindFocus = wxWindow::FindFocus();

        // If stc text is selected, copy to find replace data.
        wxExSTC* stc = GetSTC();

        if (stc != NULL)
        {
            stc->GetFindString();
        }

        m_FindReplaceDialog = new wxFindReplaceDialog(
            this, wxExFindReplaceData::Get(), _("Find"));
        m_FindReplaceDialog->Show();
    }
    break;

    case wxID_REPLACE:
    {
        if (m_FindReplaceDialog != NULL)
        {
            m_FindReplaceDialog->Destroy();
        }

        m_FindFocus = wxWindow::FindFocus();

        // If stc text is selected, copy to find replace data.
        wxExSTC* stc = GetSTC();

        if (stc != NULL)
        {
            stc->GetFindString();
        }

        m_FindReplaceDialog = new wxFindReplaceDialog(
            this,
            wxExFindReplaceData::Get(),
            _("Replace"),
            wxFR_REPLACEDIALOG);
        m_FindReplaceDialog->Show();
    }
    break;

    case wxID_OPEN:
        if (!command.GetString().empty())
        {
            wxExSTC* stc = GetSTC();

            if (stc != NULL)
            {
                wxSetWorkingDirectory(stc->GetFileName().GetPath());
            }

            wxArrayString files;
            wxStringTokenizer tkz(command.GetString());

            while (tkz.HasMoreTokens())
            {
                files.Add(tkz.GetNextToken());
            }

            wxExOpenFiles(this, files);
        }
        else
        {
            wxExOpenFilesDialog(this);
        }
        break;

    case ID_VIEW_MENUBAR:
        if (GetMenuBar() != NULL)
        {
            SetMenuBar(NULL);
        }
        else
        {
            SetMenuBar(m_MenuBar);
        }
        break;

    case ID_VIEW_STATUSBAR:
#if wxUSE_STATUSBAR
        if (GetStatusBar() != NULL)
        {
            GetStatusBar()->Show(!GetStatusBar()->IsShown());
            SendSizeEvent();
        }
#endif
        break;

    case ID_VIEW_TITLEBAR:
        if (!(GetWindowStyleFlag() & wxCAPTION))
        {
            SetWindowStyleFlag(wxDEFAULT_FRAME_STYLE);
            Refresh();
        }
        else
        {
            SetWindowStyleFlag(GetWindowStyleFlag() & ~wxCAPTION);
            Refresh();
        }
        break;

    default:
        wxFAIL;
        break;
    }
}
예제 #12
0
void MainFrame::PropertyModified(shared_ptr<Property> prop)
{
	GetStatusBar()->SetStatusText(wxT("Property Modified!"));
	UpdateFrame();
}
예제 #13
0
void MainFrame::ObjectRemoved(shared_ptr<ObjectBase> obj)
{
	GetStatusBar()->SetStatusText(wxT("Object Removed!"));
	UpdateFrame();
}
예제 #14
0
파일: frame.cpp 프로젝트: mark711/Cafu
void wxFrame::PositionToolBar()
{
    // TODO: we want to do something different in WinCE, because the toolbar
    //       should be associated with the commandbar, instead of being
    //       independent window.
#if !defined(WINCE_WITHOUT_COMMANDBAR)
    wxToolBar *toolbar = GetToolBar();
    if ( toolbar && toolbar->IsShown() )
    {
        // don't call our (or even wxTopLevelWindow) version because we want
        // the real (full) client area size, not excluding the tool/status bar
        int width, height;
        wxWindow::DoGetClientSize(&width, &height);

#if wxUSE_STATUSBAR
        wxStatusBar *statbar = GetStatusBar();
        if ( statbar && statbar->IsShown() )
        {
            height -= statbar->GetClientSize().y;
        }
#endif // wxUSE_STATUSBAR

        int tx, ty, tw, th;
        toolbar->GetPosition( &tx, &ty );
        toolbar->GetSize( &tw, &th );

        int x, y;
        if ( toolbar->HasFlag(wxTB_BOTTOM) )
        {
            x = 0;
            y = height - th;
        }
        else if ( toolbar->HasFlag(wxTB_RIGHT) )
        {
            x = width - tw;
            y = 0;
        }
        else // left or top
        {
            x = 0;
            y = 0;
        }

#if defined(WINCE_WITH_COMMANDBAR)
        // We're using a commandbar - so we have to allow for it.
        if (GetMenuBar() && GetMenuBar()->GetCommandBar())
        {
            RECT rect;
            ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect);
            y = rect.bottom - rect.top;
        }
#endif // WINCE_WITH_COMMANDBAR

        if ( toolbar->HasFlag(wxTB_BOTTOM) )
        {
            if ( ty < 0 && ( -ty == th ) )
                ty = height - th;
            if ( tx < 0 && (-tx == tw ) )
                tx = 0;
        }
        else if ( toolbar->HasFlag(wxTB_RIGHT) )
        {
            if( ty < 0 && ( -ty == th ) )
                ty = 0;
            if( tx < 0 && ( -tx == tw ) )
                tx = width - tw;
        }
        else // left or top
        {
            if (ty < 0 && (-ty == th))
                ty = 0;
            if (tx < 0 && (-tx == tw))
                tx = 0;
        }

        int desiredW,
            desiredH;

        if ( toolbar->IsVertical() )
        {
            desiredW = tw;
            desiredH = height;
        }
        else
        {
            desiredW = width;
            desiredH = th;
        }

        // use the 'real' MSW position here, don't offset relatively to the
        // client area origin
        toolbar->SetSize(x, y, desiredW, desiredH, wxSIZE_NO_ADJUSTMENTS);

    }
#endif // !WINCE_WITH_COMMANDBAR
}
예제 #15
0
void PluginManager::SetStatusMessage(const wxString& msg, int col, int seconds_to_live)
{
    wxUnusedVar(col);
    wxUnusedVar(seconds_to_live);
    GetStatusBar()->SetMessage(msg);
}
예제 #16
0
CFrame::CFrame(wxFrame* parent,
		wxWindowID id,
		const wxString& title,
		const wxPoint& pos,
		const wxSize& size,
		bool _UseDebugger,
		bool _BatchMode,
		bool ShowLogWindow,
		long style)
	: CRenderFrame(parent, id, title, pos, size, style)
	, g_pCodeWindow(NULL), g_NetPlaySetupDiag(NULL), g_CheatsWindow(NULL)
	, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
	, m_GameListCtrl(NULL), m_Panel(NULL)
	, m_RenderFrame(NULL), m_RenderParent(NULL)
	, m_LogWindow(NULL), m_LogConfigWindow(NULL)
	, m_FifoPlayerDlg(NULL), UseDebugger(_UseDebugger)
	, m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
	, m_bGameLoading(false)
{
	for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
		bFloatWindow[i] = false;

	if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true;

	// Give it a console early to show potential messages from this onward
	ConsoleListener *Console = LogManager::GetInstance()->GetConsoleListener();
	if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();

	// Start debugging maximized
	if (UseDebugger) this->Maximize(true);
	// Debugger class
	if (UseDebugger)
	{
		g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, IDM_CODEWINDOW);
		LoadIniPerspectives();
		g_pCodeWindow->Load();
	}

	// Create toolbar bitmaps
	InitBitmaps();

	// Give it a status bar
	SetStatusBar(CreateStatusBar(2, wxST_SIZEGRIP, ID_STATUSBAR));
	if (!SConfig::GetInstance().m_InterfaceStatusbar)
		GetStatusBar()->Hide();

	// Give it a menu bar
	CreateMenu();

	// ---------------
	// Main panel
	// This panel is the parent for rendering and it holds the gamelistctrl
	m_Panel = new CPanel(this, IDM_MPANEL);

	m_GameListCtrl = new CGameListCtrl(m_Panel, LIST_CTRL,
			wxDefaultPosition, wxDefaultSize,
			wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT);

	wxBoxSizer *sizerPanel = new wxBoxSizer(wxHORIZONTAL);
	sizerPanel->Add(m_GameListCtrl, 1, wxEXPAND | wxALL);
	m_Panel->SetSizer(sizerPanel);
	// ---------------

	// Manager
	m_Mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);

	m_Mgr->AddPane(m_Panel, wxAuiPaneInfo()
			.Name(_T("Pane 0")).Caption(_T("Pane 0")).PaneBorder(false)
			.CaptionVisible(false).Layer(0).Center().Show());
	if (!g_pCodeWindow)
		m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo()
				.Name(_T("Pane 1")).Caption(_("Logging")).CaptionVisible(true)
				.Layer(0).FloatingSize(wxSize(600, 350)).CloseButton(true).Hide());
	AuiFullscreen = m_Mgr->SavePerspective();

	// Create toolbar
	RecreateToolbar();
	if (!SConfig::GetInstance().m_InterfaceToolbar) DoToggleToolbar(false);

	m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW);
	m_LogWindow->Hide();
	m_LogWindow->Disable();

	g_TASInputDlg = new TASInputDlg(this);
	Movie::SetInputManip(TASManipFunction);

	State::SetOnAfterLoadCallback(OnAfterLoadCallback);

	// Setup perspectives
	if (g_pCodeWindow)
	{
		// Load perspective
		DoLoadPerspective();
	}
	else
	{
		if (SConfig::GetInstance().m_InterfaceLogWindow)
			ToggleLogWindow(true);
		if (SConfig::GetInstance().m_InterfaceLogConfigWindow)
			ToggleLogConfigWindow(true);
		if (SConfig::GetInstance().m_InterfaceConsole)
			ToggleConsole(true);
	}

	// Show window
	Show();

	// Commit
	m_Mgr->Update();

	#ifdef _WIN32
		SetToolTip(wxT(""));
		GetToolTip()->SetAutoPop(25000);
	#endif

	#if defined(HAVE_XRANDR) && HAVE_XRANDR
		m_XRRConfig = new X11Utils::XRRConfiguration(X11Utils::XDisplayFromHandle(GetHandle()),
				X11Utils::XWindowFromHandle(GetHandle()));
	#endif

	// -------------------------
	// Connect event handlers

	m_Mgr->Bind(wxEVT_AUI_RENDER, &CFrame::OnManagerResize, this);
	// ----------

	// Update controls
	UpdateGUI();
}
예제 #17
0
파일: frame.cpp 프로젝트: jfiguinha/Regards
void wxFrame::PositionToolBar()
{
    wxToolBar *toolbar = GetToolBar();
    if ( toolbar && toolbar->IsShown() )
    {
        // don't call our (or even wxTopLevelWindow) version because we want
        // the real (full) client area size, not excluding the tool/status bar
        int width, height;
        wxWindow::DoGetClientSize(&width, &height);

#if wxUSE_STATUSBAR
        wxStatusBar *statbar = GetStatusBar();
        if ( statbar && statbar->IsShown() )
        {
            height -= statbar->GetClientSize().y;
        }
#endif // wxUSE_STATUSBAR

        int tx, ty, tw, th;
        toolbar->GetPosition( &tx, &ty );
        toolbar->GetSize( &tw, &th );

        int x, y;
        if ( toolbar->HasFlag(wxTB_BOTTOM) )
        {
            x = 0;
            y = height - th;
        }
        else if ( toolbar->HasFlag(wxTB_RIGHT) )
        {
            x = width - tw;
            y = 0;
        }
        else // left or top
        {
            x = 0;
            y = 0;
        }

        if ( toolbar->HasFlag(wxTB_BOTTOM) )
        {
            if ( ty < 0 && ( -ty == th ) )
                ty = height - th;
            if ( tx < 0 && (-tx == tw ) )
                tx = 0;
        }
        else if ( toolbar->HasFlag(wxTB_RIGHT) )
        {
            if( ty < 0 && ( -ty == th ) )
                ty = 0;
            if( tx < 0 && ( -tx == tw ) )
                tx = width - tw;
        }
        else // left or top
        {
            if (ty < 0 && (-ty == th))
                ty = 0;
            if (tx < 0 && (-tx == tw))
                tx = 0;
        }

        int desiredW,
            desiredH;

        if ( toolbar->IsVertical() )
        {
            desiredW = tw;
            desiredH = height;
        }
        else
        {
            desiredW = width;
            desiredH = th;
        }

        // use the 'real' MSW position here, don't offset relatively to the
        // client area origin
        toolbar->SetSize(x, y, desiredW, desiredH, wxSIZE_NO_ADJUSTMENTS);

    }
}
예제 #18
0
파일: assdraw.cpp 프로젝트: Aegisub/assdraw
ASSDrawFrame::ASSDrawFrame( wxApp *app, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
       : wxFrame(NULL, wxID_ANY, title, pos, size, style)
{
	m_app = app;
    m_mgr.SetManagedWindow(this);
#ifndef __UNIX__
    m_mgr.SetFlags(m_mgr.GetFlags() | wxAUI_MGR_ALLOW_ACTIVE_PANE);
#else
	m_mgr.SetFlags(wxAUI_MGR_ALLOW_FLOATING | wxAUI_MGR_ALLOW_ACTIVE_PANE | wxAUI_MGR_RECTANGLE_HINT);
#endif

    // set the frame icon
    SetIcon(wxICON(appico));

   	// Create status bar for the frame
    CreateStatusBar(3);
    int statwidths[] = { 64, -1, 64 };
    GetStatusBar()->SetStatusWidths(3, statwidths);
    SetStatusBarPane(1);

	InitializeDefaultSettings();

	// load config
	configfile = wxFileName(wxStandardPaths::Get().GetUserDataDir(), _T("ASSDraw3.cfg")).GetFullPath();

	bool firsttime = !::wxFileExists(configfile);
	if (firsttime) {
		wxFileName::Mkdir(wxStandardPaths::Get().GetUserDataDir(), wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
		wxFileOutputStream(configfile).Close();
	}
	wxFileInputStream cfgf(configfile);
	config = new wxFileConfig(cfgf);

	// nullify transformdlg
	transformdlg = NULL;

	Maximize(true);
	Show(true); // to get the right client size, must call Show() first

	// config
	LoadSettings();

	// THE CANVAS
    m_canvas = new ASSDrawCanvas( this , this );

	// shapes library
	shapelib = new ASSDrawShapeLibrary(this, this);

	// source text ctrl
	srctxtctrl = new ASSDrawSrcTxtCtrl(this, this);

	// settings
	settingsdlg = new ASSDrawSettingsDialog(this, this);
	settingsdlg->Init();

	SetMenus();
	SetToolBars();
	SetPanes();

	// config

	config->SetPath(_T("info"));
	wxString version;
	config->Read(_T("version"), &version);
	config->SetPath(_T(".."));

	default_perspective = m_mgr.SavePerspective(); // back up default perspective
	config->SetPath(_T("perspective"));
	wxString perspective;
	if (config->Read(_T("perspective"), &perspective) && version == VERSION) m_mgr.LoadPerspective(perspective, false);
	config->SetPath(_T(".."));

	config->SetPath(_T("library"));
	int n = 0;
	config->Read(_T("n"), &n);
	for (int i = 0; i < n; i++)
	{
		wxString libcmds;
		config->Read(wxString::Format(_T("%d"),i), &libcmds);
		shapelib->AddShapePreview(libcmds);
	}
	config->SetPath(_T(".."));

    m_mgr.Update();
	m_canvas->SetFocus();
	m_canvas->Show();

	wxSize clientsize = m_canvas->GetClientSize();
	m_canvas->ChangeZoomLevelTo(DEFAULT_SCALE, wxPoint(clientsize.x / 2, clientsize.y / 2));
	m_canvas->MoveCanvasOriginTo(clientsize.x / 2, clientsize.y / 2);
	UpdateASSCommandStringToSrcTxtCtrl(m_canvas->GenerateASS());

	UpdateFrameUI();
	ApplySettings();

	if (firsttime)
		_About();
	else if (!behaviors.nosplashscreen)
		_About(3);

	helpcontroller.SetParentWindow(this);
	helpcontroller.Initialize(wxFileName(::wxGetCwd(), _T("ASSDraw3.chm")).GetFullPath());
}
예제 #19
0
void wxSTEditorFrame::CreateOptions( const wxSTEditorOptions& options )
{
    m_options = options;

    wxConfigBase *config = GetConfigBase();
    wxSTEditorMenuManager *steMM = GetOptions().GetMenuManager();

    if (steMM && GetOptions().HasFrameOption(STF_CREATE_MENUBAR))
    {
        wxMenuBar *menuBar = GetMenuBar();

        if (!menuBar)
            menuBar = new wxMenuBar(wxMB_DOCKABLE);

        steMM->CreateMenuBar(menuBar, true);

        SetMenuBar(menuBar);
        wxAcceleratorHelper::SetAcceleratorTable(this, *steMM->GetAcceleratorArray());
        wxAcceleratorHelper::SetAccelText(menuBar, *steMM->GetAcceleratorArray());

        if (GetOptions().HasFrameOption(STF_CREATE_FILEHISTORY) && !GetOptions().GetFileHistory())
        {
            // If there is wxID_OPEN then we can use wxFileHistory to save them
            wxMenu* menu = NULL;
            wxMenuItem* item = menuBar->FindItem(wxID_OPEN, &menu);

            if (menu && item)
            {
                int open_index = menu->GetMenuItems().IndexOf(item);

                if (open_index != wxNOT_FOUND)
                {
                    wxMenu* submenu = new wxMenu();
                    menu->Insert(open_index + 1, wxID_ANY, _("Open &Recent"), submenu);
                    GetOptions().SetFileHistory(new wxFileHistory(9), false);
                    GetOptions().GetFileHistory()->UseMenu(submenu);
                    if (config)
                    {
                        GetOptions().LoadFileConfig(*config);
                    }
                }
            }

            GetOptions().SetMenuBar(menuBar);
        }
    }
    if (steMM && GetOptions().HasFrameOption(STF_CREATE_TOOLBAR))
    {
        wxToolBar* toolBar = (GetToolBar() != NULL) ? GetToolBar() : CreateToolBar();
        steMM->CreateToolBar(toolBar);
        GetOptions().SetToolBar(toolBar);
    }
    if ((GetStatusBar() == NULL) && GetOptions().HasFrameOption(STF_CREATE_STATUSBAR))
    {
        CreateStatusBar(1);
        GetOptions().SetStatusBar(GetStatusBar());
    }
    if (steMM)
    {
        if (GetOptions().HasEditorOption(STE_CREATE_POPUPMENU))
        {
            wxMenu* menu = steMM->CreateEditorPopupMenu();

            wxAcceleratorHelper::SetAccelText(menu, *steMM->GetAcceleratorArray());
            GetOptions().SetEditorPopupMenu(menu, false);
        }
        if (GetOptions().HasSplitterOption(STS_CREATE_POPUPMENU))
            GetOptions().SetSplitterPopupMenu(steMM->CreateSplitterPopupMenu(), false);
        if (GetOptions().HasNotebookOption(STN_CREATE_POPUPMENU))
            GetOptions().SetNotebookPopupMenu(steMM->CreateNotebookPopupMenu(), false);
    }

    if (!m_sideSplitter && GetOptions().HasFrameOption(STF_CREATE_SIDEBAR))
    {
        m_sideSplitter = new wxSplitterWindow(this, ID_STF_SIDE_SPLITTER);
        m_sideSplitter->SetMinimumPaneSize(10);
        m_sideNotebook = new wxNotebook(m_sideSplitter, ID_STF_SIDE_NOTEBOOK);
        m_steTreeCtrl  = new wxSTEditorTreeCtrl(m_sideNotebook, ID_STF_FILE_TREECTRL);
        m_dirCtrl      = new wxGenericDirCtrl(m_sideNotebook, ID_STF_FILE_DIRCTRL,
                                              wxFileName::GetCwd(),
                                              wxDefaultPosition, wxDefaultSize,
                                              wxDIRCTRL_3D_INTERNAL
#if wxCHECK_VERSION(2, 9, 2)
                                              |(GetOptions().HasFrameOption(STF_CREATE_NOTEBOOK) ? wxDIRCTRL_MULTIPLE : 0)
#endif // wxCHECK_VERSION(2, 9, 2)
                                              );

        m_sideNotebook->AddPage(m_steTreeCtrl, _("Files"));
        m_sideNotebook->AddPage(m_dirCtrl,     _("Open"));

        m_sideSplitterWin1 = m_sideNotebook;
    }

    if (!m_steNotebook && GetOptions().HasFrameOption(STF_CREATE_NOTEBOOK))
    {
        m_mainSplitter = new wxSplitterWindow(m_sideSplitter ? (wxWindow*)m_sideSplitter : (wxWindow*)this, ID_STF_MAIN_SPLITTER);
        m_mainSplitter->SetMinimumPaneSize(1);

        m_steNotebook = new wxSTEditorNotebook(m_mainSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize,
                                               wxCLIP_CHILDREN);
        m_steNotebook->CreateOptions(m_options);
        (void)m_steNotebook->InsertEditorSplitter(-1, wxID_ANY, GetOptions().GetDefaultFileName(), true);
        // update after adding a single page
        m_steNotebook->UpdateAllItems();
        m_mainSplitter->Initialize(m_steNotebook);
        m_mainSplitterWin1 = m_steNotebook;
        m_sideSplitterWin2 = m_mainSplitter;

        if (m_steTreeCtrl)
            m_steTreeCtrl->SetSTENotebook(m_steNotebook);
    }
    else if (!m_steSplitter && GetOptions().HasFrameOption(STF_CREATE_SINGLEPAGE))
    {
        m_mainSplitter = new wxSplitterWindow(m_sideSplitter ? (wxWindow*)m_sideSplitter : (wxWindow*)this, ID_STF_MAIN_SPLITTER);
        m_mainSplitter->SetMinimumPaneSize(1);

        m_steSplitter = new wxSTEditorSplitter(m_mainSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
        m_steSplitter->CreateOptions(m_options);
        m_mainSplitter->Initialize(m_steSplitter);
        m_mainSplitterWin1 = m_steSplitter;
    }
    //else user will set up the rest

    if (m_mainSplitter && m_mainSplitterWin1 && !m_resultsNotebook && GetOptions().HasFrameOption(STF_CREATE_RESULT_NOTEBOOK))
    {
        m_resultsNotebook = new wxNotebook(m_mainSplitter, wxID_ANY);

        m_findResultsEditor = new wxSTEditorFindResultsEditor(m_resultsNotebook, wxID_ANY);
        m_findResultsEditor->CreateOptionsFromEditorOptions(options);
        m_resultsNotebook->AddPage(m_findResultsEditor, _("Search Results"));

        wxSTEditorFindReplacePanel::SetFindResultsEditor(m_findResultsEditor);
        m_mainSplitter->SplitHorizontally(m_mainSplitterWin1, m_resultsNotebook, GetClientSize().GetHeight()*2/3);
        m_mainSplitterWin2 = m_resultsNotebook;
    }

    if (GetOptions().HasFrameOption(STF_CREATE_SIDEBAR) && GetSideSplitter() && m_sideSplitterWin1 && m_sideSplitterWin2)
    {
        GetSideSplitter()->SplitVertically(m_sideSplitterWin1, m_sideSplitterWin2, m_sideSplitter_pos);
    }

#if wxUSE_DRAG_AND_DROP
    if (GetOptions().HasFrameOption(STF_DO_DRAG_AND_DROP))
    {
        SetDropTarget(new wxSTEditorFileDropTarget(this));
    }
#endif //wxUSE_DRAG_AND_DROP

    if (GetOptions().HasConfigOption(STE_CONFIG_FINDREPLACE) && config)
    {
        if (GetOptions().GetFindReplaceData() &&
            !GetOptions().GetFindReplaceData()->HasLoadedConfig())
            GetOptions().GetFindReplaceData()->LoadConfig(*config);
    }

    if (config)
        LoadConfig(*config);

    // The config may change the frame size so relayout the splitters
    if (m_mainSplitter && m_mainSplitter->IsSplit()) //m_mainSplitterWin1 && m_resultsNotebook)
        m_mainSplitter->SetSashPosition(GetClientSize().GetHeight()*2/3);

    UpdateAllItems();

    // if we've got an editor let it update gui
    wxSTEditor *editor = GetEditor();
    if (editor)
        editor->UpdateAllItems();
}
예제 #20
0
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
                                FRAME_T aFrameType,
                                const wxString& aTitle,
                                const wxPoint& aPos, const wxSize& aSize,
                                long aStyle, const wxString & aFrameName ) :
    KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
{
    m_file_checker        = NULL;

    m_drawToolBar         = NULL;
    m_optionsToolBar      = NULL;
    m_gridSelectBox       = NULL;
    m_zoomSelectBox       = NULL;
    m_HotkeysZoomAndGridList = NULL;

    m_canvas              = NULL;
    m_galCanvas           = NULL;
    m_galCanvasActive     = false;
    m_messagePanel        = NULL;
    m_currentScreen       = NULL;
    m_toolId              = ID_NO_TOOL_SELECTED;
    m_lastDrawToolId      = ID_NO_TOOL_SELECTED;
    m_showAxis            = false;      // true to draw axis.
    m_showBorderAndTitleBlock = false;  // true to display reference sheet.
    m_showGridAxis        = false;      // true to draw the grid axis
    m_showOriginAxis      = false;      // true to draw the grid origin
    m_cursorShape         = 0;
    m_LastGridSizeId      = 0;
    m_drawGrid            = true;       // hide/Show grid. default = show
    m_gridColor           = DARKGRAY;   // Default grid color
    m_showPageLimits      = false;
    m_drawBgColor         = BLACK;      // the background color of the draw canvas:
                                        // BLACK for Pcbnew, BLACK or WHITE for eeschema
    m_snapToGrid          = true;
    m_MsgFrameHeight      = EDA_MSG_PANEL::GetRequiredHeight();
    m_movingCursorWithKeyboard = false;

    m_auimgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE);

    CreateStatusBar( 6 );

    // set the size of the status bar subwindows:

    wxWindow* stsbar = GetStatusBar();

    int dims[] = {

        // remainder of status bar on far left is set to a default or whatever is left over.
        -1,

        // When using GetTextSize() remember the width of character '1' is not the same
        // as the width of '0' unless the font is fixed width, and it usually won't be.

        // zoom:
        GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,

        // cursor coords
        GetTextSize( wxT( "X 0234.567890  Y 0234.567890" ), stsbar ).x + 10,

        // delta distances
        GetTextSize( wxT( "dx 0234.567890  dx 0234.567890  d 0234.567890" ), stsbar ).x + 10,

        // units display, Inches is bigger than mm
        GetTextSize( _( "Inches" ), stsbar ).x + 10,

        // Size for the panel used as "Current tool in play": will take longest string from
        // void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) in pcbnew/edit.cpp
        GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
    };

    SetStatusWidths( DIM( dims ), dims );

    // Create child subwindows.
    GetClientSize( &m_FrameSize.x, &m_FrameSize.y );
    m_FramePos.x   = m_FramePos.y = 0;
    m_FrameSize.y -= m_MsgFrameHeight;

    m_canvas = new EDA_DRAW_PANEL( this, -1, wxPoint( 0, 0 ), m_FrameSize );
    m_messagePanel  = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ),
                                         wxSize( m_FrameSize.x, m_MsgFrameHeight ) );

    m_messagePanel->SetBackgroundColour( MakeColour( LIGHTGRAY ) );
}
예제 #21
0
파일: FrameAui.cpp 프로젝트: Pnum/dolphin
void CFrame::OnPerspectiveMenu(wxCommandEvent& event)
{
	ClearStatusBar();

	switch (event.GetId())
	{
		case IDM_SAVE_PERSPECTIVE:
			if (Perspectives.size() == 0)
			{
				wxMessageBox(_("Please create a perspective before saving"),
						_("Notice"), wxOK, this);
				return;
			}
			SaveIniPerspectives();
			GetStatusBar()->SetStatusText(StrToWxStr(std::string
						("Saved " + Perspectives[ActivePerspective].Name)), 0);
			break;
		case IDM_PERSPECTIVES_ADD_PANE:
			AddPane();
			break;
		case IDM_EDIT_PERSPECTIVES:
			m_bEdit = event.IsChecked();
			TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES);
			break;
		case IDM_ADD_PERSPECTIVE:
			{
				wxTextEntryDialog dlg(this,
						_("Enter a name for the new perspective:"),
						_("Create new perspective"));
				wxString DefaultValue = wxString::Format(_("Perspective %d"), (int)(Perspectives.size() + 1));
				dlg.SetValue(DefaultValue);

				int Return = 0;
				bool DlgOk = false;

				while (!DlgOk)
				{
					Return = dlg.ShowModal();
					if (Return == wxID_CANCEL)
					{
						return;
					}
					else if (dlg.GetValue().Find(",") != -1)
					{
						wxMessageBox(_("The name cannot contain the character ','"),
								_("Notice"), wxOK, this);
						wxString Str = dlg.GetValue();
						Str.Replace(",", "", true);
						dlg.SetValue(Str);
					}
					else if (dlg.GetValue().IsSameAs(""))
					{
						wxMessageBox(_("The name cannot be empty"),
								_("Notice"), wxOK, this);
						dlg.SetValue(DefaultValue);
					}
					else
					{
						DlgOk = true;
					}
				}

				SPerspectives Tmp;
				Tmp.Name = WxStrToStr(dlg.GetValue());
				Tmp.Perspective = m_Mgr->SavePerspective();

				ActivePerspective = (u32)Perspectives.size();
				Perspectives.push_back(Tmp);

				UpdateCurrentPerspective();
				PopulateSavedPerspectives();
			}
			break;
		case IDM_TAB_SPLIT:
			m_bTabSplit = event.IsChecked();
			ToggleNotebookStyle(m_bTabSplit, wxAUI_NB_TAB_SPLIT);
			break;
		case IDM_NO_DOCKING:
			m_bNoDocking = event.IsChecked();
			TogglePaneStyle(m_bNoDocking, IDM_NO_DOCKING);
			break;
	}
}
예제 #22
0
파일: wxMFrame.cpp 프로젝트: vadz/mahogany
void
wxMFrame::OnMenuCommand(int id)
{
   // is it a module generated entry?
   if(id >= WXMENU_MODULES_BEGIN && id < WXMENU_MODULES_END)
   {
      ProcessModulesMenu(id);
      return;
   }

   switch(id)
   {
      case WXMENU_FILE_CLOSE:
         Close();
         break;

      case WXMENU_FILE_COMPOSE_WITH_TEMPLATE:
      case WXMENU_FILE_COMPOSE:
         {
            wxString templ;
            if ( id == WXMENU_FILE_COMPOSE_WITH_TEMPLATE )
            {
               templ = ChooseTemplateFor(MessageTemplate_NewMessage, this);
               if ( templ.empty() )
               {
                  // cancelled by user
                  break;
               }
            }

            Profile_obj profile(GetFolderProfile());
            Composer *composeView = Composer::CreateNewMessage(templ, profile);

            composeView->InitText();
         }
         break;

      case WXMENU_FILE_SEND_OUTBOX:
         mApplication->SendOutbox();
         break;

      case WXMENU_FILE_POST:
         {
            Profile_obj profile(GetFolderProfile());
            Composer *composeView = Composer::CreateNewArticle(profile);

            composeView->InitText();
         }

      case WXMENU_FILE_COLLECT:
         {
            FolderMonitor *mailCollector = mApplication->GetFolderMonitor();
            if ( mailCollector )
            {
               // when the user explicitly checks for the new mail, also update
               // the currently opened folder(s) and give the verbose messages
               mailCollector->CheckNewMail(FolderMonitor::Interactive |
                                           FolderMonitor::Opened);
            }
         }
         break;

#ifdef USE_PYTHON
      case WXMENU_FILE_RUN_PYSCRIPT:
         {
            wxString path = mApplication->GetDataDir();
            if ( !path.empty() )
               path += DIR_SEPARATOR;
            path += _T("scripts");

            wxString filename = MDialog_FileRequester
                                (
                                 _("Please select a Python script to run."),
                                 this,
                                 path, "",
                                 "py", "*.py",
                                 false,
                                 NULL /* profile */
                                );
            if ( !filename.empty() )
            {
               PythonRunScript(filename);
            }
            //else: cancelled by user
         }
         break;
#endif   // USE_PYTHON

      case WXMENU_FILE_AWAY_MODE:
         mApplication->SetAwayMode(GetMenuBar()->IsChecked(id));
         break;

      case WXMENU_FILE_EXIT:
         // flush MEvent queues for safety
         MEventManager::DispatchPending();

         if ( CanClose() )
         {
            // this frame has been already asked whether it wants to exit, so
            // don't ask it again
            mApplication->AddToFramesOkToClose(this);

            // exit the application if other frames don't object
            mApplication->Exit();
         }
         break;

      case WXMENU_FILE_IMPORT:
         ShowImportDialog(this);
         break;

      case WXMENU_EDIT_ADB:
         ShowAdbFrame(this);
         break;

      case WXMENU_EDIT_PREF:
         ShowOptionsDialog(this);
         break;

      case WXMENU_EDIT_FILTERS:
         (void) ConfigureAllFilters(this);
         break;

      case WXMENU_EDIT_MODULES:
         ShowModulesDialog(this);
         break;

      case WXMENU_EDIT_TEMPLATES:
         EditTemplates(this);
         break;

      case WXMENU_EDIT_RESTORE_PREF:
         (void)ShowRestoreDefaultsDialog(mApplication->GetProfile(), this);
         break;

      case WXMENU_EDIT_SAVE_PREF:
         if ( Profile::FlushAll() )
         {
            wxLogStatus(this, _("Program preferences successfully saved."));
         }
         else
         {
            ERRORMESSAGE((_("Couldn't save preferences.")));
         }
         break;

      case WXMENU_EDIT_CONFIG_SOURCES:
         ShowConfigSourcesDialog(this);
         break;

      case WXMENU_EDIT_EXPORT_PREF:
      case WXMENU_EDIT_IMPORT_PREF:
         {
            const bool doExport = id == WXMENU_EDIT_EXPORT_PREF;

            String path = MDialog_FileRequester
                          (
                              doExport ? _("Choose file to export settings to")
                                       : _("Choose file to import settings from"),
                              this,
                              wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString,
                              doExport    // true => save, false => load
                          );
            if ( path.empty() )
               break;

            ConfigSource_obj
               configSrc(ConfigSourceLocal::CreateDefault()),
               configDst(ConfigSourceLocal::CreateFile(path));
            if ( !doExport )
            {
               configSrc.Swap(configDst);
            }

            bool ok = ConfigSource::Copy(*configDst, *configSrc);

            if ( doExport )
            {
               if ( ok )
               {
                  wxLogStatus(this,
                              _("Settings successfully exported to file \"%s\""),
                              path.c_str());
               }
               else
               {
                  wxLogError(_("Failed to export settings to the file \"%s\"."),
                             path.c_str());
               }
            }
            else // import
            {
               if ( ok )
               {
                  wxLogStatus(this,
                              _("Settings successfully imported from \"%s\""),
                              path.c_str());
               }
               else
               {
                  wxLogError(_("Failed to import settings from the file \"%s\"."),
                             path.c_str());
               }
            }
         }
         break;


      case WXMENU_HELP_ABOUT:
         MDialog_AboutDialog(this, false /* don't timeout */);
         break;

      case WXMENU_HELP_TIP:
         MDialog_ShowTip(this);
         break;

      case WXMENU_HELP_CONTEXT:
         MDialog_Message(_("Help not implemented for current context, yet."),this,_("Sorry"));
         break;

      case WXMENU_HELP_CONTENTS:
         mApplication->Help(MH_CONTENTS,this);
         break;

      case WXMENU_HELP_RELEASE_NOTES:
         mApplication->Help(MH_RELEASE_NOTES,this);
         break;

      case WXMENU_HELP_FAQ:
         mApplication->Help(MH_FAQ,this);
         break;

      case WXMENU_HELP_SEARCH:
         mApplication->Help(MH_SEARCH,this);
         break;

      case WXMENU_HELP_COPYRIGHT:
         mApplication->Help(MH_COPYRIGHT,this);
         break;

         // printing:
      case WXMENU_FILE_PRINT_SETUP:
         OnPrintSetup();
         break;
      case WXMENU_FILE_PAGE_SETUP:
         OnPageSetup();
         break;

#ifdef USE_PS_PRINTING
      case WXMENU_FILE_PRINT_SETUP_PS:
         OnPrintSetup();
         break;

      case WXMENU_FILE_PAGE_SETUP_PS:
         OnPageSetup();
         break;
#endif // USE_PS_PRINTING

#ifdef USE_DIALUP
      case WXMENU_FILE_NET_ON:
         mApplication->GoOnline();
         break;

      case WXMENU_FILE_NET_OFF:
         if(mApplication->CheckOutbox())
         {
            if ( MDialog_YesNoDialog
                 (
                  _("You have outgoing messages queued.\n"
                    "Do you want to send them before going offline?"),
                  this,
                  MDIALOG_YESNOTITLE,
                  M_DLG_YES_DEFAULT,
                  M_MSGBOX_GO_OFFLINE_SEND_FIRST
                 ) )
            {
               mApplication->SendOutbox();
            }
         }
         mApplication->GoOffline();
         break;
#endif // USE_DIALUP

         // create a new identity and edit it
      case WXMENU_FILE_IDENT_ADD:
         {
            wxString ident;
            if ( MInputBox(&ident,
                           _("Mahogany: Create new identity"),
                           _("Enter the identity name:"),
                           this,
                           "NewIdentity") )
            {
               ShowIdentityDialog(ident, this);

               // update the identity combo in the toolbar of the main frame if
               // any (note that this will update all the other existing
               // identity combo boxes as they keep themselves in sync
               // internally)
               //
               // TODO: we really should have a virtual wxMFrame::GetIdentCombo
               //       as we might not always create the main frame in the
               //       future but other frames (e.g. composer) may have the
               //       ident combo as well
               wxMFrame *frameTop = mApplication->TopLevelFrame();
               if ( frameTop )
               {
                  wxToolBar *tbar = frameTop->GetToolBar();
                  if ( tbar )
                  {
                     wxWindow *win = tbar->FindWindow(IDC_IDENT_COMBO);
                     if ( win )
                     {
                        wxChoice *combo = wxDynamicCast(win, wxChoice);
                        combo->Append(ident);
                     }
                  }
                  else
                  {
                     FAIL_MSG(_T("where is the main frames toolbar?"));
                  }
               }

               wxLogStatus(this, _("Created new identity '%s'."), ident.c_str());
            }
         }
         break;

         // change the current identity
      case WXMENU_FILE_IDENT_CHANGE:
         {
            wxArrayString identities = Profile::GetAllIdentities();
            if ( identities.IsEmpty() )
            {
               wxLogError(_("There are no existing identities to choose from.\n"
                            "Please create an identity first."));
            }
            else
            {
               identities.Insert(_("Default"), 0);
               int rc = MDialog_GetSelection
                        (
                         _("Select the new identity"),
                         MDIALOG_YESNOTITLE,
                         identities,
                         this
                        );

               if ( rc != -1 )
               {
                  Profile *profile = mApplication->GetProfile();
                  if ( rc == 0 )
                  {
                     // restore the default identity
                     profile->DeleteEntry(GetOptionName(MP_CURRENT_IDENTITY));
                  }
                  else
                  {
                     wxString ident = identities[(size_t)rc];
                     profile->writeEntry(MP_CURRENT_IDENTITY, ident);
                  }

                  // update the identity combo in the toolbar if any
                  wxWindow *win = GetToolBar()->FindWindow(IDC_IDENT_COMBO);
                  if ( win )
                  {
                     wxChoice *combo = wxDynamicCast(win, wxChoice);
                     combo->SetSelection(rc);
                  }

                  // TODO: should update everything (all options might have
                  //       changed)
               }
               //else: dialog cancelled, nothing to do
            }
         }
         break;

         // edit an identity's parameters
      case WXMENU_FILE_IDENT_EDIT:
         {
            String ident;
            wxArrayString identities = Profile::GetAllIdentities();
            if ( identities.IsEmpty() )
            {
               wxLogError(_("There are no existing identities to edit.\n"
                            "Please create an identity first."));
            }
            else
            {
               if ( identities.GetCount() > 1 )             
               {
                  int rc = MDialog_GetSelection
                           (
                            _("Which identity would you like to edit?"),
                            MDIALOG_YESNOTITLE,
                            identities,
                            this
                           );

                  if ( rc != -1 )
                  {
                     ident = identities[(size_t)rc];
                  }
                  //else: dialog was cancelled
               }
               else // only one identity
               {
                  // use the current one
                  ident = READ_APPCONFIG_TEXT(MP_CURRENT_IDENTITY);
               }
            }

            if ( !ident.empty() )
            {
               ShowIdentityDialog(ident, this);
            }
         }
         break;

      case WXMENU_FILE_IDENT_DELETE:
         {
            String ident;
            wxArrayString identities = Profile::GetAllIdentities();
            if ( identities.IsEmpty() )
            {
               wxLogError(_("There are no existing identities to delete."));
            }
            else
            {
               int rc = MDialog_GetSelection
                        (
                         _("Which identity would you like to delete?"),
                         MDIALOG_YESNOTITLE,
                         identities,
                         this
                        );
               if ( rc != -1 )
               {
                  ident = identities[(size_t)rc];
               }
               //else: cancelled
            }

            if ( !ident.empty() )
            {
               Profile *profile = mApplication->GetProfile();

               if ( ident == READ_APPCONFIG(MP_CURRENT_IDENTITY) )
               {
                  // can't keep this one
                  profile->writeEntry(MP_CURRENT_IDENTITY, wxEmptyString);
               }

               // FIXME: will this really work? if there are objects which
               //        use this identity the section will be recreated...
               String identSection;
               identSection << Profile::GetIdentityPath() << '/' << ident;
               profile->DeleteGroup(identSection);

               // update the identity combo in the toolbar if any
               wxWindow *win = GetToolBar()->FindWindow(IDC_IDENT_COMBO);
               if ( win )
               {
                  wxChoice *combo = wxDynamicCast(win, wxChoice);
                  combo->Delete(combo->FindString(ident));
               }

               wxLogStatus(this, _("Identity '%s' deleted."), ident.c_str());
            }
         }
         break;

      case WXMENU_LANG_SET_DEFAULT:
         {
            static const wxFontEncoding encodingsSupported[] =
            {
               wxFONTENCODING_ISO8859_1,       // West European (Latin1)
               wxFONTENCODING_ISO8859_2,       // Central and East European (Latin2)
               wxFONTENCODING_ISO8859_3,       // Esperanto (Latin3)
               wxFONTENCODING_ISO8859_4,       // Baltic (old) (Latin4)
               wxFONTENCODING_ISO8859_5,       // Cyrillic
               wxFONTENCODING_ISO8859_6,       // Arabic
               wxFONTENCODING_ISO8859_7,       // Greek
               wxFONTENCODING_ISO8859_8,       // Hebrew
               wxFONTENCODING_ISO8859_9,       // Turkish (Latin5)
               wxFONTENCODING_ISO8859_10,      // Variation of Latin4 (Latin6)
               wxFONTENCODING_ISO8859_11,      // Thai
               wxFONTENCODING_ISO8859_12,      // doesn't exist currently, but put it
                                               // here anyhow to make all ISO8859
                                               // consecutive numbers
               wxFONTENCODING_ISO8859_13,      // Baltic (Latin7)
               wxFONTENCODING_ISO8859_14,      // Latin8
               wxFONTENCODING_ISO8859_15,      // Latin9 (a.k.a. Latin0, includes euro)

               wxFONTENCODING_CP1250,          // WinLatin2
               wxFONTENCODING_CP1251,          // WinCyrillic
               wxFONTENCODING_CP1252,          // WinLatin1
               wxFONTENCODING_CP1253,          // WinGreek (8859-7)
               wxFONTENCODING_CP1254,          // WinTurkish
               wxFONTENCODING_CP1255,          // WinHebrew
               wxFONTENCODING_CP1256,          // WinArabic
               wxFONTENCODING_CP1257,          // WinBaltic (almost the same as Latin 7)

               wxFONTENCODING_KOI8,            // == KOI8-R
               wxFONTENCODING_UTF7,            // == UTF-7
               wxFONTENCODING_UTF8,            // == UTF-8
            };

            wxArrayString encDescs;
            encDescs.Add(_("Default 7 bit (US ASCII)"));
            for ( size_t n = 0; n < WXSIZEOF(encodingsSupported); n++ )
            {
               encDescs.Add(
                     wxFontMapper::GetEncodingDescription(
                        encodingsSupported[n]
                     )
               );
            }

            int choice = MDialog_GetSelection
                         (
                           _("Please choose the default encoding:\n"
                             "it will be used by default in both\n"
                             "message viewer and composer."),
                           _("Choose default encoding"),
                           encDescs,
                           this
                         );

            wxFontEncoding enc;
            if ( choice == -1 )
            {
               // cancelled, do nothing
               break;
            }
            else if ( choice == 0 )
            {
               enc = wxFONTENCODING_DEFAULT;
            }
            else
            {
               enc = encodingsSupported[choice - 1];
            }

            // remember the encoding as default
            mApplication->GetProfile()->writeEntry(MP_MSGVIEW_DEFAULT_ENCODING,
                                                   enc);
         }
         break;

      case WXMENU_VIEW_TOOLBAR:
         if ( GetMenuBar()->IsChecked(id) )
         {
            DoCreateToolBar();
         }
         else // hide the toolbar
         {
            delete GetToolBar();
            SetToolBar(NULL);
         }
         break;

      case WXMENU_VIEW_STATUSBAR:
         if ( GetMenuBar()->IsChecked(id) )
         {
            DoCreateStatusBar();
         }
         else // hide the status bar
         {
            delete GetStatusBar();
            SetStatusBar(NULL);
         }
         break;

      case WXMENU_VIEW_FULLSCREEN:
         ShowFullScreen(GetMenuBar()->IsChecked(id));
         break;
   }
}
예제 #23
0
void CFrame::OnStopped()
{
  m_confirmStop = false;
  m_tried_graceful_shutdown = false;

#if defined(HAVE_X11) && HAVE_X11
  if (SConfig::GetInstance().bDisableScreenSaver)
    X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
                                 X11Utils::XWindowFromHandle(GetHandle()), false);
#endif

#ifdef _WIN32
  // Allow windows to resume normal idling behavior
  SetThreadExecutionState(ES_CONTINUOUS);
#endif

  m_RenderFrame->SetTitle(StrToWxStr(scm_rev_str));

  // Destroy the renderer frame when not rendering to main
  m_RenderParent->Unbind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this);

  // Mouse
  wxTheApp->Unbind(wxEVT_RIGHT_DOWN, &CFrame::OnMouse, this);
  wxTheApp->Unbind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this);
  wxTheApp->Unbind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);
  wxTheApp->Unbind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
  wxTheApp->Unbind(wxEVT_MOTION, &CFrame::OnMouse, this);
  if (SConfig::GetInstance().bHideCursor)
    m_RenderParent->SetCursor(wxNullCursor);
  DoFullscreen(false);
  if (!SConfig::GetInstance().bRenderToMain)
  {
    m_RenderFrame->Destroy();
  }
  else
  {
#if defined(__APPLE__)
    // Disable the full screen button when not in a game.
    m_RenderFrame->EnableFullScreenView(false);
#endif

    // Make sure the window is not longer set to stay on top
    m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() & ~wxSTAY_ON_TOP);
  }
  m_RenderParent = nullptr;
  m_bRendererHasFocus = false;
  m_RenderFrame = nullptr;

  // Clean framerate indications from the status bar.
  GetStatusBar()->SetStatusText(" ", 0);

  // Clear Wii Remote connection status from the status bar.
  GetStatusBar()->SetStatusText(" ", 1);

  // If batch mode was specified on the command-line or we were already closing, exit now.
  if (m_bBatchMode || m_bClosing)
    Close(true);

  // If using auto size with render to main, reset the application size.
  if (SConfig::GetInstance().bRenderToMain && SConfig::GetInstance().bRenderWindowAutoSize)
    SetSize(SConfig::GetInstance().iWidth, SConfig::GetInstance().iHeight);

  m_GameListCtrl->Enable();
  m_GameListCtrl->Show();
  m_GameListCtrl->SetFocus();
  UpdateGUI();
}
예제 #24
0
void MyFrame::OnUpdateStatusBarToggle(wxUpdateUIEvent& event)
{
    event.Check(GetStatusBar() != NULL);
}
예제 #25
0
void dlgMain::OnMonitorSignal(wxCommandEvent& event)
{
    mtrs_struct_t *Result = (mtrs_struct_t *)event.GetClientData();
    wxInt32 i;
    
    switch (Result->Signal)
    {
        case mtrs_master_timeout:
        {
            // We use multiple masters you see, if one fails and the others are
            // working, atleast we can get some useful data
            if (!MServer.GetServerCount())
            {
                wxMessageBox(wxT("No master servers could be contacted"), 
                    wxT("Error"), wxOK | wxICON_ERROR);
                
                break;
            }
        }
        
        case mtrs_master_success:
            break;
        case mtrs_server_noservers:
        {
            wxMessageBox(wxT("There are no servers to query"), 
                wxT("Error"), wxOK | wxICON_ERROR);
        }
        break;
        
        case mtrs_server_singletimeout:
        {
            i = FindServerInList(QServer[Result->Index].GetAddress());

            m_LstOdaSrvDetails->LoadDetailsFromServer(NullServer);
            
            QServer[Result->Index].ResetData();
            
            if (launchercfg_s.show_blocked_servers == false)
                break;

            if (i == -1)
                m_LstCtrlServers->AddServerToList(QServer[Result->Index], Result->Index);
            else
                m_LstCtrlServers->AddServerToList(QServer[Result->Index], i, false);
        }
        break;
        
        case mtrs_server_singlesuccess:           
        {
            m_LstCtrlServers->AddServerToList(QServer[Result->Index], Result->ServerListIndex, false);
            
            m_LstCtrlPlayers->AddPlayersToList(QServer[Result->Index]);
            
            m_LstOdaSrvDetails->LoadDetailsFromServer(QServer[Result->Index]);
            
            TotalPlayers += QServer[Result->Index].Info.Players.size();
        }
        break;

        case mtrs_servers_querydone:
        {            
            // Sort server list after everything has been queried
            m_LstCtrlServers->Sort();
        }
        break;
        
        default:
            break;
    }

    GetStatusBar()->SetStatusText(wxString::Format(_T("Master Ping: %u"), MServer.GetPing()), 1);
    GetStatusBar()->SetStatusText(wxString::Format(_T("Total Players: %d"), TotalPlayers), 3);

    delete Result;
}
예제 #26
0
void MainFrame::ProjectSaved()
{
	GetStatusBar()->SetStatusText(wxT("Project Saved!"));
	UpdateFrame();
}
예제 #27
0
파일: frame.cpp 프로젝트: jfiguinha/Regards
// Pass true to show full screen, false to restore.
bool wxFrame::ShowFullScreen(bool show, long style)
{
    if ( IsFullScreen() == show )
        return false;

    if (show)
    {
        // zap the toolbar, menubar, and statusbar if needed
#if wxUSE_TOOLBAR
        wxToolBar *theToolBar = GetToolBar();

        if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar)
        {
            if ( theToolBar->IsShown() )
            {
                theToolBar->SetSize(wxDefaultCoord,0);
                theToolBar->Show(false);
            }
            else // prevent it from being restored later
            {
                style &= ~wxFULLSCREEN_NOTOOLBAR;
            }
        }
#endif // wxUSE_TOOLBAR

        if (style & wxFULLSCREEN_NOMENUBAR)
            SetMenu((HWND)GetHWND(), (HMENU) NULL);

#if wxUSE_STATUSBAR
        wxStatusBar *theStatusBar = GetStatusBar();

        // Save the number of fields in the statusbar
        if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar)
        {
            if ( theStatusBar->IsShown() )
                theStatusBar->Show(false);
            else
                style &= ~wxFULLSCREEN_NOSTATUSBAR;
        }
#endif // wxUSE_STATUSBAR
    }
    else // restore to normal
    {
        // restore the toolbar, menubar, and statusbar if we had hid them
#if wxUSE_TOOLBAR
        wxToolBar *theToolBar = GetToolBar();

        if ((m_fsStyle & wxFULLSCREEN_NOTOOLBAR) && theToolBar)
        {
            theToolBar->Show(true);
        }
#endif // wxUSE_TOOLBAR

#if wxUSE_MENUS
        if (m_fsStyle & wxFULLSCREEN_NOMENUBAR)
        {
            const WXHMENU hmenu = MSWGetActiveMenu();
            if ( hmenu )
                ::SetMenu(GetHwnd(), (HMENU)hmenu);
        }
#endif // wxUSE_MENUS

#if wxUSE_STATUSBAR
        wxStatusBar *theStatusBar = GetStatusBar();

        if ((m_fsStyle & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar)
        {
            theStatusBar->Show(true);
            PositionStatusBar();
        }
#endif // wxUSE_STATUSBAR
    }

    return wxFrameBase::ShowFullScreen(show, style);
}
예제 #28
0
MyFrame::MyFrame(wxWindow* parent,
                 wxWindowID id,
                 const wxString& title,
                 const wxPoint& pos,
                 const wxSize& size,
                 long style)
        : wxFrame(parent, id, title, pos, size, style)
{
    // set frame icon
    #ifdef __WXMSW__
    SetIcon(wxIcon(wxT("mondrian"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16));
    #endif


    // use wxAuiManager to manage this frame
    m_mgr.SetManagedWindow(this);


    // create the menu
    wxMenuBar* mb = new wxMenuBar;

    wxMenu* file_menu = new wxMenu;
    file_menu->Append(ID_OpenLocation, _("&Open Location...\tCtrl+L"));
    file_menu->Append(ID_Close, _("&Close\tCtrl+W"));
    file_menu->AppendSeparator();    
    file_menu->Append(ID_SaveAs, _("&Save As...\tCtrl+S"));
    file_menu->AppendSeparator();
    file_menu->Append(ID_PageSetup, _("Page Set&up..."));
    //file_menu->Append(ID_PrintPreview, _("Print pre&view..."));
    file_menu->Append(ID_Print, _("&Print...\tCtrl+P"));
    file_menu->AppendSeparator();
    file_menu->Append(ID_Exit, _("E&xit"));

    wxMenu* edit_menu = new wxMenu;
    edit_menu->Append(ID_Undo, _("&Undo\tCtrl+Z"));
    edit_menu->Append(ID_Redo, _("&Redo\tCtrl+Y"));
    edit_menu->AppendSeparator();    
    edit_menu->Append(ID_Cut, _("Cu&t\tCtrl+X"));
    edit_menu->Append(ID_Copy, _("&Copy\tCtrl+C"));
    edit_menu->Append(ID_Paste, _("&Paste\tCtrl+V"));
    edit_menu->Append(ID_SelectAll, _("Select &All\tCtrl+Z"));
    edit_menu->AppendSeparator();    
    edit_menu->Append(ID_Find, _("&Find...\tCtrl+F"));
    edit_menu->Append(ID_FindAgain, _("Find A&gain\tCtrl+G"));    

    wxMenu* view_menu = new wxMenu;
    view_menu->Append(ID_GoBack, _("Go &Back"));
    view_menu->Append(ID_GoForward, _("Go &Forward"));
    view_menu->Append(ID_GoHome, _("&Home"));
    view_menu->AppendSeparator();
    view_menu->Append(ID_Stop, _("&Stop\tEsc"));
    view_menu->Append(ID_Reload, _("&Reload\tCtrl+R"));
    view_menu->AppendSeparator();
    view_menu->Append(ID_ZoomIn, _("Zoom &In"));
    view_menu->Append(ID_ZoomOut, _("Zoom &Out"));
    view_menu->Append(ID_ZoomReset, _("Reset &Zoom"));
    view_menu->AppendSeparator();
    view_menu->Append(ID_ShowSource, _("Sho&w Source"));
    view_menu->Append(ID_ShowLinks, _("Show &Links"));

    wxMenu* help_menu = new wxMenu;
    help_menu->Append(ID_GoHelp, _("Help\tF1"));
    help_menu->Append(ID_GoForums, _("Forums"));
    help_menu->Append(ID_GoAbout, _("About"));

    mb->Append(file_menu, _("&File"));
    mb->Append(edit_menu, _("&Edit"));
    mb->Append(view_menu, _("&View"));
    mb->Append(help_menu, _("&Help"));
    SetMenuBar(mb);

    CreateStatusBar();
    GetStatusBar()->SetStatusText(_("Ready"));


    // create the main toolbar
    wxAuiToolBar* toolbar = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
                                             wxAUI_TB_DEFAULT_STYLE);
    toolbar->SetToolBitmapSize(wxSize(24,24));
    toolbar->AddTool(ID_GoBack, wxT("Go Back"), wxArtProvider::GetBitmap(wxART_GO_BACK));
    toolbar->AddTool(ID_GoForward, wxT("Go Forward"), wxArtProvider::GetBitmap(wxART_GO_FORWARD));
    toolbar->AddTool(ID_GoHome, wxT("Go Home"), wxArtProvider::GetBitmap(wxART_GO_HOME));

    m_urlbar = new wxComboBox(toolbar, wxID_URL, wxT(""), wxPoint(0,0), wxSize(850,18));    
    toolbar->AddControl(m_urlbar, wxT("Location"));

    toolbar->Realize();


    // create the main browser control
    m_browser = new wxWebControl(this, wxID_WEB, wxPoint(0,0), wxSize(800,600));

//    m_browser->CreateBrowser(this, wxID_WEB, wxPoint(0,0), wxSize(800,600));

    // add the toolbar to the manager
    m_mgr.AddPane(toolbar, wxAuiPaneInfo().
                  Name(wxT("Toolbar")).Caption(wxT("Toolbar")).
                  ToolbarPane().Top().
                  LeftDockable(false).RightDockable(false));    


    // add the browser to the manager
    m_mgr.AddPane(m_browser, wxAuiPaneInfo().
                  Name(wxT("Browser")).
                  CenterPane().Show());


    // update the wxAUI manager
    m_mgr.Update();


    // set the default browser preferences; to learn
    // more about the Mozilla preference values, see
    // http://kb.mozillazine.org/About:config_entries

    // for the example, disable cookies and popups
    //wxWebPreferences webprefs = wxWebControl::GetPreferences();
    //webprefs.SetIntPref(wxT("network.cookie.cookieBehavior"), 2 /* disable all cookies */);
    //webprefs.SetIntPref(wxT("privacy.popups.policy"), 2 /* reject popups */);    

    // example proxy settings
    // webprefs.SetIntPref(wxT("network.proxy.type"),           0 /* no proxy */);
    // webprefs.SetIntPref(wxT("network.proxy.type"),           1 /* manual proxy */);
    // webprefs.SetIntPref(wxT("network.proxy.type"),           4 /* auto-detect proxy */);
    // webprefs.SetStringPref( wxT("network.proxy.http"),       wxT(""));
    // webprefs.SetIntPref(    wxT("network.proxy.http_port"),  0);
    // webprefs.SetStringPref( wxT("network.proxy.ftp"),        wxT(""));
    // webprefs.SetIntPref(    wxT("network.proxy.ftp_port"),   0);
    // webprefs.SetStringPref( wxT("network.proxy.ssl"),        wxT(""));
    // webprefs.SetIntPref(    wxT("network.proxy.ssl_port"),   0);
    // webprefs.SetStringPref( wxT("network.proxy.socks"),      wxT(""));
    // webprefs.SetIntPref(    wxT("network.proxy.socks_port"), 0);

    // example cookie preferences
    // webprefs.SetIntPref(wxT("network.cookie.cookieBehavior"), 0 /* enable all cookies */);
    // webprefs.SetIntPref(wxT("network.cookie.cookieBehavior"), 2 /* disable all cookies */);
    // webprefs.SetIntPref(wxT("network.cookie.lifetime.days"),  0);
    // webprefs.SetIntPref(wxT("network.cookie.lifetimePolicy"), 2 /* accept for session only */);    
    // webprefs.SetIntPref(wxT("network.cookie.lifetimePolicy"), 3 /* keep for number of days specified in "privacy.cookie.lifetime_days" */);

    // example popup preferences
    // webprefs.SetIntPref(wxT("privacy.popups.policy"), 1 /* accept popups */);
    // webprefs.SetIntPref(wxT("privacy.popups.policy"), 2 /* reject popups */);


    // set the default home and help URIs
    m_uri_home = wxT("http://www.kirix.com/labs");
    //m_uri_help = wxT("http://www.kirix.com/labs/wxwebconnect/documentation/quick-facts.html");
    //m_uri_forums = wxT("http://www.kirix.com/forums/");
    //m_uri_about = wxT("http://www.kirix.com/labs/wxwebconnect.html");       

    // set the DOM content loaded flag
    //m_dom_contentloaded = false;

    // open the home location
    m_browser->OpenURI(m_uri_home);
}
예제 #29
0
void wxFrameBase::DoGiveHelp(const wxString& help, bool show)
{
#if wxUSE_STATUSBAR
    if ( m_statusBarPane < 0 )
    {
        // status bar messages disabled
        return;
    }

    wxStatusBar *statbar = GetStatusBar();
    if ( !statbar )
        return;

    wxString text;
    if ( show )
    {
        // remember the old status bar text if this is the first time we're
        // called since the menu has been opened as we're going to overwrite it
        // in our DoGiveHelp() and we want to restore it when the menu is
        // closed
        //
        // note that it would be logical to do this in OnMenuOpen() but under
        // MSW we get an EVT_MENU_HIGHLIGHT before EVT_MENU_OPEN, strangely
        // enough, and so this doesn't work and instead we use the ugly trick
        // with using special m_oldStatusText value as "menu opened" (but it is
        // arguably better than adding yet another member variable to wxFrame
        // on all platforms)
        if ( m_oldStatusText.empty() )
        {
            m_oldStatusText = statbar->GetStatusText(m_statusBarPane);
            if ( m_oldStatusText.empty() )
            {
                // use special value to prevent us from doing this the next time
                m_oldStatusText += wxT('\0');
            }
        }

        m_lastHelpShown =
        text = help;
    }
    else // hide help, restore the original text
    {
        // clear the last shown help string but remember its value
        wxString lastHelpShown;
        lastHelpShown.swap(m_lastHelpShown);

        // also clear the old status text but remember it too to restore it
        // below
        text.swap(m_oldStatusText);

        if ( statbar->GetStatusText(m_statusBarPane) != lastHelpShown )
        {
            // if the text was changed with an explicit SetStatusText() call
            // from the user code in the meanwhile, do not overwrite it with
            // the old status bar contents -- this is almost certainly not what
            // the user expects and would be very hard to avoid from user code
            return;
        }
    }

    statbar->SetStatusText(text, m_statusBarPane);
#else
    wxUnusedVar(help);
    wxUnusedVar(show);
#endif // wxUSE_STATUSBAR
}
예제 #30
0
void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event))
{
    wxStatusBar *sb = GetStatusBar();
    if (!sb)
        return;

    long nFields = wxGetNumberFromUser
                (
                    wxT("Select the number of fields in the status bar"),
                    wxT("Fields:"),
                    SAMPLE_DIALOGS_TITLE,
                    sb->GetFieldsCount(),
                    1, 5,
                    this
                );

    // we don't check if the number changed at all on purpose: calling
    // SetFieldsCount() with the same number of fields should be ok
    if ( nFields != -1 )
    {
        static const int widthsFor2Fields[] = { 200, -1 };
        static const int widthsFor3Fields[] = { -1, -2, -1 };
        static const int widthsFor4Fields[] = { 100, -1, 100, -2, 100 };

        static const int *widthsAll[] =
        {
            NULL,               // 1 field: default
            widthsFor2Fields,   // 2 fields: 1 fixed, 1 var
            widthsFor3Fields,   // 3 fields: 3 var
            widthsFor4Fields,   // 4 fields: 3 fixed, 2 vars
            NULL                // 5 fields: default (all have same width)
        };

        const int * const widths = widthsAll[nFields - 1];
        sb->SetFieldsCount(nFields, widths);

        wxString s;
        for ( long n = 0; n < nFields; n++ )
        {
            if ( widths )
            {
                if ( widths[n] > 0 )
                    s.Printf(wxT("fixed (%d)"), widths[n]);
                else
                    s.Printf(wxT("variable (*%d)"), -widths[n]);
            }
            else
            {
                s = wxT("default");
            }

            SetStatusText(s, n);
        }

        if ( m_field >= nFields )
            m_field = nFields - 1;
    }
    else
    {
        wxLogStatus(this, wxT("Cancelled"));
    }
}