Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
1409b974
Kaydet (Commit)
1409b974
authored
Haz 17, 2016
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Resolve: tdf#100429 gtk3: set custom icons in native gtk menus
Change-Id: I4798274f38c34c99d6f22f3c7959ebd9673a8966
üst
0e2a6561
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
0 deletions
+80
-0
glomenu.h
vcl/inc/unx/gtk/glomenu.h
+10
-0
gtksalmenu.hxx
vcl/inc/unx/gtk/gtksalmenu.hxx
+1
-0
glomenu.cxx
vcl/unx/gtk/glomenu.cxx
+37
-0
gtksalmenu.cxx
vcl/unx/gtk/gtksalmenu.cxx
+32
-0
No files found.
vcl/inc/unx/gtk/glomenu.h
Dosyayı görüntüle @
1409b974
...
@@ -69,11 +69,21 @@ void g_lo_menu_set_label (GLOMenu
...
@@ -69,11 +69,21 @@ void g_lo_menu_set_label (GLOMenu
gint
position
,
gint
position
,
const
gchar
*
label
);
const
gchar
*
label
);
void
g_lo_menu_set_icon
(
GLOMenu
*
menu
,
gint
position
,
const
GIcon
*
icon
);
void
g_lo_menu_set_label_to_item_in_section
(
GLOMenu
*
menu
,
void
g_lo_menu_set_label_to_item_in_section
(
GLOMenu
*
menu
,
gint
section
,
gint
section
,
gint
position
,
gint
position
,
const
gchar
*
label
);
const
gchar
*
label
);
void
g_lo_menu_set_icon_to_item_in_section
(
GLOMenu
*
menu
,
gint
section
,
gint
position
,
const
GIcon
*
icon
);
gchar
*
g_lo_menu_get_label_from_item_in_section
(
GLOMenu
*
menu
,
gchar
*
g_lo_menu_get_label_from_item_in_section
(
GLOMenu
*
menu
,
gint
section
,
gint
section
,
gint
position
);
gint
position
);
...
...
vcl/inc/unx/gtk/gtksalmenu.hxx
Dosyayı görüntüle @
1409b974
...
@@ -93,6 +93,7 @@ public:
...
@@ -93,6 +93,7 @@ public:
bool
IsItemVisible
(
unsigned
nPos
);
bool
IsItemVisible
(
unsigned
nPos
);
void
NativeSetItemText
(
unsigned
nSection
,
unsigned
nItemPos
,
const
OUString
&
rText
);
void
NativeSetItemText
(
unsigned
nSection
,
unsigned
nItemPos
,
const
OUString
&
rText
);
void
NativeSetItemIcon
(
unsigned
nSection
,
unsigned
nItemPos
,
const
Image
&
rImage
);
bool
NativeSetItemCommand
(
unsigned
nSection
,
bool
NativeSetItemCommand
(
unsigned
nSection
,
unsigned
nItemPos
,
unsigned
nItemPos
,
sal_uInt16
nId
,
sal_uInt16
nId
,
...
...
vcl/unx/gtk/glomenu.cxx
Dosyayı görüntüle @
1409b974
...
@@ -228,6 +228,23 @@ g_lo_menu_set_label (GLOMenu *menu,
...
@@ -228,6 +228,23 @@ g_lo_menu_set_label (GLOMenu *menu,
g_lo_menu_set_attribute_value
(
menu
,
position
,
G_MENU_ATTRIBUTE_LABEL
,
value
);
g_lo_menu_set_attribute_value
(
menu
,
position
,
G_MENU_ATTRIBUTE_LABEL
,
value
);
}
}
void
g_lo_menu_set_icon
(
GLOMenu
*
menu
,
gint
position
,
const
GIcon
*
icon
)
{
g_return_if_fail
(
G_IS_LO_MENU
(
menu
));
GVariant
*
value
;
if
(
icon
!=
nullptr
)
value
=
g_icon_serialize
(
const_cast
<
GIcon
*>
(
icon
));
else
value
=
nullptr
;
g_lo_menu_set_attribute_value
(
menu
,
position
,
G_MENU_ATTRIBUTE_ICON
,
value
);
}
void
void
g_lo_menu_set_label_to_item_in_section
(
GLOMenu
*
menu
,
g_lo_menu_set_label_to_item_in_section
(
GLOMenu
*
menu
,
gint
section
,
gint
section
,
...
@@ -248,6 +265,26 @@ g_lo_menu_set_label_to_item_in_section (GLOMenu *menu,
...
@@ -248,6 +265,26 @@ g_lo_menu_set_label_to_item_in_section (GLOMenu *menu,
g_object_unref
(
model
);
g_object_unref
(
model
);
}
}
void
g_lo_menu_set_icon_to_item_in_section
(
GLOMenu
*
menu
,
gint
section
,
gint
position
,
const
GIcon
*
icon
)
{
g_return_if_fail
(
G_IS_LO_MENU
(
menu
));
GLOMenu
*
model
=
g_lo_menu_get_section
(
menu
,
section
);
g_return_if_fail
(
model
!=
nullptr
);
g_lo_menu_set_icon
(
model
,
position
,
icon
);
// Notify the update.
g_menu_model_items_changed
(
G_MENU_MODEL
(
model
),
position
,
1
,
1
);
g_object_unref
(
model
);
}
gchar
*
gchar
*
g_lo_menu_get_label_from_item_in_section
(
GLOMenu
*
menu
,
g_lo_menu_get_label_from_item_in_section
(
GLOMenu
*
menu
,
gint
section
,
gint
section
,
...
...
vcl/unx/gtk/gtksalmenu.cxx
Dosyayı görüntüle @
1409b974
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include <unx/gtk/gloactiongroup.h>
#include <unx/gtk/gloactiongroup.h>
#include <vcl/floatwin.hxx>
#include <vcl/floatwin.hxx>
#include <vcl/menu.hxx>
#include <vcl/menu.hxx>
#include <vcl/pngwrite.hxx>
#include <unx/gtk/gtkinst.hxx>
#include <unx/gtk/gtkinst.hxx>
#if GTK_CHECK_VERSION(3,0,0)
#if GTK_CHECK_VERSION(3,0,0)
...
@@ -236,6 +237,7 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries)
...
@@ -236,6 +237,7 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries)
// Get internal menu item values.
// Get internal menu item values.
OUString
aText
=
pVCLMenu
->
GetItemText
(
nId
);
OUString
aText
=
pVCLMenu
->
GetItemText
(
nId
);
Image
aImage
=
pVCLMenu
->
GetItemImage
(
nId
);
bool
bEnabled
=
pVCLMenu
->
IsItemEnabled
(
nId
);
bool
bEnabled
=
pVCLMenu
->
IsItemEnabled
(
nId
);
vcl
::
KeyCode
nAccelKey
=
pVCLMenu
->
GetAccelKey
(
nId
);
vcl
::
KeyCode
nAccelKey
=
pVCLMenu
->
GetAccelKey
(
nId
);
bool
bChecked
=
pVCLMenu
->
IsItemChecked
(
nId
);
bool
bChecked
=
pVCLMenu
->
IsItemChecked
(
nId
);
...
@@ -252,6 +254,8 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries)
...
@@ -252,6 +254,8 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries)
// Force updating of native menu labels.
// Force updating of native menu labels.
NativeSetItemText
(
nSection
,
nItemPos
,
aText
);
NativeSetItemText
(
nSection
,
nItemPos
,
aText
);
if
(
!!
aImage
)
NativeSetItemIcon
(
nSection
,
nItemPos
,
aImage
);
NativeSetAccelerator
(
nSection
,
nItemPos
,
nAccelKey
,
nAccelKey
.
GetName
(
GetFrame
()
->
GetWindow
()
)
);
NativeSetAccelerator
(
nSection
,
nItemPos
,
nAccelKey
,
nAccelKey
.
GetName
(
GetFrame
()
->
GetWindow
()
)
);
if
(
g_strcmp0
(
aNativeCommand
,
""
)
!=
0
&&
pSalMenuItem
->
mpSubMenu
==
nullptr
)
if
(
g_strcmp0
(
aNativeCommand
,
""
)
!=
0
&&
pSalMenuItem
->
mpSubMenu
==
nullptr
)
...
@@ -844,6 +848,34 @@ void GtkSalMenu::NativeSetItemText( unsigned nSection, unsigned nItemPos, const
...
@@ -844,6 +848,34 @@ void GtkSalMenu::NativeSetItemText( unsigned nSection, unsigned nItemPos, const
g_free
(
aLabel
);
g_free
(
aLabel
);
}
}
namespace
{
void
DestroyMemoryStream
(
gpointer
data
)
{
SvMemoryStream
*
pMemStm
=
reinterpret_cast
<
SvMemoryStream
*>
(
data
);
delete
pMemStm
;
}
}
void
GtkSalMenu
::
NativeSetItemIcon
(
unsigned
nSection
,
unsigned
nItemPos
,
const
Image
&
rImage
)
{
SolarMutexGuard
aGuard
;
SvMemoryStream
*
pMemStm
=
new
SvMemoryStream
;
vcl
::
PNGWriter
aWriter
(
rImage
.
GetBitmapEx
());
aWriter
.
Write
(
*
pMemStm
);
GBytes
*
pBytes
=
g_bytes_new_with_free_func
(
pMemStm
->
GetData
(),
pMemStm
->
Seek
(
STREAM_SEEK_TO_END
),
DestroyMemoryStream
,
pMemStm
);
GIcon
*
pIcon
=
g_bytes_icon_new
(
pBytes
);
g_lo_menu_set_icon_to_item_in_section
(
G_LO_MENU
(
mpMenuModel
),
nSection
,
nItemPos
,
pIcon
);
g_object_unref
(
pIcon
);
g_bytes_unref
(
pBytes
);
}
void
GtkSalMenu
::
NativeSetAccelerator
(
unsigned
nSection
,
unsigned
nItemPos
,
const
vcl
::
KeyCode
&
rKeyCode
,
const
OUString
&
rKeyName
)
void
GtkSalMenu
::
NativeSetAccelerator
(
unsigned
nSection
,
unsigned
nItemPos
,
const
vcl
::
KeyCode
&
rKeyCode
,
const
OUString
&
rKeyName
)
{
{
SolarMutexGuard
aGuard
;
SolarMutexGuard
aGuard
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment