Files
libreoffice/vcl/osx/salmenu.cxx

948 lines
29 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes (at least) relevant parts of: linecap: Reintegrating finished LineCap feature Patch contributed by Regina Henschel http://svn.apache.org/viewvc?view=revision&revision=1232507 Patches contributed by Sven Jacobi impress212: #i81610# fixed animation export http://svn.apache.org/viewvc?view=revision&revision=1167620 impress212: drawinglayer gbuild environment changes http://svn.apache.org/viewvc?view=revision&revision=1167627 http://svn.apache.org/viewvc?view=revision&revision=1167628 impress212: DffPropSet -> minor code improvements, removing table http://svn.apache.org/viewvc?view=revision&revision=1167634 impress212: #158494# fixed excel import (text rotation) http://svn.apache.org/viewvc?view=revision&revision=1167638 Patches contributed by Armin Le Grand Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement http://svn.apache.org/viewvc?view=revision&revision=1220836 #118728# changed indentifying definitions for Svg file detection http://svn.apache.org/viewvc?view=revision&revision=1229961 #118838# LineGeometry creation for complicated cases optimized to create single Polygons http://svn.apache.org/viewvc?view=revision&revision=1236232 #119176# corrected file type detection for SVG for svg files without xml header http://svn.apache.org/viewvc?view=revision&revision=1309445 #118728# Extended Svg file detection http://svn.apache.org/viewvc?view=revision&revision=1230531 #118529# solve break converters and convert commands for OLEs and images http://svn.apache.org/viewvc?view=revision&revision=1186168 svg: added WaE changes from branch svgreplacement to trunc http://svn.apache.org/viewvc?view=revision&revision=1222974 svg: corrected missing member initialization http://svn.apache.org/viewvc?view=revision&revision=1226134 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert metafiles to bitmapEx ... http://svn.apache.org/viewvc?view=revision&revision=1293316 fix for #118525#: removed no longer used variable maOriginalMapMode, one more exception eliminated http://svn.apache.org/viewvc?view=revision&revision=1227097 #16758# Added buffering to the VDev usages of the VclProcessor2D derivates... http://svn.apache.org/viewvc?view=revision&revision=1229521 #116758# Secured VDev buffer device to Vcl deinit http://svn.apache.org/viewvc?view=revision&revision=1230574 #116758# added remembering allocated VDevs for VDevBuffer to be able to also delete these when vcl goes down; it should never happen, but You never know http://svn.apache.org/viewvc?view=revision&revision=1230927 #118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive representation instead of TransparencePrimitive2D http://svn.apache.org/viewvc?view=revision&revision=1231198 #118822# secured 3D geometry creation (slices) by subdividing the 2D source polyPolygon early http://svn.apache.org/viewvc?view=revision&revision=1234749 #118829# enhanced Svg gradient quality, obstacles avoided http://svn.apache.org/viewvc?view=revision&revision=1235361 #118834# Unified usage of TextBreakupHelper as single tooling class for i18n text primitive breakup http://svn.apache.org/viewvc?view=revision&revision=1236110 #118853# added square pixel size limit to conversion of TransparencePrimitive2D to Metafile action http://svn.apache.org/viewvc?view=revision&revision=1237656 #118824# coreccted mirroring and boundrect when the graphicmanager is used for bitmap output http://svn.apache.org/viewvc?view=revision&revision=1240097 #115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for various optimization scenarios http://svn.apache.org/viewvc?view=revision&revision=1241434 #118783# Corrected errors in ID strings, corrected Svg line/fill export, corrected polygon close state http://svn.apache.org/viewvc?view=revision&revision=1232006 #118796# corrected null-pointer usage in SVG text exporter http://svn.apache.org/viewvc?view=revision&revision=1240262 #118729# Use GraphicStreamUrl and GraphicUrl to allow multi image import with linked graphics, too http://svn.apache.org/viewvc?view=revision&revision=1229962 #118898# corrected error in GDIMetaFile::GetBoundRect in handling MetaFloatTransparentAction http://svn.apache.org/viewvc?view=revision&revision=1293349 #118855# Corrected handling of possibly created empty clipRegions after PolyPolygon clipping http://svn.apache.org/viewvc?view=revision&revision=1237725 #115962# Better (but not yet optimal, see comments in task) handling of MetaFloatTransparentAction in PDF export http://svn.apache.org/viewvc?view=revision&revision=1241078 IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ... http://svn.apache.org/viewvc?view=revision&revision=1200879 118779# Added svg content streaming in/out to ImpGraphic stream operators http://svn.apache.org/viewvc?view=revision&revision=1231908 linecap: correctons for WaE and mac drawing http://svn.apache.org/viewvc?view=revision&revision=1232793 svg: uses current system Dpi for Svg replacement image creation http://svn.apache.org/viewvc?view=revision&revision=1233948 Patches contributed by Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 http://svn.apache.org/viewvc?view=revision&revision=1394326 Remove duplicate header includes. cws mba34issues01: #i117720#: convert assertion into warning http://svn.apache.org/viewvc?view=revision&revision=1172352 118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand. http://svn.apache.org/viewvc?view=revision&revision=1182166 cws mba34issues01: #i117714#: remove assertion http://svn.apache.org/viewvc?view=revision&revision=1172357 Patch contributed by Jurgen Schmidt add some additional checks to ensure proper reading operations http://svn.apache.org/viewvc?view=revision&revision=1209022 mostly prefer our stream / bounds checking work. Patches contributed by Herbert Duerr #i118816# add clarifying comment regarding Font::*Color*() methods http://svn.apache.org/viewvc?view=revision&revision=1233833 extend macro->string handling for empty strings http://svn.apache.org/viewvc?view=revision&revision=1175801 avoid magic constants for SALCOLOR_NONE http://svn.apache.org/viewvc?view=revision&revision=1177543 initialize slant properly in ImplFontMetricData constructor (author=iorsh) http://svn.apache.org/viewvc?view=revision&revision=1177551 #i118675# make check for extension updates more stable http://svn.apache.org/viewvc?view=revision&revision=1214797 #a118617# remove VBasicEventListener.dll binary There are no known users depending on its CLSID http://svn.apache.org/viewvc?view=revision&revision=1203697 Patches contributed by Ariel Constenla-Haile Fix build breaker on Linux/gcc http://svn.apache.org/viewvc?view=revision&revision=1221104 Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG http://svn.apache.org/viewvc?view=revision&revision=1215559 Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider instances of <SwFlyDrawObj> http://svn.apache.org/viewvc?view=revision&revision=1172120 sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 gnumake4 work variously from Hans-Joachim Lankenau http://svn.apache.org/viewvc?view=revision&revision=1397315 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1396782 http://svn.apache.org/viewvc?view=revision&revision=1394707 plus some amount of re-splitting of legacy headers. Patch contributed by Pavel Janik WaE: Remove unused variables. http://svn.apache.org/viewvc?view=revision&revision=1230697 Patches contributed by Takashi Ono mingwport35: i#117795: MinGW port fix for vcl2gnumake http://svn.apache.org/viewvc?view=revision&revision=1172091 mingwport35: i#117795: MinGW port fix for vcl2gnumake http://svn.apache.org/viewvc?view=revision&revision=1172091 Patch contributed by Christian Lippka impress212: #i98044# re enable Text menu for outline and title shapes http://svn.apache.org/viewvc?view=revision&revision=1167639 Patch contributed by Andre Fischer 118674: Made category B code optional and disabled by default. http://svn.apache.org/viewvc?view=revision&revision=1215131 118881: Ignore empty paragraphs after bullets. http://svn.apache.org/viewvc?view=revision&revision=1296205 Patches contributed by Philipp Lohmann ooo340fixes: #i117780# use rtl allocator http://svn.apache.org/viewvc?view=revision&revision=1172087 ooo34gsl02: #i117807# fix an off by one error (index actually inside the pfb section header) http://svn.apache.org/viewvc?view=revision&revision=1167576 various cleanups, related compilation fixes, warning cleanups, re-working of obsolete stl template pieces to use boost instead, changed string classes, re-adapt KDE about data, about dialog, fixing warnings, and other fixes & improvements. Disable svg import / render for about/ branding code-paths for now. Restore full icon theme set. Remove OS/2 conditionals and sources. Remove conflicting gtk/full-screen monitors support. Retain existing svg rasterizer files - temporarily disabled. Standardize stringificaiton and fixup dllpostfix issues. Rename SvgGradientHelper::== to equalTo to avoid overloading issues. Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
2011-11-18 21:03:31 +00:00
#include <comphelper/string.hxx>
#include "rtl/ustrbuf.hxx"
#include "vcl/cmdevt.hxx"
#include "vcl/floatwin.hxx"
#include "vcl/window.hxx"
#include "vcl/svapp.hxx"
#include "osx/saldata.hxx"
#include "osx/salinst.h"
#include "osx/salmenu.h"
#include "osx/salnsmenu.h"
#include "osx/salframe.h"
#include "osx/a11ywrapper.h"
#include "quartz/utils.h"
#include "svids.hrc"
#include "window.h"
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
#include <objc/objc-runtime.h>
namespace {
void releaseButtonEntry( AquaSalMenu::MenuBarButtonEntry& i_rEntry )
{
if( i_rEntry.mpNSImage )
{
[i_rEntry.mpNSImage release];
i_rEntry.mpNSImage = nil;
}
if( i_rEntry.mpToolTipString )
{
[i_rEntry.mpToolTipString release];
i_rEntry.mpToolTipString = nil;
}
}
}
const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
@interface MainMenuSelector : NSObject
{
}
-(void)showDialog: (ShowDialogId)nDialog;
-(void)showPreferences: (id)sender;
-(void)showAbout: (id)sender;
@end
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
@implementation MainMenuSelector
-(void)showDialog: (ShowDialogId)nDialog
{
if( AquaSalMenu::pCurrentMenuBar )
{
const AquaSalFrame* pFrame = AquaSalMenu::pCurrentMenuBar->mpFrame;
if( pFrame && AquaSalFrame::isAlive( pFrame ) )
{
pFrame->CallCallback( SALEVENT_SHOWDIALOG, reinterpret_cast<void*>(nDialog) );
}
}
else
{
OUString aDialog;
if( nDialog == ShowDialogId::About )
aDialog = "ABOUT";
else if( nDialog == ShowDialogId::Preferences )
aDialog = "PREFERENCES";
2011-11-03 16:50:24 +01:00
const ApplicationEvent* pAppEvent = new ApplicationEvent(
ApplicationEvent::TYPE_SHOWDIALOG, aDialog);
AquaSalInstance::aAppEventList.push_back( pAppEvent );
}
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
-(void)showPreferences: (id) sender
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
2011-02-15 16:39:25 +01:00
(void)sender;
YIELD_GUARD;
[self showDialog: ShowDialogId::Preferences];
}
-(void)showAbout: (id) sender
{
2011-02-15 16:39:25 +01:00
(void)sender;
YIELD_GUARD;
[self showDialog: ShowDialogId::About];
}
@end
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
// FIXME: currently this is leaked
static MainMenuSelector* pMainMenuSelector = nil;
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
static void initAppMenu()
{
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
static bool bOnce = true;
if( bOnce )
{
bOnce = false;
ResMgr* pMgr = ImplGetResMgr();
if( pMgr )
{
// get the main menu
NSMenu* pMainMenu = [NSApp mainMenu];
if( pMainMenu != nil )
{
// create the action selector
pMainMenuSelector = [[MainMenuSelector alloc] init];
// get the proper submenu
NSMenu* pAppMenu = [[pMainMenu itemAtIndex: 0] submenu];
if( pAppMenu )
{
// insert about entry
OUString aAbout( ResId( SV_STDTEXT_ABOUT, *pMgr ) );
NSString* pString = CreateNSString( aAbout );
NSMenuItem* pNewItem = [pAppMenu insertItemWithTitle: pString
action: @selector(showAbout:)
keyEquivalent: @""
atIndex: 0];
if (pString)
[pString release];
if( pNewItem )
{
[pNewItem setTarget: pMainMenuSelector];
[pAppMenu insertItem: [NSMenuItem separatorItem] atIndex: 1];
}
// insert preferences entry
OUString aPref( ResId( SV_STDTEXT_PREFERENCES, *pMgr ) );
pString = CreateNSString( aPref );
pNewItem = [pAppMenu insertItemWithTitle: pString
action: @selector(showPreferences:)
keyEquivalent: @","
atIndex: 2];
if (pString)
[pString release];
if( pNewItem )
{
[pNewItem setKeyEquivalentModifierMask: NSCommandKeyMask];
[pNewItem setTarget: pMainMenuSelector];
[pAppMenu insertItem: [NSMenuItem separatorItem] atIndex: 3];
}
// WARNING: ultra ugly code ahead
// rename standard entries
// rename "Services"
pNewItem = [pAppMenu itemAtIndex: 4];
if( pNewItem )
{
pString = CreateNSString( OUString( ResId( SV_MENU_MAC_SERVICES, *pMgr ) ) );
[pNewItem setTitle: pString];
if( pString )
[pString release];
}
// rename "Hide NewApplication"
pNewItem = [pAppMenu itemAtIndex: 6];
if( pNewItem )
{
pString = CreateNSString( OUString( ResId( SV_MENU_MAC_HIDEAPP, *pMgr ) ) );
[pNewItem setTitle: pString];
if( pString )
[pString release];
}
// rename "Hide Others"
pNewItem = [pAppMenu itemAtIndex: 7];
if( pNewItem )
{
pString = CreateNSString( OUString( ResId( SV_MENU_MAC_HIDEALL, *pMgr ) ) );
[pNewItem setTitle: pString];
if( pString )
[pString release];
}
// rename "Show all"
pNewItem = [pAppMenu itemAtIndex: 8];
if( pNewItem )
{
pString = CreateNSString( OUString( ResId( SV_MENU_MAC_SHOWALL, *pMgr ) ) );
[pNewItem setTitle: pString];
if( pString )
[pString release];
}
// rename "Quit NewApplication"
pNewItem = [pAppMenu itemAtIndex: 10];
if( pNewItem )
{
pString = CreateNSString( OUString( ResId( SV_MENU_MAC_QUITAPP, *pMgr ) ) );
[pNewItem setTitle: pString];
if( pString )
[pString release];
}
}
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
}
}
SalMenu* AquaSalInstance::CreateMenu( bool bMenuBar, Menu* pVCLMenu )
{
initAppMenu();
AquaSalMenu *pAquaSalMenu = new AquaSalMenu( bMenuBar );
pAquaSalMenu->mpVCLMenu = pVCLMenu;
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
return pAquaSalMenu;
}
void AquaSalInstance::DestroyMenu( SalMenu* pSalMenu )
{
delete pSalMenu;
}
SalMenuItem* AquaSalInstance::CreateMenuItem( const SalItemParams* pItemData )
{
if( !pItemData )
return NULL;
AquaSalMenuItem *pSalMenuItem = new AquaSalMenuItem( pItemData );
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
return pSalMenuItem;
}
void AquaSalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem )
{
delete pSalMenuItem;
}
/*
* AquaSalMenu
*/
AquaSalMenu::AquaSalMenu( bool bMenuBar ) :
mbMenuBar( bMenuBar ),
mpMenu( nil ),
mpVCLMenu( NULL ),
mpFrame( NULL ),
mpParentSalMenu( NULL )
{
if( ! mbMenuBar )
{
mpMenu = [[SalNSMenu alloc] initWithMenu: this];
[mpMenu setDelegate: reinterpret_cast< id<NSMenuDelegate> >(mpMenu)];
}
else
{
mpMenu = [NSApp mainMenu];
}
[mpMenu setAutoenablesItems: NO];
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
AquaSalMenu::~AquaSalMenu()
{
// actually someone should have done AquaSalFrame::SetMenu( NULL )
// on our frame, alas it is not so
if( mpFrame && AquaSalFrame::isAlive( mpFrame ) && mpFrame->mpMenu == this )
const_cast<AquaSalFrame*>(mpFrame)->mpMenu = NULL;
// this should normally be empty already, but be careful...
for( size_t i = 0; i < maButtons.size(); i++ )
releaseButtonEntry( maButtons[i] );
maButtons.clear();
// is this leaking in some cases ? the release often leads to a duplicate release
// it seems the parent item gets ownership of the menu
if( mpMenu )
{
if( mbMenuBar )
{
if( pCurrentMenuBar == this )
{
// if the current menubar gets destroyed, set the default menubar
setDefaultMenu();
}
}
else
// the system may still hold a reference on mpMenu
{
// so set the pointer to this AquaSalMenu to NULL
// to protect from calling a dead object
// in ! mbMenuBar case our mpMenu is actually a SalNSMenu*
// so we can safely cast here
[static_cast<SalNSMenu*>(mpMenu) setSalMenu: NULL];
/* #i89860# FIXME:
using [autorelease] here (and in AquaSalMenuItem::~AquaSalMenuItem)
instead of [release] fixes an occasional crash. That should
indicate that we release menus / menu items in the wrong order
somewhere, but I could not find that case.
*/
[mpMenu autorelease];
}
}
}
sal_Int32 removeUnusedItemsRunner(NSMenu * pMenu)
{
NSArray * elements = [pMenu itemArray];
NSEnumerator * it = [elements objectEnumerator];
id elem;
NSMenuItem * lastDisplayedMenuItem = nil;
sal_Int32 drawnItems = 0;
bool firstEnabledItemIsNoSeparator = false;
while((elem=[it nextObject]) != nil) {
NSMenuItem * item = static_cast<NSMenuItem *>(elem);
if( (![item isEnabled] && ![item isSeparatorItem]) || ([item isSeparatorItem] && (lastDisplayedMenuItem != nil && [lastDisplayedMenuItem isSeparatorItem])) ) {
[[item menu]removeItem:item];
} else {
if( ! firstEnabledItemIsNoSeparator && [item isSeparatorItem] ) {
[[item menu]removeItem:item];
} else {
firstEnabledItemIsNoSeparator = true;
lastDisplayedMenuItem = item;
drawnItems++;
if( [item hasSubmenu] ) {
removeUnusedItemsRunner( [item submenu] );
}
}
}
}
if( lastDisplayedMenuItem != nil && [lastDisplayedMenuItem isSeparatorItem]) {
[[lastDisplayedMenuItem menu]removeItem:lastDisplayedMenuItem];
}
return drawnItems;
}
bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, FloatWinPopupFlags nFlags)
{
// do not use native popup menu when AQUA_NATIVE_MENUS is set to false
if( ! VisibleMenuBar() ) {
return false;
}
// set offsets for positioning
const float offset = 9.0;
// get the pointers
AquaSalFrame * pParentAquaSalFrame = static_cast<AquaSalFrame *>(pWin->ImplGetWindowImpl()->mpRealParent->ImplGetFrame());
NSWindow* pParentNSWindow = pParentAquaSalFrame->mpNSWindow;
NSView* pParentNSView = [pParentNSWindow contentView];
NSView* pPopupNSView = static_cast<AquaSalFrame *>(pWin->ImplGetWindow()->ImplGetFrame())->mpNSView;
NSRect popupFrame = [pPopupNSView frame];
// since we manipulate the menu below (removing entries)
// let's rather make a copy here and work with that
NSMenu* pCopyMenu = [mpMenu copy];
// filter disabled elements
removeUnusedItemsRunner( pCopyMenu );
// create frame rect
NSRect displayPopupFrame = NSMakeRect( rRect.Left()+(offset-1), rRect.Top()+(offset+1), popupFrame.size.width, 0 );
pParentAquaSalFrame->VCLToCocoa(displayPopupFrame, false);
// do the same strange semantics as vcl popup windows to arrive at a frame geometry
// in mirrored UI case; best done by actually executing the same code
sal_uInt16 nArrangeIndex;
pWin->SetPosPixel( FloatingWindow::ImplCalcPos( pWin, rRect, nFlags, nArrangeIndex ) );
displayPopupFrame.origin.x = pWin->ImplGetFrame()->maGeometry.nX - pParentAquaSalFrame->maGeometry.nX + offset;
displayPopupFrame.origin.y = pWin->ImplGetFrame()->maGeometry.nY - pParentAquaSalFrame->maGeometry.nY + offset;
pParentAquaSalFrame->VCLToCocoa(displayPopupFrame, false);
// #i111992# if this menu was opened due to a key event, prevent dispatching that yet again
if( [pParentNSView respondsToSelector: @selector(clearLastEvent)] )
[pParentNSView performSelector:@selector(clearLastEvent)];
// open popup menu
NSPopUpButtonCell * pPopUpButtonCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO];
[pPopUpButtonCell setMenu: pCopyMenu];
[pPopUpButtonCell selectItem:nil];
[AquaA11yWrapper setPopupMenuOpen: YES];
[pPopUpButtonCell performClickWithFrame:displayPopupFrame inView:pParentNSView];
[pPopUpButtonCell release];
[AquaA11yWrapper setPopupMenuOpen: NO];
// clean up the copy
[pCopyMenu release];
return true;
}
int AquaSalMenu::getItemIndexByPos( sal_uInt16 nPos ) const
{
int nIndex = 0;
if( nPos == MENU_APPEND )
nIndex = [mpMenu numberOfItems];
else
nIndex = sal::static_int_cast<int>( mbMenuBar ? nPos+1 : nPos );
return nIndex;
}
const AquaSalFrame* AquaSalMenu::getFrame() const
{
const AquaSalMenu* pMenu = this;
while( pMenu && ! pMenu->mpFrame )
pMenu = pMenu->mpParentSalMenu;
return pMenu ? pMenu->mpFrame : NULL;
}
void AquaSalMenu::unsetMainMenu()
{
pCurrentMenuBar = NULL;
// remove items from main menu
NSMenu* pMenu = [NSApp mainMenu];
for( int nItems = [pMenu numberOfItems]; nItems > 1; nItems-- )
[pMenu removeItemAtIndex: 1];
}
void AquaSalMenu::setMainMenu()
{
DBG_ASSERT( mbMenuBar, "setMainMenu on non menubar" );
if( mbMenuBar )
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
if( pCurrentMenuBar != this )
{
unsetMainMenu();
// insert our items
for( std::vector<AquaSalMenuItem *>::size_type i = 0; i < maItems.size(); i++ )
{
NSMenuItem* pItem = maItems[i]->mpMenuItem;
[mpMenu insertItem: pItem atIndex: i+1];
}
pCurrentMenuBar = this;
// change status item
statusLayout();
}
enableMainMenu( true );
}
}
void AquaSalMenu::setDefaultMenu()
{
NSMenu* pMenu = [NSApp mainMenu];
unsetMainMenu();
// insert default items
std::vector< NSMenuItem* >& rFallbackMenu( GetSalData()->maFallbackMenu );
for( unsigned int i = 0, nAddItems = rFallbackMenu.size(); i < nAddItems; i++ )
{
NSMenuItem* pItem = rFallbackMenu[i];
if( [pItem menu] == nil )
[pMenu insertItem: pItem atIndex: i+1];
}
}
void AquaSalMenu::enableMainMenu( bool bEnable )
{
NSMenu* pMainMenu = [NSApp mainMenu];
if( pMainMenu )
{
// enable/disable items from main menu
int nItems = [pMainMenu numberOfItems];
for( int n = 1; n < nItems; n++ )
{
NSMenuItem* pItem = [pMainMenu itemAtIndex: n];
[pItem setEnabled: bEnable ? YES : NO];
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
}
void AquaSalMenu::addFallbackMenuItem( NSMenuItem* pNewItem )
{
initAppMenu();
std::vector< NSMenuItem* >& rFallbackMenu( GetSalData()->maFallbackMenu );
// prevent duplicate insertion
int nItems = rFallbackMenu.size();
for( int i = 0; i < nItems; i++ )
{
if( rFallbackMenu[i] == pNewItem )
return;
}
// push the item to the back and retain it
[pNewItem retain];
rFallbackMenu.push_back( pNewItem );
if( pCurrentMenuBar == NULL )
setDefaultMenu();
}
void AquaSalMenu::removeFallbackMenuItem( NSMenuItem* pOldItem )
{
std::vector< NSMenuItem* >& rFallbackMenu( GetSalData()->maFallbackMenu );
// find item
unsigned int nItems = rFallbackMenu.size();
for( unsigned int i = 0; i < nItems; i++ )
{
if( rFallbackMenu[i] == pOldItem )
{
// remove item and release
rFallbackMenu.erase( rFallbackMenu.begin() + i );
[pOldItem release];
if( pCurrentMenuBar == NULL )
setDefaultMenu();
return;
}
}
}
bool AquaSalMenu::VisibleMenuBar()
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
// Enable/disable experimental native menus code?
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
// To disable native menus, set the environment variable AQUA_NATIVE_MENUS to FALSE
static const char *pExperimental = getenv ("AQUA_NATIVE_MENUS");
if ( pExperimental && !strcasecmp(pExperimental, "FALSE") )
return false;
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
// End of experimental code enable/disable part
return true;
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
void AquaSalMenu::SetFrame( const SalFrame *pFrame )
{
mpFrame = static_cast<const AquaSalFrame*>(pFrame);
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
void AquaSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
{
AquaSalMenuItem *pAquaSalMenuItem = static_cast<AquaSalMenuItem*>(pSalMenuItem);
pAquaSalMenuItem->mpParentMenu = this;
DBG_ASSERT( pAquaSalMenuItem->mpVCLMenu == NULL ||
pAquaSalMenuItem->mpVCLMenu == mpVCLMenu ||
mpVCLMenu == NULL,
"resetting menu ?" );
if( pAquaSalMenuItem->mpVCLMenu )
mpVCLMenu = pAquaSalMenuItem->mpVCLMenu;
if( nPos == MENU_APPEND || nPos == maItems.size() )
maItems.push_back( pAquaSalMenuItem );
else if( nPos < maItems.size() )
maItems.insert( maItems.begin() + nPos, pAquaSalMenuItem );
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
else
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "invalid item index in insert" );
return;
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
if( ! mbMenuBar || pCurrentMenuBar == this )
[mpMenu insertItem: pAquaSalMenuItem->mpMenuItem atIndex: getItemIndexByPos(nPos)];
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
void AquaSalMenu::RemoveItem( unsigned nPos )
{
AquaSalMenuItem* pRemoveItem = NULL;
if( nPos == MENU_APPEND || nPos == (maItems.size()-1) )
{
pRemoveItem = maItems.back();
maItems.pop_back();
}
else if( nPos < maItems.size() )
{
pRemoveItem = maItems[ nPos ];
maItems.erase( maItems.begin()+nPos );
}
else
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "invalid item index in remove" );
return;
}
pRemoveItem->mpParentMenu = NULL;
if( ! mbMenuBar || pCurrentMenuBar == this )
[mpMenu removeItemAtIndex: getItemIndexByPos(nPos)];
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
2011-02-15 16:39:25 +01:00
void AquaSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned /*nPos*/ )
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
AquaSalMenuItem *pAquaSalMenuItem = static_cast<AquaSalMenuItem*>(pSalMenuItem);
AquaSalMenu *subAquaSalMenu = static_cast<AquaSalMenu*>(pSubMenu);
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
if (subAquaSalMenu)
{
pAquaSalMenuItem->mpSubMenu = subAquaSalMenu;
if( subAquaSalMenu->mpParentSalMenu == NULL )
{
subAquaSalMenu->mpParentSalMenu = this;
[pAquaSalMenuItem->mpMenuItem setSubmenu: subAquaSalMenu->mpMenu];
// set title of submenu
[subAquaSalMenu->mpMenu setTitle: [pAquaSalMenuItem->mpMenuItem title]];
}
else if( subAquaSalMenu->mpParentSalMenu != this )
{
// cocoa doesn't allow menus to be submenus of multiple
// menu items, so place a copy in the menu item instead ?
// let's hope that NSMenu copy does the right thing
NSMenu* pCopy = [subAquaSalMenu->mpMenu copy];
[pAquaSalMenuItem->mpMenuItem setSubmenu: pCopy];
// set title of submenu
[pCopy setTitle: [pAquaSalMenuItem->mpMenuItem title]];
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
else
{
if( pAquaSalMenuItem->mpSubMenu )
{
if( pAquaSalMenuItem->mpSubMenu->mpParentSalMenu == this )
pAquaSalMenuItem->mpSubMenu->mpParentSalMenu = NULL;
}
pAquaSalMenuItem->mpSubMenu = NULL;
[pAquaSalMenuItem->mpMenuItem setSubmenu: nil];
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
void AquaSalMenu::CheckItem( unsigned nPos, bool bCheck )
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
if( nPos < maItems.size() )
{
NSMenuItem* pItem = maItems[nPos]->mpMenuItem;
[pItem setState: bCheck ? NSOnState : NSOffState];
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
void AquaSalMenu::EnableItem( unsigned nPos, bool bEnable )
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
if( nPos < maItems.size() )
{
NSMenuItem* pItem = maItems[nPos]->mpMenuItem;
[pItem setEnabled: bEnable ? YES : NO];
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
2011-02-15 16:39:25 +01:00
void AquaSalMenu::SetItemImage( unsigned /*nPos*/, SalMenuItem* pSMI, const Image& rImage )
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
AquaSalMenuItem* pSalMenuItem = static_cast<AquaSalMenuItem*>( pSMI );
if( ! pSalMenuItem || ! pSalMenuItem->mpMenuItem )
return;
NSImage* pImage = CreateNSImage( rImage );
CWS-TOOLING: integrate CWS vcl103 2009-07-24 Jens-Heiner Rechtien #i10000#: merge with m53 2009-07-10 Philipp Lohmann merge 2009-07-10 hdu #i103417# ignore non-standard font styles 2009-07-07 Philipp Lohmann #i98789# add: Invalidate on StateChanged( STATE_CHANGE_ENABLE ) 2009-07-07 Philipp Lohmann #i102501# ExportFormFields should be persistent 2009-07-07 Philipp Lohmann merge 2009-07-07 Philipp Lohmann #i103319# there is no platform currently where we should beep on disabled controls 2009-07-02 Philipp Lohmann merge 2009-07-01 Philipp Lohmann #i93100# handle ListBox with no border a little more graceful on MacOSX 2009-07-01 Philipp Lohmann #i101307# don't crash due to unfortunate timing 2009-07-03 thb #i103145# Swapped HINT_DOCK for HINT_TOOLBAR for the presentation fullscreen window; anecdotal evidence suggests it works much better then for wide-spread window managers 2009-06-30 Philipp Lohmann #i103102# evaluate Cmd-Option key combinations 2009-06-29 Philipp Lohmann #i103148# catch exception from missing UCB (thanks thb) 2009-06-29 hdu #i102378# fix PDF-export on PPC (thanks cloph!) 2009-06-25 Philipp Lohmann fix another link problem 2009-06-24 Philipp Lohmann use correct method signature 2009-06-24 Philipp Lohmann fix a warning 2009-06-24 Philipp Lohmann fix a warning 2009-06-24 Philipp Lohmann #i100357# add: GDIMetaFile::GetBoundRect 2009-06-24 Philipp Lohmann merge 2009-06-24 hdu #i100357# extend GetTextBoundRect() to measure justified text too 2009-06-23 Philipp Lohmann #i101108# protect writer from itself, no one could ever use paper of size (0,0) 2009-06-22 Philipp Lohmann merge 2009-06-22 Philipp Lohmann #i92356# treat windows running a popup menu as modal 2009-06-22 hdu #i100000# remove sft.h again (CWS dba32b accidentially reintroduced it) 2009-06-17 Philipp Lohmann merge 2009-06-17 Philipp Lohmann remove warnings (thanks ericb) 2009-06-17 Philipp Lohmann merge 2009-06-17 Philipp Lohmann #i102133# free cursors (thanks cmc) 2009-06-17 Philipp Lohmann #i97293# catch exception 2009-06-17 Philipp Lohmann #i91240# fix images in menus, again 2009-06-15 Philipp Lohmann #i100586# fix a pure virtual method (thanks cmc) 2009-06-15 Philipp Lohmann fix an array delete issue 2009-06-15 Philipp Lohmann #i102228# fix a cleanup issue 2009-06-15 Philipp Lohmann #i97218# solve duplicate accelerator 2009-06-12 hdu #i102219# avoid void*->oslGenericFunction cast for MingW (thanks tono!)
2009-07-24 15:45:35 +00:00
[pSalMenuItem->mpMenuItem setImage: pImage];
if( pImage )
[pImage release];
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
void AquaSalMenu::SetItemText( unsigned /*i_nPos*/, SalMenuItem* i_pSalMenuItem, const OUString& i_rText )
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
CWS-TOOLING: integrate CWS vcl97 2008-12-11 20:47:52 +0100 pl r265361 : #i93173# revert change, event listeners on the toolbar can lead to crashes 2008-12-11 17:55:54 +0100 pl r265344 : #i92715# fix some border cases 2008-12-11 16:36:01 +0100 pl r265334 : remove forgotten debug printf 2008-12-11 15:54:25 +0100 pl r265323 : add missing pointer initializer 2008-12-11 14:08:44 +0100 as r265297 : #i86520# dont show start module twice 2008-12-11 12:56:34 +0100 as r265289 : #i86520# dont show start module twice 2008-12-11 12:22:18 +0100 pl r265280 : fix a snafu 2008-12-11 12:15:27 +0100 hdu r265279 : #i96549# change some dbg_assert to dbg_warn 2008-12-11 11:57:22 +0100 pl r265276 : #i86520# startcenter on dock item click for mac 2008-12-11 11:31:47 +0100 pl r265271 : #i96964# fix a wrong condition 2008-12-11 11:21:49 +0100 as r265268 : #i86520# new framework slot for ShowStartModule 2008-12-11 10:17:32 +0100 hdu r265251 : #i97127# use fontconfig fallbacks for psprinting too (thanks CMC!) 2008-12-09 10:18:41 +0100 hdu r265060 : #i96549# workaround MAC_OS_X_VERSION_* macros not defined in older SDKs 2008-12-09 09:39:47 +0100 hdu r265057 : #i89650# workaround bogus device resolutions 2008-12-09 09:14:23 +0100 hdu r265054 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-08 19:17:42 +0100 pl r265016 : CWS-TOOLING: rebase CWS vcl97 to trunk@264807 (milestone: DEV300:m37) 2008-12-08 16:06:58 +0100 hdu r265004 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 only for the Aqua port 2008-12-08 12:16:26 +0100 hdu r264988 : #i96549# prepare for MAC_OS_X_VERSION_MIN_REQUIRED>=1050 2008-12-08 11:59:25 +0100 hdu r264982 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-04 18:19:43 +0100 pl r264866 : #i86520# install a handler to be called on dock icon clicked 2008-12-03 13:04:32 +0100 pl r264769 : #i96551# on quartz build neither gtk nor cups in psprint is needed 2008-11-26 15:07:07 +0100 hdu r264400 : #i96317# adjust to extented SAL_DISABLE_FC_SUBST semantic 2008-11-21 16:15:31 +0100 pl r264147 : #i94443# generalize focus behavior when a child window becomes invisible 2008-11-21 15:45:03 +0100 pl r264144 : #i96433# improve torn off toolbar behavior 2008-11-21 11:50:01 +0100 pl r264119 : #i90083# improve key event dispatching 2008-11-20 17:28:03 +0100 pl r264076 : #i92715# do not execute app events during document recovery 2008-11-20 15:04:32 +0100 pl r264057 : #i92224# #i93249# more aqua key codes 2008-11-20 14:03:00 +0100 pl r264052 : #i92224# #i93249# remove debug printf 2008-11-20 14:00:29 +0100 pl r264049 : #i92224# #i93249# more aqua key codes 2008-11-20 13:59:34 +0100 pl r264048 : #i92224# #i93249# more aqua key codes 2008-11-20 13:52:38 +0100 pl r264047 : #i92224# #i93249# more aqua key codes 2008-11-19 18:42:17 +0100 pl r264017 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:40:26 +0100 pl r264016 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:32:31 +0100 pl r264014 : #i92224# support some mac specifc key codes: select to line end/begin 2008-11-19 17:34:50 +0100 pl r264009 : #i92224# some more needed keycodes 2008-11-19 16:11:33 +0100 pl r264003 : #i93249# support some mac specifc key codes 2008-11-19 16:10:31 +0100 pl r264002 : #i93249# support some mac specifc key codes 2008-11-19 15:50:03 +0100 pl r264000 : #i93249# support some mac specifc key codes 2008-11-19 14:17:41 +0100 pl r263993 : #i90015# strip appended parenthese entries from menubar 2008-11-17 18:30:37 +0100 pl r263737 : #i94601# emulate menu functionality for non vcl dialogs 2008-11-17 17:31:12 +0100 pl r263731 : #i95263# set inactive tab color on mac more distinct from the active tab color 2008-11-17 17:13:38 +0100 pl r263729 : #i93173# delete toolbar window in a more stack aware manner
2009-01-02 15:26:18 +00:00
if (!i_pSalMenuItem)
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
return;
AquaSalMenuItem *pAquaSalMenuItem = static_cast<AquaSalMenuItem *>(i_pSalMenuItem);
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
// Delete mnemonics
OUString aText( comphelper::string::remove(i_rText, '~') );
CWS-TOOLING: integrate CWS vcl97 2008-12-11 20:47:52 +0100 pl r265361 : #i93173# revert change, event listeners on the toolbar can lead to crashes 2008-12-11 17:55:54 +0100 pl r265344 : #i92715# fix some border cases 2008-12-11 16:36:01 +0100 pl r265334 : remove forgotten debug printf 2008-12-11 15:54:25 +0100 pl r265323 : add missing pointer initializer 2008-12-11 14:08:44 +0100 as r265297 : #i86520# dont show start module twice 2008-12-11 12:56:34 +0100 as r265289 : #i86520# dont show start module twice 2008-12-11 12:22:18 +0100 pl r265280 : fix a snafu 2008-12-11 12:15:27 +0100 hdu r265279 : #i96549# change some dbg_assert to dbg_warn 2008-12-11 11:57:22 +0100 pl r265276 : #i86520# startcenter on dock item click for mac 2008-12-11 11:31:47 +0100 pl r265271 : #i96964# fix a wrong condition 2008-12-11 11:21:49 +0100 as r265268 : #i86520# new framework slot for ShowStartModule 2008-12-11 10:17:32 +0100 hdu r265251 : #i97127# use fontconfig fallbacks for psprinting too (thanks CMC!) 2008-12-09 10:18:41 +0100 hdu r265060 : #i96549# workaround MAC_OS_X_VERSION_* macros not defined in older SDKs 2008-12-09 09:39:47 +0100 hdu r265057 : #i89650# workaround bogus device resolutions 2008-12-09 09:14:23 +0100 hdu r265054 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-08 19:17:42 +0100 pl r265016 : CWS-TOOLING: rebase CWS vcl97 to trunk@264807 (milestone: DEV300:m37) 2008-12-08 16:06:58 +0100 hdu r265004 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 only for the Aqua port 2008-12-08 12:16:26 +0100 hdu r264988 : #i96549# prepare for MAC_OS_X_VERSION_MIN_REQUIRED>=1050 2008-12-08 11:59:25 +0100 hdu r264982 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-04 18:19:43 +0100 pl r264866 : #i86520# install a handler to be called on dock icon clicked 2008-12-03 13:04:32 +0100 pl r264769 : #i96551# on quartz build neither gtk nor cups in psprint is needed 2008-11-26 15:07:07 +0100 hdu r264400 : #i96317# adjust to extented SAL_DISABLE_FC_SUBST semantic 2008-11-21 16:15:31 +0100 pl r264147 : #i94443# generalize focus behavior when a child window becomes invisible 2008-11-21 15:45:03 +0100 pl r264144 : #i96433# improve torn off toolbar behavior 2008-11-21 11:50:01 +0100 pl r264119 : #i90083# improve key event dispatching 2008-11-20 17:28:03 +0100 pl r264076 : #i92715# do not execute app events during document recovery 2008-11-20 15:04:32 +0100 pl r264057 : #i92224# #i93249# more aqua key codes 2008-11-20 14:03:00 +0100 pl r264052 : #i92224# #i93249# remove debug printf 2008-11-20 14:00:29 +0100 pl r264049 : #i92224# #i93249# more aqua key codes 2008-11-20 13:59:34 +0100 pl r264048 : #i92224# #i93249# more aqua key codes 2008-11-20 13:52:38 +0100 pl r264047 : #i92224# #i93249# more aqua key codes 2008-11-19 18:42:17 +0100 pl r264017 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:40:26 +0100 pl r264016 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:32:31 +0100 pl r264014 : #i92224# support some mac specifc key codes: select to line end/begin 2008-11-19 17:34:50 +0100 pl r264009 : #i92224# some more needed keycodes 2008-11-19 16:11:33 +0100 pl r264003 : #i93249# support some mac specifc key codes 2008-11-19 16:10:31 +0100 pl r264002 : #i93249# support some mac specifc key codes 2008-11-19 15:50:03 +0100 pl r264000 : #i93249# support some mac specifc key codes 2008-11-19 14:17:41 +0100 pl r263993 : #i90015# strip appended parenthese entries from menubar 2008-11-17 18:30:37 +0100 pl r263737 : #i94601# emulate menu functionality for non vcl dialogs 2008-11-17 17:31:12 +0100 pl r263731 : #i95263# set inactive tab color on mac more distinct from the active tab color 2008-11-17 17:13:38 +0100 pl r263729 : #i93173# delete toolbar window in a more stack aware manner
2009-01-02 15:26:18 +00:00
/* #i90015# until there is a correct solution
strip out any appended (.*) in menubar entries
*/
if( mbMenuBar )
{
sal_Int32 nPos = aText.lastIndexOf( '(' );
if( nPos != -1 )
CWS-TOOLING: integrate CWS vcl97 2008-12-11 20:47:52 +0100 pl r265361 : #i93173# revert change, event listeners on the toolbar can lead to crashes 2008-12-11 17:55:54 +0100 pl r265344 : #i92715# fix some border cases 2008-12-11 16:36:01 +0100 pl r265334 : remove forgotten debug printf 2008-12-11 15:54:25 +0100 pl r265323 : add missing pointer initializer 2008-12-11 14:08:44 +0100 as r265297 : #i86520# dont show start module twice 2008-12-11 12:56:34 +0100 as r265289 : #i86520# dont show start module twice 2008-12-11 12:22:18 +0100 pl r265280 : fix a snafu 2008-12-11 12:15:27 +0100 hdu r265279 : #i96549# change some dbg_assert to dbg_warn 2008-12-11 11:57:22 +0100 pl r265276 : #i86520# startcenter on dock item click for mac 2008-12-11 11:31:47 +0100 pl r265271 : #i96964# fix a wrong condition 2008-12-11 11:21:49 +0100 as r265268 : #i86520# new framework slot for ShowStartModule 2008-12-11 10:17:32 +0100 hdu r265251 : #i97127# use fontconfig fallbacks for psprinting too (thanks CMC!) 2008-12-09 10:18:41 +0100 hdu r265060 : #i96549# workaround MAC_OS_X_VERSION_* macros not defined in older SDKs 2008-12-09 09:39:47 +0100 hdu r265057 : #i89650# workaround bogus device resolutions 2008-12-09 09:14:23 +0100 hdu r265054 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-08 19:17:42 +0100 pl r265016 : CWS-TOOLING: rebase CWS vcl97 to trunk@264807 (milestone: DEV300:m37) 2008-12-08 16:06:58 +0100 hdu r265004 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 only for the Aqua port 2008-12-08 12:16:26 +0100 hdu r264988 : #i96549# prepare for MAC_OS_X_VERSION_MIN_REQUIRED>=1050 2008-12-08 11:59:25 +0100 hdu r264982 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-04 18:19:43 +0100 pl r264866 : #i86520# install a handler to be called on dock icon clicked 2008-12-03 13:04:32 +0100 pl r264769 : #i96551# on quartz build neither gtk nor cups in psprint is needed 2008-11-26 15:07:07 +0100 hdu r264400 : #i96317# adjust to extented SAL_DISABLE_FC_SUBST semantic 2008-11-21 16:15:31 +0100 pl r264147 : #i94443# generalize focus behavior when a child window becomes invisible 2008-11-21 15:45:03 +0100 pl r264144 : #i96433# improve torn off toolbar behavior 2008-11-21 11:50:01 +0100 pl r264119 : #i90083# improve key event dispatching 2008-11-20 17:28:03 +0100 pl r264076 : #i92715# do not execute app events during document recovery 2008-11-20 15:04:32 +0100 pl r264057 : #i92224# #i93249# more aqua key codes 2008-11-20 14:03:00 +0100 pl r264052 : #i92224# #i93249# remove debug printf 2008-11-20 14:00:29 +0100 pl r264049 : #i92224# #i93249# more aqua key codes 2008-11-20 13:59:34 +0100 pl r264048 : #i92224# #i93249# more aqua key codes 2008-11-20 13:52:38 +0100 pl r264047 : #i92224# #i93249# more aqua key codes 2008-11-19 18:42:17 +0100 pl r264017 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:40:26 +0100 pl r264016 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:32:31 +0100 pl r264014 : #i92224# support some mac specifc key codes: select to line end/begin 2008-11-19 17:34:50 +0100 pl r264009 : #i92224# some more needed keycodes 2008-11-19 16:11:33 +0100 pl r264003 : #i93249# support some mac specifc key codes 2008-11-19 16:10:31 +0100 pl r264002 : #i93249# support some mac specifc key codes 2008-11-19 15:50:03 +0100 pl r264000 : #i93249# support some mac specifc key codes 2008-11-19 14:17:41 +0100 pl r263993 : #i90015# strip appended parenthese entries from menubar 2008-11-17 18:30:37 +0100 pl r263737 : #i94601# emulate menu functionality for non vcl dialogs 2008-11-17 17:31:12 +0100 pl r263731 : #i95263# set inactive tab color on mac more distinct from the active tab color 2008-11-17 17:13:38 +0100 pl r263729 : #i93173# delete toolbar window in a more stack aware manner
2009-01-02 15:26:18 +00:00
{
sal_Int32 nPos2 = aText.indexOf( ')' );
if( nPos2 != -1 )
aText = aText.replaceAt( nPos, nPos2-nPos+1, "" );
CWS-TOOLING: integrate CWS vcl97 2008-12-11 20:47:52 +0100 pl r265361 : #i93173# revert change, event listeners on the toolbar can lead to crashes 2008-12-11 17:55:54 +0100 pl r265344 : #i92715# fix some border cases 2008-12-11 16:36:01 +0100 pl r265334 : remove forgotten debug printf 2008-12-11 15:54:25 +0100 pl r265323 : add missing pointer initializer 2008-12-11 14:08:44 +0100 as r265297 : #i86520# dont show start module twice 2008-12-11 12:56:34 +0100 as r265289 : #i86520# dont show start module twice 2008-12-11 12:22:18 +0100 pl r265280 : fix a snafu 2008-12-11 12:15:27 +0100 hdu r265279 : #i96549# change some dbg_assert to dbg_warn 2008-12-11 11:57:22 +0100 pl r265276 : #i86520# startcenter on dock item click for mac 2008-12-11 11:31:47 +0100 pl r265271 : #i96964# fix a wrong condition 2008-12-11 11:21:49 +0100 as r265268 : #i86520# new framework slot for ShowStartModule 2008-12-11 10:17:32 +0100 hdu r265251 : #i97127# use fontconfig fallbacks for psprinting too (thanks CMC!) 2008-12-09 10:18:41 +0100 hdu r265060 : #i96549# workaround MAC_OS_X_VERSION_* macros not defined in older SDKs 2008-12-09 09:39:47 +0100 hdu r265057 : #i89650# workaround bogus device resolutions 2008-12-09 09:14:23 +0100 hdu r265054 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-08 19:17:42 +0100 pl r265016 : CWS-TOOLING: rebase CWS vcl97 to trunk@264807 (milestone: DEV300:m37) 2008-12-08 16:06:58 +0100 hdu r265004 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 only for the Aqua port 2008-12-08 12:16:26 +0100 hdu r264988 : #i96549# prepare for MAC_OS_X_VERSION_MIN_REQUIRED>=1050 2008-12-08 11:59:25 +0100 hdu r264982 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-04 18:19:43 +0100 pl r264866 : #i86520# install a handler to be called on dock icon clicked 2008-12-03 13:04:32 +0100 pl r264769 : #i96551# on quartz build neither gtk nor cups in psprint is needed 2008-11-26 15:07:07 +0100 hdu r264400 : #i96317# adjust to extented SAL_DISABLE_FC_SUBST semantic 2008-11-21 16:15:31 +0100 pl r264147 : #i94443# generalize focus behavior when a child window becomes invisible 2008-11-21 15:45:03 +0100 pl r264144 : #i96433# improve torn off toolbar behavior 2008-11-21 11:50:01 +0100 pl r264119 : #i90083# improve key event dispatching 2008-11-20 17:28:03 +0100 pl r264076 : #i92715# do not execute app events during document recovery 2008-11-20 15:04:32 +0100 pl r264057 : #i92224# #i93249# more aqua key codes 2008-11-20 14:03:00 +0100 pl r264052 : #i92224# #i93249# remove debug printf 2008-11-20 14:00:29 +0100 pl r264049 : #i92224# #i93249# more aqua key codes 2008-11-20 13:59:34 +0100 pl r264048 : #i92224# #i93249# more aqua key codes 2008-11-20 13:52:38 +0100 pl r264047 : #i92224# #i93249# more aqua key codes 2008-11-19 18:42:17 +0100 pl r264017 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:40:26 +0100 pl r264016 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:32:31 +0100 pl r264014 : #i92224# support some mac specifc key codes: select to line end/begin 2008-11-19 17:34:50 +0100 pl r264009 : #i92224# some more needed keycodes 2008-11-19 16:11:33 +0100 pl r264003 : #i93249# support some mac specifc key codes 2008-11-19 16:10:31 +0100 pl r264002 : #i93249# support some mac specifc key codes 2008-11-19 15:50:03 +0100 pl r264000 : #i93249# support some mac specifc key codes 2008-11-19 14:17:41 +0100 pl r263993 : #i90015# strip appended parenthese entries from menubar 2008-11-17 18:30:37 +0100 pl r263737 : #i94601# emulate menu functionality for non vcl dialogs 2008-11-17 17:31:12 +0100 pl r263731 : #i95263# set inactive tab color on mac more distinct from the active tab color 2008-11-17 17:13:38 +0100 pl r263729 : #i93173# delete toolbar window in a more stack aware manner
2009-01-02 15:26:18 +00:00
}
}
NSString* pString = CreateNSString( aText );
if (pString)
{
[pAquaSalMenuItem->mpMenuItem setTitle: pString];
// if the menu item has a submenu, change its title as well
if (pAquaSalMenuItem->mpSubMenu)
[pAquaSalMenuItem->mpSubMenu->mpMenu setTitle: pString];
[pString release];
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
void AquaSalMenu::SetAccelerator( unsigned /*nPos*/, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& /*rKeyName*/ )
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
sal_uInt16 nModifier;
sal_Unicode nCommandKey = 0;
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
sal_uInt16 nKeyCode=rKeyCode.GetCode();
if( nKeyCode )
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
if ((nKeyCode>=KEY_A) && (nKeyCode<=KEY_Z)) // letter A..Z
nCommandKey = nKeyCode-KEY_A + 'a';
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
else if ((nKeyCode>=KEY_0) && (nKeyCode<=KEY_9)) // numbers 0..9
nCommandKey = nKeyCode-KEY_0 + '0';
else if ((nKeyCode>=KEY_F1) && (nKeyCode<=KEY_F26)) // function keys F1..F26
nCommandKey = nKeyCode-KEY_F1 + NSF1FunctionKey;
else if( nKeyCode == KEY_REPEAT )
nCommandKey = NSRedoFunctionKey;
else if( nKeyCode == KEY_SPACE )
nCommandKey = ' ';
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
else
{
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
switch (nKeyCode)
{
case KEY_ADD:
nCommandKey='+';
break;
case KEY_SUBTRACT:
nCommandKey='-';
break;
case KEY_MULTIPLY:
nCommandKey='*';
break;
case KEY_DIVIDE:
nCommandKey='/';
break;
case KEY_POINT:
nCommandKey='.';
break;
case KEY_LESS:
nCommandKey='<';
break;
case KEY_GREATER:
nCommandKey='>';
break;
case KEY_EQUAL:
nCommandKey='=';
break;
}
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
else // not even a code ? nonsense -> ignore
return;
DBG_ASSERT( nCommandKey, "unmapped accelerator key" );
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
nModifier=rKeyCode.GetModifier();
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
// should always use the command key
int nItemModifier = 0;
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
if (nModifier & KEY_SHIFT)
{
nItemModifier |= NSShiftKeyMask; // actually useful only for function keys
if( nKeyCode >= KEY_A && nKeyCode <= KEY_Z )
nCommandKey = nKeyCode - KEY_A + 'A';
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
if (nModifier & KEY_MOD1)
nItemModifier |= NSCommandKeyMask;
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
if(nModifier & KEY_MOD2)
nItemModifier |= NSAlternateKeyMask;
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
if(nModifier & KEY_MOD3)
nItemModifier |= NSControlKeyMask;
AquaSalMenuItem *pAquaSalMenuItem = static_cast<AquaSalMenuItem *>(pSalMenuItem);
NSString* pString = CreateNSString( OUString( &nCommandKey, 1 ) );
[pAquaSalMenuItem->mpMenuItem setKeyEquivalent: pString];
[pAquaSalMenuItem->mpMenuItem setKeyEquivalentModifierMask: nItemModifier];
if (pString)
[pString release];
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
2011-02-15 16:39:25 +01:00
void AquaSalMenu::GetSystemMenuData( SystemMenuData* )
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
{
}
AquaSalMenu::MenuBarButtonEntry* AquaSalMenu::findButtonItem( sal_uInt16 i_nItemId )
{
for( size_t i = 0; i < maButtons.size(); ++i )
{
if( maButtons[i].maButton.mnId == i_nItemId )
return &maButtons[i];
}
return NULL;
}
void AquaSalMenu::statusLayout()
{
if( GetSalData()->mpStatusItem )
{
NSView* pNSView = [GetSalData()->mpStatusItem view];
if( [pNSView isMemberOfClass: [OOStatusItemView class]] ) // well of course it is
[(OOStatusItemView*)pNSView layout];
else
2011-03-01 19:08:19 +01:00
OSL_FAIL( "someone stole our status view" );
}
}
bool AquaSalMenu::AddMenuBarButton( const SalMenuButtonItem& i_rNewItem )
{
if( ! mbMenuBar || ! VisibleMenuBar() )
return false;
MenuBarButtonEntry* pEntry = findButtonItem( i_rNewItem.mnId );
if( pEntry )
{
releaseButtonEntry( *pEntry );
pEntry->maButton = i_rNewItem;
pEntry->mpNSImage = CreateNSImage( i_rNewItem.maImage );
if( i_rNewItem.maToolTipText.getLength() )
pEntry->mpToolTipString = CreateNSString( i_rNewItem.maToolTipText );
}
else
{
maButtons.push_back( MenuBarButtonEntry( i_rNewItem ) );
maButtons.back().mpNSImage = CreateNSImage( i_rNewItem.maImage );
maButtons.back().mpToolTipString = CreateNSString( i_rNewItem.maToolTipText );
}
// lazy create status item
SalData::getStatusItem();
if( pCurrentMenuBar == this )
statusLayout();
return true;
}
void AquaSalMenu::RemoveMenuBarButton( sal_uInt16 i_nId )
{
MenuBarButtonEntry* pEntry = findButtonItem( i_nId );
if( pEntry )
{
releaseButtonEntry( *pEntry );
// note: vector guarantees that its contents are in a plain array
maButtons.erase( maButtons.begin() + (pEntry - &maButtons[0]) );
}
if( pCurrentMenuBar == this )
statusLayout();
}
Rectangle AquaSalMenu::GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame )
{
if( ! i_pReferenceFrame || ! AquaSalFrame::isAlive( static_cast<AquaSalFrame*>(i_pReferenceFrame) ) )
return Rectangle();
MenuBarButtonEntry* pEntry = findButtonItem( i_nItemId );
if( ! pEntry )
return Rectangle();
NSStatusItem* pItem = SalData::getStatusItem();
if( ! pItem )
return Rectangle();
NSView* pNSView = [pItem view];
if( ! pNSView )
return Rectangle();
NSWindow* pNSWin = [pNSView window];
if( ! pNSWin )
return Rectangle();
NSRect aRect = [pNSWin convertRectToScreen:[pNSWin frame]];
// make coordinates relative to reference frame
static_cast<AquaSalFrame*>(i_pReferenceFrame)->CocoaToVCL( aRect.origin );
aRect.origin.x -= i_pReferenceFrame->maGeometry.nX;
aRect.origin.y -= i_pReferenceFrame->maGeometry.nY + aRect.size.height;
CWS-TOOLING: integrate CWS vcl103 2009-07-24 Jens-Heiner Rechtien #i10000#: merge with m53 2009-07-10 Philipp Lohmann merge 2009-07-10 hdu #i103417# ignore non-standard font styles 2009-07-07 Philipp Lohmann #i98789# add: Invalidate on StateChanged( STATE_CHANGE_ENABLE ) 2009-07-07 Philipp Lohmann #i102501# ExportFormFields should be persistent 2009-07-07 Philipp Lohmann merge 2009-07-07 Philipp Lohmann #i103319# there is no platform currently where we should beep on disabled controls 2009-07-02 Philipp Lohmann merge 2009-07-01 Philipp Lohmann #i93100# handle ListBox with no border a little more graceful on MacOSX 2009-07-01 Philipp Lohmann #i101307# don't crash due to unfortunate timing 2009-07-03 thb #i103145# Swapped HINT_DOCK for HINT_TOOLBAR for the presentation fullscreen window; anecdotal evidence suggests it works much better then for wide-spread window managers 2009-06-30 Philipp Lohmann #i103102# evaluate Cmd-Option key combinations 2009-06-29 Philipp Lohmann #i103148# catch exception from missing UCB (thanks thb) 2009-06-29 hdu #i102378# fix PDF-export on PPC (thanks cloph!) 2009-06-25 Philipp Lohmann fix another link problem 2009-06-24 Philipp Lohmann use correct method signature 2009-06-24 Philipp Lohmann fix a warning 2009-06-24 Philipp Lohmann fix a warning 2009-06-24 Philipp Lohmann #i100357# add: GDIMetaFile::GetBoundRect 2009-06-24 Philipp Lohmann merge 2009-06-24 hdu #i100357# extend GetTextBoundRect() to measure justified text too 2009-06-23 Philipp Lohmann #i101108# protect writer from itself, no one could ever use paper of size (0,0) 2009-06-22 Philipp Lohmann merge 2009-06-22 Philipp Lohmann #i92356# treat windows running a popup menu as modal 2009-06-22 hdu #i100000# remove sft.h again (CWS dba32b accidentially reintroduced it) 2009-06-17 Philipp Lohmann merge 2009-06-17 Philipp Lohmann remove warnings (thanks ericb) 2009-06-17 Philipp Lohmann merge 2009-06-17 Philipp Lohmann #i102133# free cursors (thanks cmc) 2009-06-17 Philipp Lohmann #i97293# catch exception 2009-06-17 Philipp Lohmann #i91240# fix images in menus, again 2009-06-15 Philipp Lohmann #i100586# fix a pure virtual method (thanks cmc) 2009-06-15 Philipp Lohmann fix an array delete issue 2009-06-15 Philipp Lohmann #i102228# fix a cleanup issue 2009-06-15 Philipp Lohmann #i97218# solve duplicate accelerator 2009-06-12 hdu #i102219# avoid void*->oslGenericFunction cast for MingW (thanks tono!)
2009-07-24 15:45:35 +00:00
return Rectangle( Point(static_cast<long int>(aRect.origin.x),
static_cast<long int>(aRect.origin.y)
),
Size( static_cast<long int>(aRect.size.width),
static_cast<long int>(aRect.size.height)
)
);
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
/*
* SalMenuItem
*/
AquaSalMenuItem::AquaSalMenuItem( const SalItemParams* pItemData ) :
mnId( pItemData->nId ),
mpVCLMenu( pItemData->pMenu ),
mpParentMenu( NULL ),
mpSubMenu( NULL ),
mpMenuItem( nil )
{
// Delete mnemonics
OUString aText( comphelper::string::remove(pItemData->aText, '~') );
if (pItemData->eType == MenuItemType::SEPARATOR)
{
mpMenuItem = [NSMenuItem separatorItem];
// these can go occasionally go in and out of a menu, ensure their lifecycle
// also for the release in AquaSalMenuItem destructor
[mpMenuItem retain];
}
else
{
mpMenuItem = [[SalNSMenuItem alloc] initWithMenuItem: this];
[mpMenuItem setEnabled: YES];
NSString* pString = CreateNSString( aText );
if (pString)
{
[mpMenuItem setTitle: pString];
[pString release];
}
// anything but a separator should set a menu to dispatch to
DBG_ASSERT( mpVCLMenu, "no menu" );
}
}
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
AquaSalMenuItem::~AquaSalMenuItem()
{
/* #i89860# FIXME:
using [autorelease] here (and in AquaSalMenu:::~AquaSalMenu) instead of
[release] fixes an occasional crash. That should indicate that we release
menus / menu items in the wrong order somewhere, but I
could not find that case.
*/
if( mpMenuItem )
[mpMenuItem autorelease];
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED 2007/06/28 04:42:22 ekato 1.1.2.19: Don't swallow Command-Space with menu as it is often used for TSM. 2007/06/05 13:23:08 pl 1.1.2.18: CFString <-> OUString conversion 2007/05/29 13:35:18 pl 1.1.2.17: preferences and about entries in application menu 2007/05/23 13:21:42 pl 1.1.2.16: more convenient logging 2007/04/09 18:50:05 ericb 1.1.2.15: make native menus default in aqua. To use vcl menu set AQUA_NATIVE_MENUS to FALSE 2007/02/18 21:17:34 pjanik 1.1.2.14: Flip menubar images vertically for Quartz. 2007/02/13 09:09:02 pjanik 1.1.2.13: Remove Menu item properties when destroying menus. 2006/12/14 19:23:35 pjanik 1.1.2.12: Add menu accelerators (patch from Ismael Merzaq). 2006/12/14 16:25:18 pjanik 1.1.2.11: Minor cleanup: remove ";" at the end of #define. 2006/12/04 13:08:06 pjanik 1.1.2.10: Implement SetItemImage method for native menus. 2006/08/26 15:21:56 pjanik 1.1.2.9: Move code t the block where it is used. 2006/08/26 13:43:17 pjanik 1.1.2.8: Do not leak menu item texts. 2006/08/23 22:09:47 pjanik 1.1.2.7: Define macro XUBSTRINGTOCFSTRING converting XubString encoded in UTF8 into CFString using UTF8 as encoding. This fixes menu items encoding problems. 2006/08/23 05:18:47 pjanik 1.1.2.6: Use separate constant for menu items pointers. 2006/08/21 15:19:10 pjanik 1.1.2.5: Define environment variable AQUA_NATIVE_MENUS to TRUE at runtime to get native menus. 2006/08/20 16:03:28 pjanik 1.1.2.4: Set sub menu reference in SetSubMenu. Implement SetItemText (tested for menu bar menus, not tested yet for menu item texts). 2006/08/20 15:53:54 pjanik 1.1.2.3: *** empty log message *** 2006/08/20 15:21:54 pjanik 1.1.2.2: announce missing implementation of SetItemImage 2006/08/07 18:30:44 pjanik 1.1.2.1: Add support for antive menus.
2007-07-05 07:31:52 +00:00
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */