Exemplo n.º 1
0
void FrontEnd::OnIdle( wxIdleEvent& WXUNUSED(event) )
{
    static int s_nPages = wxNOT_FOUND;
    static int s_nSel = wxNOT_FOUND;
    static wxBookCtrlBase *s_currBook = NULL;

    wxBookCtrlBase *currBook = GetCurrentBook();

    int nPages = currBook ? currBook->GetPageCount() : 0;
    int nSel = currBook ? currBook->GetSelection() : wxNOT_FOUND;

    if ( nPages != s_nPages || nSel != s_nSel || s_currBook != currBook )
    {
        s_nPages = nPages;
        s_nSel = nSel;
        s_currBook = currBook;

        wxString selection;
        if ( nSel == wxNOT_FOUND )
            selection << wxT("Ready...");
        else
            selection << currBook->GetPageText( nSel );

        
        wxString title;
        title.Printf(wxT("VOD System -- %s"), selection.c_str());
        
        SetTitle(title);
    }
}
Exemplo n.º 2
0
void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
{
    static int s_nPages = wxNOT_FOUND;
    static int s_nSel = wxNOT_FOUND;
    static wxBookCtrlBase *s_currBook = NULL;

    wxBookCtrlBase *currBook = GetCurrentBook();

    int nPages = currBook ? currBook->GetPageCount() : 0;
    int nSel = currBook ? currBook->GetSelection() : wxNOT_FOUND;

    if ( nPages != s_nPages || nSel != s_nSel || s_currBook != currBook )
    {
        s_nPages = nPages;
        s_nSel = nSel;
        s_currBook = currBook;

        wxString selection;
        if ( nSel == wxNOT_FOUND )
            selection << wxT("not found");
        else
            selection << nSel;

        wxString title;
        title.Printf(wxT("Notebook and friends (%d pages, selection: %s)"), nPages, selection.c_str());

        SetTitle(title);
    }
}
Exemplo n.º 3
0
void MyFrame::OnNextPage(wxCommandEvent& WXUNUSED(event))
{
    wxBookCtrlBase *currBook = GetCurrentBook();

    if ( currBook )
    {
        currBook->AdvanceSelection();
    }
}
Exemplo n.º 4
0
void MyFrame::OnType(wxCommandEvent& event)
{
    wxBookCtrlBase *currBook = GetCurrentBook();

    m_type = event.GetId();

    if (currBook)
        m_sizerFrame->Hide(currBook);

    ShowCurrentBook();
}
Exemplo n.º 5
0
void FrontEnd::OnListbook(wxBookCtrlEvent &event)
{
    wxBookCtrlBase* book = GetCurrentBook();
    const int idx = event.GetSelection();
    if(idx != wxNOT_FOUND && book)
    {
        if(book->GetPageText(idx) == "All Songs")
        {
            m_listSongAll->ClearAll();

            Songs songs;
            SearchSong("select * from songs", songs);

            for(SongsIter iter = songs.begin();
                iter != songs.end();
                iter++)
            {
                m_listSongAll->InsertItem(0, iter->name);
            }
        }
        else if(book->GetPageText(idx) == "Songs Queued")
        {
            m_listSongQueued->ClearAll();

            Songs songs;
            SearchSong("select * from songs where state = 1", songs);

            for(SongsIter iter = songs.begin();
                iter != songs.end();
                iter++)
            {
                m_listSongQueued->InsertItem(0, iter->name);
            }
        }
        else if(book->GetPageText(idx) == "Songs Played")
        {
            m_listSongPlayed->ClearAll();

            Songs songs;
            SearchSong("select * from songs where state = 2", songs);

            for(SongsIter iter = songs.begin();
                iter != songs.end();
                iter++)
            {
                m_listSongPlayed->InsertItem(0, iter->name);
            }
        }
        else if(book->GetPageText(idx) == "Singer Pinyin")
        {
            m_listSingerAll->ClearAll();
        }
    }
}
Exemplo n.º 6
0
void MyFrame::OnDeleteLastPage(wxCommandEvent& WXUNUSED(event))
{
    wxBookCtrlBase *currBook = GetCurrentBook();

    if ( currBook )
    {
        int page = currBook->GetPageCount();

        if ( page != 0 )
        {
            currBook->DeletePage(page - 1);
        }
    }
}
Exemplo n.º 7
0
void MyFrame::OnDeleteCurPage(wxCommandEvent& WXUNUSED(event))
{
    wxBookCtrlBase *currBook = GetCurrentBook();

    if ( currBook )
    {
        int sel = currBook->GetSelection();

        if (sel != wxNOT_FOUND)
        {
            currBook->DeletePage(sel);
        }
    }
}
Exemplo n.º 8
0
void MyFrame::OnInsertPage(wxCommandEvent& WXUNUSED(event))
{
    static unsigned s_pageIns = 0;

    wxBookCtrlBase *currBook = GetCurrentBook();

    if ( currBook )
    {
        wxPanel *panel = CreateUserCreatedPage( currBook );

        currBook->InsertPage( 0, panel,
                              wxString::Format(INSERTED_PAGE_NAME wxT("%u"), ++s_pageIns), false,
                              GetIconIndex(currBook) );

        currBook->SetSelection(0);
    }
}
Exemplo n.º 9
0
void MyFrame::OnAddPage(wxCommandEvent& WXUNUSED(event))
{
    static unsigned s_pageAdded = 0;

    wxBookCtrlBase *currBook = GetCurrentBook();

    if ( currBook )
    {
        wxPanel *panel = new wxPanel( currBook, wxID_ANY );
        (void) new wxButton( panel, wxID_ANY, wxT("First button"),
                             wxPoint(10, 10), wxDefaultSize );
        (void) new wxButton( panel, wxID_ANY, wxT("Second button"),
                             wxPoint(50, 100), wxDefaultSize );

        currBook->AddPage(panel, wxString::Format(ADDED_PAGE_NAME wxT("%u"),
                          ++s_pageAdded), true, GetIconIndex(currBook) );
    }
}