示例#1
0
文件: menu.cpp 项目: beanhome/dev
bool wxMenuBar::Append( wxMenu *menu, const wxString &title )
{
    if ( !wxMenuBarBase::Append( menu, title ) )
        return false;

    return GtkAppend(menu, title);
}
示例#2
0
文件: menu.cpp 项目: mark711/Cafu
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
{
    if ( !GtkAppend(item, (int)pos) )
        return NULL;

    return wxMenuBase::DoInsert(pos, item);
}
示例#3
0
文件: menu.cpp 项目: beanhome/dev
wxMenuItem* wxMenu::DoAppend(wxMenuItem *mitem)
{
    if (!GtkAppend(mitem))
        return NULL;

    return wxMenuBase::DoAppend(mitem);
}
示例#4
0
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
{
    if (wxMenuBase::DoInsert(pos, item))
    {
        GtkAppend(item, int(pos));
        return item;
    }
    return NULL;
}
示例#5
0
wxMenuItem* wxMenu::DoAppend(wxMenuItem *mitem)
{
    if (wxMenuBase::DoAppend(mitem))
    {
        GtkAppend(mitem);
        return mitem;
    }
    return NULL;
}
示例#6
0
bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
{
    if (wxMenuBarBase::Insert(pos, menu, title))
    {
        GtkAppend(menu, title, int(pos));
        return true;
    }
    return false;
}
示例#7
0
bool wxMenuBar::Append( wxMenu *menu, const wxString &title )
{
    if (wxMenuBarBase::Append(menu, title))
    {
        GtkAppend(menu, title);
        return true;
    }
    return false;
}
示例#8
0
文件: menu.cpp 项目: beanhome/dev
bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
{
    if ( !wxMenuBarBase::Insert(pos, menu, title) )
        return false;

    // TODO

    if ( !GtkAppend(menu, title, (int)pos) )
        return false;

    return true;
}
示例#9
0
文件: menu.cpp 项目: mael15/wxWidgets
void wxMenuBar::GtkAppend(wxMenu* menu, const wxString& title, int pos)
{
    menu->SetLayoutDirection(GetLayoutDirection());

#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
    // if the menu has only one item, append it directly to the top level menu
    // instead of inserting a useless submenu
    if ( menu->GetMenuItemCount() == 1 )
    {
        wxMenuItem * const item = menu->FindItemByPosition(0);

        // remove both mnemonics and accelerator: neither is useful under Maemo
        const wxString str(wxStripMenuCodes(item->GetItemLabel()));

        if ( item->IsSubMenu() )
        {
            GtkAppend(item->GetSubMenu(), str, pos);
            return;
        }

        menu->m_owner = gtk_menu_item_new_with_mnemonic( wxGTK_CONV( str ) );

        g_signal_connect(menu->m_owner, "activate",
                         G_CALLBACK(menuitem_activate), item);
        item->SetMenuItem(menu->m_owner);
    }
    else
#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2
    {
        const wxString str(wxConvertMnemonicsToGTK(title));

        // This doesn't have much effect right now.
        menu->SetTitle( str );

        // The "m_owner" is the "menu item"
        menu->m_owner = gtk_menu_item_new_with_mnemonic( wxGTK_CONV( str ) );

        gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu );
    }
    g_object_ref(menu->m_owner);

    gtk_widget_show( menu->m_owner );

    if (pos == -1)
        gtk_menu_shell_append( GTK_MENU_SHELL(m_menubar), menu->m_owner );
    else
        gtk_menu_shell_insert( GTK_MENU_SHELL(m_menubar), menu->m_owner, pos );

    if ( m_menuBarFrame )
        AttachToFrame( menu, m_menuBarFrame );
}