Пример #1
0
/*
 * CreateNotebookWindow
 *
 * Create a window to display the notebook.
 */
void CreateNotebookWindow (char *szTitle, GtkPositionType pos)
{
    GtkWidget *window;

    /* --- Create the top window --- */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    /* --- Give the window a title. --- */
    gtk_window_set_title (GTK_WINDOW (window), szTitle);

    /* --- Set the window size. --- */
    gtk_widget_set_usize (window, 250, 250);

    /* --- You should always remember to connect the destroy event
     *     to the main window.
     */
    gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                        GTK_SIGNAL_FUNC (delete_event), NULL);

    /* --- Make main page visible --- */
    gtk_widget_show (window);

    /* --- Create notebook --- */
    CreateNotebook (window, pos);
}
Пример #2
0
void wxStfChildFrame::ShowTable(const stf::Table &table,const wxString& caption) {

    // Create and show notebook if necessary:
    if (m_notebook==NULL && !m_mgr.GetPane(m_notebook).IsOk()) {
        m_notebook=CreateNotebook();
        m_mgr.AddPane( m_notebook, wxAuiPaneInfo().Caption(wxT("Analysis results")).
                       Floatable().Dock().Left().Name( wxT("Notebook") ) );
    } else {
        // Re-open notebook if it has been closed:
        if (!m_mgr.GetPane(m_notebook).IsShown()) {
            m_mgr.GetPane(m_notebook).Show();
        }
    }
    wxStfGrid* pGrid = new wxStfGrid( m_notebook, wxID_ANY, wxPoint(0,20), wxDefaultSize );
    wxStfTable* pTable(new wxStfTable(table));
    pGrid->SetTable(pTable,true); // the grid will take care of the deletion
    pGrid->SetEditable(false);
    pGrid->SetDefaultCellAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE);
    for (std::size_t n_row=0; n_row<=table.nRows()+1; ++n_row) {
        pGrid->SetCellAlignment(wxALIGN_LEFT,(int)n_row,0);
    }
    m_notebook->AddPage( pGrid, caption, true );

    // "commit" all changes made to wxAuiManager
    m_mgr.Update();
    wxStfView* pView=(wxStfView*)GetView();
    if (pView != NULL && pView->GetGraph()!= NULL) { 
        pView->GetGraph()->Enable();
        pView->GetGraph()->SetFocus();
    }
}
Пример #3
0
int
main(int    argc,
     char **argv)
{
 XtAppContext app_context;
 Widget       main_window;

   XtSetLanguageProc(NULL, NULL, NULL);
   top_level = XtVaOpenApplication(&app_context, APP_CLASS, 
                                NULL, 0, &argc, argv, 
                                NULL,
                                sessionShellWidgetClass, 
                                NULL);
   XmdRegisterEditres(top_level);
   main_window = XtVaCreateManagedWidget("main_window", 
                                xmMainWindowWidgetClass, top_level,
                                NULL);

   CreateMenus(main_window);
   CreateNotebook(main_window);

   XtRealizeWidget(top_level);
   XtAppMainLoop(app_context);

   return 0;    /* make compiler happy */
}
Пример #4
0
// Top-level notebook dialog procedure -- for WM_INITDLG, expects mp2 to be a
// pointer to a notebook header structure which defines the notebook
MRESULT EXPENTRY NotebookDlgProc(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
{
	int nPage;
	PNBHDR pNotebookHdr;

	if (msg != WM_INITDLG)
		pNotebookHdr = (PNBHDR)WinQueryWindowULong(hDlg, QWL_USER);

	switch(msg) {
	case WM_INITDLG:

		pNotebookHdr = (PNBHDR)(PVOIDFROMMP(mp2));
		pNotebookHdr->hwndNB = WinWindowFromID(hDlg, pNotebookHdr->ulNotebookID);

		// Save upper-level dialog handle for use by page dialog code
		pNotebookHdr->hwndNBDlg = hDlg;

		// Save header pointer in window data so WM_SIZE code can use it
		WinSetWindowULong(hDlg, QWL_USER, (ULONG)pNotebookHdr);

		// Create the notebook
		if (!CreateNotebook(pNotebookHdr)) {
			WinDismissDlg(hDlg, 0);
			return 0;
		}

		// Post a message to open the notebook after initialization is complete
		WinPostMsg(hDlg, WM_OPEN_NOTEBOOK, MP0, MP0);
		break;

	case WM_OPEN_NOTEBOOK:

		// Select the first page, and set the notebook size
		TurnToFirstPage(pNotebookHdr->hwndNB);
		SetNotebookSize(pNotebookHdr);
		break;

	case WM_CONTROL:
		// If user selected a new page, switch to it
		if (((ULONG)pNotebookHdr != 0L) && (SHORT1FROMMP(mp1) == pNotebookHdr->ulNotebookID) && (SHORT2FROMMP(mp1) == BKN_PAGESELECTED))
			SetNBPage(hDlg, (PPAGESELECTNOTIFY)mp2);
		break;

	case WM_CLOSE_NOTEBOOK:
		// clear the notebook page array dialog handles to show the pages are no longer in use
		for (nPage = 0; (nPage < pNotebookHdr->nPages); nPage++)
			pNotebookHdr->PageArray[nPage].hwndPageDlg = (HWND)0L;
		WinDismissDlg(hDlg, 0);
		break;

	default:
		return WinDefDlgProc(hDlg, msg, mp1, mp2);
	}

	return 0;

}
Пример #5
0
clMultiBook::clMultiBook(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style,
                         const wxString& name)
    : wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL, name)
    , m_style(style)
    , m_selection(wxNOT_FOUND)
{
    m_splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE);
    SetSizer(new wxBoxSizer(wxHORIZONTAL));
    GetSizer()->Add(m_splitter, 1, wxEXPAND, 0);
    
    // Create the books
    m_leftBook = CreateNotebook(m_splitter);
    m_rightBook = CreateNotebook(m_splitter);
    
    // Hide the right book and initialise the splitter
    m_rightBook->Show(false);
    m_splitter->Initialize(m_leftBook);
    wxTheApp->Bind(wxEVT_SET_FOCUS, &clMultiBook::OnFocus, this);
    m_history.reset(new clTabHistory());
}