~ubuntu-branches/ubuntu/maverick/wxwidgets2.8/maverick-proposed

« back to all changes in this revision

Viewing changes to src/gtk/menu.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2008-06-30 22:02:17 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080630220217-vag3tkfp91t0453d
Tags: 2.8.8.0-0ubuntu1
* New upstream version, based on the upstream tarball
  wxPython-src-2.8.8.0.tar.bz2, remove upstream debian dir (LP: #244355).
* Add debian/watch file, LP: #242164.
* Edit get-orig-source target to provide a .orig.tar.gz with the same md5 for
  each .orig.tar.gz generated.
* debian/rules: remove get-orig-source from .PHONY target.
* debian/control.in: add python-wxtools in python-wxgtk=V=U Suggests field.
* Do not apply fix_from_upstream_svn_r52465 patch, not needed.
* Regenerate octave_oct, tcl_tk_tcl patches for the new version.
* Fix spelling-error-in-description lintian warning.
* Fix depends-on-obsolete-package lintian error.
* Fix executable-not-elf-or-script lintian warnings.
* Fix script-not-executable lintian warnings.
* Fix missing-dependency-on-libc lintian error.
* Fix dbg-package-missing-depends lintian warnings.
* Fix package-contains-empty-directory lintian warnings.
* Fix manpage-has-errors-from-man lintian warning.
* Fix image-file-in-usr-lib lintian warnings:
  - add editra_pixmaps patch
  - add xrced_bitmaps patch
* Fix unused-override lintian info.
* Fix malformed-override lintian errors.
* Fix extra-license-file lintian warnings.
* Install upstream wx.pth instead of generated file links (LP: #211553).
* Add editra.png, pyshell.png (encoded using uuencode) icons, LP: #236876:
  - debian/rules: use uudecode to decode .png icons.
* Add a new pyshell.xpm icon.
* Fix doc-base-file-references-missing-file lintian error.
* Fix doc-base-unknown-section lintian warning.
* Fix ruby-script-but-no-ruby-dep lintian errors.
* Fix wish-script-but-no-wish-dep lintian errors.
* Fix missing-dep-for-interpreter errors.
* Bump Standards-Version to 3.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
// Name:        src/gtk/menu.cpp
3
3
// Purpose:
4
4
// Author:      Robert Roebling
5
 
// Id:          $Id: menu.cpp 48053 2007-08-13 17:07:01Z JS $
 
5
// Id:          $Id: menu.cpp 54173 2008-06-12 20:25:44Z JS $
6
6
// Copyright:   (c) 1998 Robert Roebling
7
7
// Licence:     wxWindows licence
8
8
/////////////////////////////////////////////////////////////////////////////
773
773
/* static */
774
774
wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
775
775
{
 
776
#if 0
776
777
    // The argument to this function will now always be in wxWidgets standard label
777
778
    // format, not GTK+ format, so we do what the other ports do.
 
779
    // Actually, m_text is in GTK+ format this function is used on it
 
780
    // we need to retain the original code below.
778
781
 
779
782
    return wxStripMenuCodes(text);
780
783
 
781
 
#if 0
 
784
#else
782
785
    wxString label;
783
786
 
784
787
    for ( const wxChar *pc = text.c_str(); *pc; pc++ )
905
908
    {
906
909
        // if the accelerator was taken from a stock ID, just get it back from GTK+ stock
907
910
        if (wxGetStockGtkAccelerator(stockid, &accel_mods, &accel_key))
908
 
            gtk_widget_remove_accelerator( GTK_WIDGET(m_menuItem),
909
 
                                           m_parentMenu->m_accel,
910
 
                                           accel_key,
911
 
                                           accel_mods );
 
911
            gtk_widget_add_accelerator( GTK_WIDGET(m_menuItem),
 
912
                                        "activate",
 
913
                                        m_parentMenu->m_accel,
 
914
                                        accel_key,
 
915
                                        accel_mods,
 
916
                                        GTK_ACCEL_VISIBLE);
912
917
    }
913
918
}
914
919
 
1043
1048
    m_menu = gtk_menu_new();
1044
1049
    // NB: keep reference to the menu so that it is not destroyed behind
1045
1050
    //     our back by GTK+ e.g. when it is removed from menubar:
1046
 
    gtk_widget_ref(m_menu);
 
1051
    g_object_ref(m_menu);
 
1052
    gtk_object_sink(GTK_OBJECT(m_menu));
1047
1053
 
1048
1054
    m_owner = (GtkWidget*) NULL;
1049
1055
 
1069
1075
 
1070
1076
wxMenu::~wxMenu()
1071
1077
{
1072
 
   WX_CLEAR_LIST(wxMenuItemList, m_items);
1073
 
 
1074
1078
   if ( GTK_IS_WIDGET( m_menu ))
1075
1079
   {
1076
1080
       // see wxMenu::Init
1077
 
       gtk_widget_unref( m_menu );
 
1081
       g_object_unref(m_menu);
1078
1082
       g_object_unref( m_accel );
1079
1083
       // if the menu is inserted in another menu at this time, there was
1080
1084
       // one more reference to it:
1312
1316
    if ( !wxMenuBase::DoRemove(item) )
1313
1317
        return (wxMenuItem *)NULL;
1314
1318
 
1315
 
    // TODO: this code doesn't delete the item factory item and this seems
1316
 
    //       impossible as of GTK 1.2.6.
1317
 
    gtk_widget_destroy( item->GetMenuItem() );
 
1319
    GtkWidget* mitem = item->GetMenuItem();
 
1320
    gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL);
 
1321
    gtk_widget_destroy(mitem);
 
1322
    item->SetMenuItem(NULL);
1318
1323
 
1319
1324
    return item;
1320
1325
}