这篇教程C++ wxCFStringRef函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wxCFStringRef函数的典型用法代码示例。如果您正苦于以下问题:C++ wxCFStringRef函数的具体用法?C++ wxCFStringRef怎么用?C++ wxCFStringRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wxCFStringRef函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: UMASetMenuItemTextvoid UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title, wxFontEncoding encoding ){ // we don't strip the accels here anymore, must be done before wxString str = title ; SetMenuItemTextWithCFString( menu , item , wxCFStringRef(str , encoding) ) ;}
开发者ID:beanhome,项目名称:dev,代码行数:7,
示例2: GetMonitorProfile void GetMonitorProfile(wxString& profileName, cmsHPROFILE& profile) { ColorsyncIteratorData data; data.dispuuid = CGDisplayCreateUUIDFromDisplayID(CGMainDisplayID()); if (data.dispuuid == NULL) { DEBUG_INFO("CGDisplayCreateUUIDFromDisplayID() failed."); return; } data.url = NULL; ColorSyncIterateDeviceProfiles(ColorSyncIterateCallback, (void *)&data); CFRelease(data.dispuuid); CFStringRef urlstr = CFURLCopyFileSystemPath(data.url, kCFURLPOSIXPathStyle); CFRelease(data.url); if (urlstr == NULL) { DEBUG_INFO("Failed to get URL in CFString"); } else { CFRetain(urlstr); profileName = wxCFStringRef(urlstr).AsString(wxLocale::GetSystemEncoding()); profile = cmsOpenProfileFromFile(profileName.c_str(), "r"); DEBUG_INFO("Found profile: " << profileName.c_str()); }; };
开发者ID:ndevenish,项目名称:Hugin,代码行数:27,
示例3: InstallDebugAssertOutputHandlerbool wxApp::Initialize(int& argc, wxChar **argv){ // Mac-specific#if wxDEBUG_LEVEL && wxOSX_USE_COCOA_OR_CARBON InstallDebugAssertOutputHandler( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) );#endif /* Cocoa supports -Key value options which set the user defaults key "Key" to the value "value" Some of them are very handy for debugging like -NSShowAllViews YES. Cocoa picks these up from the real argv so our removal of them from the wx copy of it does not affect Cocoa's ability to see them. We basically just assume that any "-NS" option and its following argument needs to be removed from argv. We hope that user code does not expect to see -NS options and indeed it's probably a safe bet since most user code accepting options is probably using the double-dash GNU-style syntax. */ for(int i=1; i < argc; ++i) { static const wxChar *ARG_NS = wxT("-NS"); if( wxStrncmp(argv[i], ARG_NS, wxStrlen(ARG_NS)) == 0 ) { // Only eat this option if it has an argument if( (i + 1) < argc ) { memmove(argv + i, argv + i + 2, (argc-i-1)*sizeof(wxChar*)); argc -= 2; // drop back one position so the next run through the loop // reprocesses the argument at our current index. --i; } } } if ( !wxAppBase::Initialize(argc, argv) ) return false;#if wxUSE_INTL wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());#endif // these might be the startup dirs, set them to the 'usual' dir containing the app bundle wxString startupCwd = wxGetCwd() ; if ( startupCwd == wxT("/") || startupCwd.Right(15) == wxT("/Contents/MacOS") ) { CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle() ) ; CFURLRef urlParent = CFURLCreateCopyDeletingLastPathComponent( kCFAllocatorDefault , url ) ; CFRelease( url ) ; CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ; CFRelease( urlParent ) ; wxString cwd = wxCFStringRef(path).AsString(wxLocale::GetSystemEncoding()); wxSetWorkingDirectory( cwd ) ; } return true;}
开发者ID:zhchbin,项目名称:wxWidgets,代码行数:60,
示例4: Stopbool wxOSXAudioToolboxSoundData::Play(unsigned flags){ Stop(); m_flags = flags; wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(m_sndname))); CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); wxCFRef<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false)); AudioServicesCreateSystemSoundID(url, &m_soundID); AudioServicesAddSystemSoundCompletion( m_soundID, CFRunLoopGetCurrent(), NULL, wxOSXAudioToolboxSoundData::CompletionCallback, (void *) this ); bool sync = !(flags & wxSOUND_ASYNC); AudioServicesPlaySystemSound(m_soundID); if ( sync ) { while( m_soundID ) { CFRunLoopRun(); } } return true;}
开发者ID:NullNoname,项目名称:dolphin,代码行数:27,
示例5: cfStringvoid OpenUserDataRec::EventProcCBPopupMenuSelect(NavCBRecPtr ioParams){ NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ; const size_t numFilters = m_extensions.GetCount(); if ( menu->menuType < numFilters ) { m_currentfilter = menu->menuType ; if ( m_saveMode ) { int i = menu->menuType ; // isolate the first extension string wxString firstExtension = m_extensions[i].BeforeFirst('|').BeforeFirst(';'); wxString extension = firstExtension.AfterLast('.') ; wxString sfilename ; wxCFStringRef cfString( wxCFRetain( NavDialogGetSaveFileName( ioParams->context ) ) ); sfilename = cfString.AsString() ; int pos = sfilename.Find('.', true) ; if ( pos != wxNOT_FOUND && extension != wxT("*") ) { sfilename = sfilename.Left(pos+1)+extension ; cfString = wxCFStringRef( sfilename , wxFONTENCODING_DEFAULT ) ; NavDialogSetSaveFileName( ioParams->context , cfString ) ; } } }}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:31,
示例6: CFArrayGetCountvoid wxOSXPrintData::TransferPrinterNameFrom( const wxPrintData &data ){ CFArrayRef printerList; CFIndex index, count; CFStringRef name; if (PMServerCreatePrinterList(kPMServerLocal, &printerList) == noErr) { PMPrinter printer = NULL; count = CFArrayGetCount(printerList); for (index = 0; index < count; index++) { printer = (PMPrinter)CFArrayGetValueAtIndex(printerList, index); if ((data.GetPrinterName().empty()) && (PMPrinterIsDefault(printer))) break; else { name = PMPrinterGetName(printer); CFRetain(name); if (data.GetPrinterName() == wxCFStringRef(name).AsString()) break; } } if (index < count) PMSessionSetCurrentPMPrinter(m_macPrintSession, printer); CFRelease(printerList); }}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:28,
示例7: BundleRelativeURLToPathstatic wxString BundleRelativeURLToPath(CFURLRef relativeURL){ CFURLRef absoluteURL = CFURLCopyAbsoluteURL(relativeURL); wxCHECK_MSG(absoluteURL, wxEmptyString, wxT("Failed to resolve relative URL to absolute URL")); CFStringRef cfStrPath = CFURLCopyFileSystemPath(absoluteURL,kDefaultPathStyle); CFRelease(absoluteURL); return wxCFStringRef(cfStrPath).AsString(wxLocale::GetSystemEncoding());}
开发者ID:BloodRedd,项目名称:gamekit,代码行数:8,
示例8: UMAAppendSubMenuItemvoid UMAAppendSubMenuItem( MenuRef menu , const wxString& title, wxFontEncoding encoding , MenuRef submenu ){ AppendMenuItemTextWithCFString( menu, CFSTR("A"), 0, 0,NULL); UMASetMenuItemText( menu, (SInt16) ::CountMenuItems(menu), title , encoding ); SetMenuItemHierarchicalMenu( menu , CountMenuItems( menu ) , submenu ) ; SetMenuTitleWithCFString(submenu , wxCFStringRef(title , encoding) );}
开发者ID:beanhome,项目名称:dev,代码行数:8,
示例9: PMPrintSettingsSetJobNamebool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message ){ if ( m_err ) return false ; wxPrinterDCImpl *impl = (wxPrinterDCImpl*) dc->GetImpl(); wxOSXPrintData *native = (wxOSXPrintData*) impl->GetPrintData().GetNativeData() ; PMPrintSettingsSetJobName(native->GetPrintSettings(), wxCFStringRef(message)); m_err = PMSessionBeginCGDocumentNoDialog(native->GetPrintSession(), native->GetPrintSettings(), native->GetPageFormat()); if ( m_err != noErr ) return false; PMRect rPage; m_err = PMGetAdjustedPageRect(native->GetPageFormat(), &rPage); if ( m_err != noErr ) return false ; m_maxX = wxCoord(rPage.right - rPage.left) ; m_maxY = wxCoord(rPage.bottom - rPage.top); PMResolution res; PMPrinter printer; m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer); if (m_err == noErr) {#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 if ( PMPrinterGetOutputResolution != NULL ) { m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ; if ( m_err == -9589 /* kPMKeyNotFound */ ) { m_err = noErr ; res.hRes = res.vRes = 300; } } else#endif {#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 if ( PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res) != noErr ) { res.hRes = res.vRes = 300; }#endif } } m_maxX = wxCoord((double)m_maxX * res.hRes / 72.0); m_maxY = wxCoord((double)m_maxY * res.vRes / 72.0); m_ppi = wxSize(int(res.hRes), int(res.vRes)); return true ;}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:58,
示例10: SetLabel void SetLabel( const wxString& text, wxAcceleratorEntry *entry ) { MenuItemIndex i = FindMenuItemIndex() ; if ( i > 0 ) { SetMenuItemTextWithCFString( m_parentMenuRef, i, wxCFStringRef(text)); UMASetMenuItemShortcut( m_parentMenuRef, i , entry ) ; } }
开发者ID:iokto,项目名称:newton-dynamics,代码行数:9,
示例11: UMANewMenuMenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding ){ wxString str = wxStripMenuCodes( title ) ; MenuRef menu ; CreateNewMenu( id , 0 , &menu ) ; SetMenuTitleWithCFString( menu , wxCFStringRef(str , encoding ) ) ; return menu ;}
开发者ID:beanhome,项目名称:dev,代码行数:10,
示例12: GetPathForIconFile// Given an application bundle reference and the name of an icon file// which is a resource in that bundle, look up the full (posix style)// path to that icon. Returns the path, or an empty wxString on failurewxString GetPathForIconFile( CFBundleRef bundle, CFStringRef iconFile ){ // If either parameter is NULL there is no hope of success if( !bundle || !iconFile ) return wxEmptyString; // Create a range object representing the whole string CFRange wholeString; wholeString.location = 0; wholeString.length = CFStringGetLength( iconFile ); // Index of the period in the file name for iconFile UniCharCount periodIndex; // In order to locate the period delimiting the extension, // iconFile must be represented as UniChar[] { // Allocate a buffer and copy in the iconFile string UniChar* buffer = new UniChar[ wholeString.length ]; CFStringGetCharacters( iconFile, wholeString, buffer ); // Locate the period character OSStatus status = LSGetExtensionInfo( wholeString.length, buffer, &periodIndex ); // Deallocate the buffer delete [] buffer; // If the period could not be located it will not be possible to get the URL if( status != noErr || periodIndex == kLSInvalidExtensionIndex ) return wxEmptyString; } // Range representing the name part of iconFile CFRange iconNameRange; iconNameRange.location = 0; iconNameRange.length = periodIndex - 1; // Range representing the extension part of iconFile CFRange iconExtRange; iconExtRange.location = periodIndex; iconExtRange.length = wholeString.length - periodIndex; // Get the name and extension strings wxCFStringRef iconName = CFStringCreateWithSubstring( kCFAllocatorDefault, iconFile, iconNameRange ); wxCFStringRef iconExt = CFStringCreateWithSubstring( kCFAllocatorDefault, iconFile, iconExtRange ); // Now it is possible to query the URL for the icon as a resource wxCFRef< CFURLRef > iconUrl = wxCFRef< CFURLRef >( CFBundleCopyResourceURL( bundle, iconName, iconExt, NULL ) ); if( !iconUrl.get() ) return wxEmptyString; // All being well, return the icon path return wxCFStringRef( CFURLCopyFileSystemPath( iconUrl, kCFURLPOSIXPathStyle ) ).AsString();}
开发者ID:chromylei,项目名称:third_party,代码行数:58,
示例13: SHGetSpecialFolderLocation/// Set File to hash in wxTextCtrlvoidAlcFrame::SetFileToHash(){#ifdef __WXMSW__ wxString browseroot; LPITEMIDLIST pidl; HRESULT hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl); if (SUCCEEDED(hr)) { if (!SHGetPathFromIDList(pidl, wxStringBuffer(browseroot, MAX_PATH))) { browseroot = wxFileName::GetHomeDir(); } } else { browseroot = wxFileName::GetHomeDir(); } if (pidl) { LPMALLOC pMalloc; SHGetMalloc(&pMalloc); if (pMalloc) { pMalloc->Free(pidl); pMalloc->Release(); } }#elif defined(__WXMAC__) FSRef fsRef; wxString browseroot; if (FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &fsRef) == noErr) { CFURLRef urlRef = CFURLCreateFromFSRef(NULL, &fsRef); CFStringRef cfString = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); CFRelease(urlRef) ; #if wxCHECK_VERSION(2, 9, 0) browseroot = wxCFStringRef(cfString).AsString(wxLocale::GetSystemEncoding()); #else browseroot = wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding()); #endif } else { browseroot = wxFileName::GetHomeDir(); }#else wxString browseroot = wxFileName::GetHomeDir();#endif const wxString & filename = wxFileSelector (_("Select the file you want to compute the eD2k link"), browseroot, wxEmptyString, wxEmptyString, wxT("*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST, this); if (!filename.empty ()) { m_inputFileTextCtrl->SetValue(filename); }}
开发者ID:dreamerc,项目名称:amule,代码行数:54,
示例14: CFReleasevoid wxDataFormat::SetId( const wxString& zId ){ m_type = wxDF_PRIVATE; m_id = zId; if ( m_format != 0 ) { CFRelease( (CFStringRef) m_format ); m_format = 0; } // since it is private, no need to conform to anything ... m_format = (long) wxCFRetain( (CFStringRef) wxCFStringRef(m_id) );}
开发者ID:lukesingh24,项目名称:wxWidgets,代码行数:12,
示例15: docTypesKey// Look up the (locale) display name and icon file associated with a UTIvoid wxMimeTypesManagerImpl::LoadDisplayDataForUti(const wxString& uti){ // Keys in to Info.plist const static wxCFStringRef docTypesKey( "CFBundleDocumentTypes" ); const static wxCFStringRef descKey( "CFBundleTypeName" ); const static wxCFStringRef iconKey( "CFBundleTypeIconFile" ); // The call for finding the preferred application for a UTI is LSCopyDefaultRoleHandlerForContentType // This returns an empty string on OS X 10.5 // Instead it is necessary to get the primary extension and use LSGetApplicationForInfo wxCFStringRef ext = UTTypeCopyPreferredTagWithClass( wxCFStringRef( uti ), kUTTagClassFilenameExtension ); // Look up the preferred application CFURLRef appUrl; OSStatus status = LSGetApplicationForInfo( kLSUnknownType, kLSUnknownCreator, ext, kLSRolesAll, NULL, &appUrl ); if( status != noErr ) return; // Create a bundle object for that application wxCFRef< CFBundleRef > bundle; bundle = wxCFRef< CFBundleRef >( CFBundleCreate( kCFAllocatorDefault, appUrl ) ); if( !bundle ) return; // Also get the open command while we have the bundle wxCFStringRef cfsAppPath(CFURLCopyFileSystemPath(appUrl, kCFURLPOSIXPathStyle)); m_utiMap[ uti ].application = cfsAppPath.AsString(); // Get all the document type data in this bundle CFTypeRef docTypeData; docTypeData = CFBundleGetValueForInfoDictionaryKey( bundle, docTypesKey ); if( !docTypeData ) return; // Find the document type entry that matches ext CFDictionaryRef docType; docType = GetDocTypeForExt( docTypeData, ext ); if( !docType ) return; // Get the display name for docType wxCFStringRef description = reinterpret_cast< CFStringRef >( CFDictionaryGetValue( docType, descKey ) ); wxCFRetain( description.get() ); m_utiMap[ uti ].description = description.AsString(); // Get the icon path for docType CFStringRef iconFile = reinterpret_cast< CFStringRef > ( CFDictionaryGetValue( docType, iconKey ) ); m_utiMap[ uti ].iconLoc.SetFileName( GetPathForIconFile( bundle, iconFile ) );}
开发者ID:chromylei,项目名称:third_party,代码行数:54,
示例16: GetResourcesDir// returns e.g. "/Applications/appname.app/Contents/Resources" if application is bundled,// or the directory of the binary, e.g. "/usr/local/bin/appname", if it is *not* bundled.static wxString GetResourcesDir(){ CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); CFURLRef absoluteURL = CFURLCopyAbsoluteURL(resourcesURL); // relative -> absolute CFRelease(resourcesURL); CFStringRef cfStrPath = CFURLCopyFileSystemPath(absoluteURL,kCFURLPOSIXPathStyle); CFRelease(absoluteURL); #if wxCHECK_VERSION(3, 0, 0) return wxCFStringRef(cfStrPath).AsString(wxLocale::GetSystemEncoding()); #else return wxMacCFStringHolder(cfStrPath).AsString(wxLocale::GetSystemEncoding()); #endif}
开发者ID:stahta01,项目名称:codeblocks_console,代码行数:15,
示例17: PMSessionGetCurrentPrintervoid wxOSXPrintData::TransferPrinterNameTo( wxPrintData &data ){ CFStringRef name; PMPrinter printer ; PMSessionGetCurrentPrinter( m_macPrintSession, &printer ); if (PMPrinterIsDefault(printer)) data.SetPrinterName(wxEmptyString); else { name = PMPrinterGetName(printer); CFRetain(name); data.SetPrinterName(wxCFStringRef(name).AsString()); }}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:14,
示例18: wxDoLaunchDefaultBrowserbool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params){ wxCFRef< CFURLRef > curl( CFURLCreateWithString( kCFAllocatorDefault, wxCFStringRef( params.url ), NULL ) ); OSStatus err = LSOpenCFURLRef( curl , NULL ); if (err == noErr) { return true; } else { wxLogDebug(wxT("Browser Launch error %d"), (int) err); return false; }}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:16,
示例19: InstallDebugAssertOutputHandlerbool wxApp::Initialize(int& argc, wxChar **argv){ // Mac-specific#if wxDEBUG_LEVEL && wxOSX_USE_COCOA_OR_CARBON InstallDebugAssertOutputHandler( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) );#endif // Mac OS X passes a process serial number command line argument when // the application is launched from the Finder. This argument must be // removed from the command line arguments before being handled by the // application (otherwise applications would need to handle it) if ( argc > 1 ) { static const wxChar *ARG_PSN = wxT("-psn_"); if ( wxStrncmp(argv[1], ARG_PSN, wxStrlen(ARG_PSN)) == 0 ) { // remove this argument --argc; memmove(argv + 1, argv + 2, argc * sizeof(char *)); } } if ( !wxAppBase::Initialize(argc, argv) ) return false;#if wxUSE_INTL wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());#endif // these might be the startup dirs, set them to the 'usual' dir containing the app bundle wxString startupCwd = wxGetCwd() ; if ( startupCwd == wxT("/") || startupCwd.Right(15) == wxT("/Contents/MacOS") ) { CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle() ) ; CFURLRef urlParent = CFURLCreateCopyDeletingLastPathComponent( kCFAllocatorDefault , url ) ; CFRelease( url ) ; CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ; CFRelease( urlParent ) ; wxString cwd = wxCFStringRef(path).AsString(wxLocale::GetSystemEncoding()); wxSetWorkingDirectory( cwd ) ; } return true;}
开发者ID:NullNoname,项目名称:dolphin,代码行数:45,
示例20: wxLaunchDefaultApplicationbool wxLaunchDefaultApplication(const wxString& document, int flags){ wxUnusedVar(flags); wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(document))); CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); wxCFRef<CFURLRef> curl(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false)); OSStatus err = LSOpenCFURLRef( curl , NULL ); if (err == noErr) { return true; } else { wxLogDebug(wxT("Default Application Launch error %d"), (int) err); return false; }}
开发者ID:Kaoswerk,项目名称:newton-dynamics,代码行数:19,
示例21: wxMacPathToFSRefOSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ){ OSStatus err = noErr ; CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(path)); CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kDefaultPathStyle, false); CFRelease( cfMutableString ); if ( NULL != url ) { if ( CFURLGetFSRef(url, fsRef) == false ) err = fnfErr ; CFRelease( url ) ; } else { err = fnfErr ; } return err ;}
开发者ID:mheinsen,项目名称:wxWidgets,代码行数:19,
示例22: InsertOrAppend virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) { // MacOS counts menu items from 1 and inserts after, therefore having the // same effect as wx 0 based and inserting before, we must correct pos // after however for updates to be correct MenuItemIndex index = pos; if ( pos == (size_t) -1 ) index = CountMenuItems(m_osxMenu); if ( pItem->IsSeparator() ) { InsertMenuItemTextWithCFString( m_osxMenu, CFSTR(""), index, kMenuItemAttrSeparator, 0); // now switch to the Carbon 1 based counting index += 1 ; } else { InsertMenuItemTextWithCFString( m_osxMenu, CFSTR("placeholder"), index, 0, 0 ); // now switch to the Carbon 1 based counting index += 1 ; if ( pItem->IsSubMenu() ) { MenuRef submenu = pItem->GetSubMenu()->GetHMenu(); SetMenuItemHierarchicalMenu(m_osxMenu, index, submenu); // carbon is using the title of the submenu, eg in the menubar SetMenuTitleWithCFString(submenu, wxCFStringRef(pItem->GetItemLabelText())); } else { SetMenuItemCommandID( m_osxMenu, index , wxIdToMacCommand(pItem->GetId()) ) ; } } wxMenuItemCarbonImpl* impl = (wxMenuItemCarbonImpl*) pItem->GetPeer(); impl->AttachToParent( m_osxMenu, index ); // only now can all settings be updated correctly pItem->UpdateItemText(); pItem->UpdateItemStatus(); pItem->UpdateItemBitmap(); }
开发者ID:iokto,项目名称:newton-dynamics,代码行数:42,
示例23: MakeUserDataRecOpenUserDataRec::OpenUserDataRec( wxFileDialog* d){ m_dialog = d; m_controlAdded = false; m_saveMode = m_dialog->HasFdFlag(wxFD_SAVE); m_defaultLocation = m_dialog->GetDirectory(); MakeUserDataRec(m_dialog->GetWildcard()); m_currentfilter = m_dialog->GetFilterIndex(); m_menuitems = NULL; size_t numFilters = m_extensions.GetCount(); if (numFilters) { m_menuitems = CFArrayCreateMutable( kCFAllocatorDefault , numFilters , &kCFTypeArrayCallBacks ) ; for ( size_t i = 0 ; i < numFilters ; ++i ) { CFArrayAppendValue( m_menuitems , (CFStringRef) wxCFStringRef( m_name[i] ) ) ; } } m_lastRight = m_lastBottom = 0;}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:24,
示例24: WXUNUSEDwxWidgetImplType* wxWidgetImpl::CreateDisclosureTriangle( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxString& label, const wxPoint& pos, const wxSize& size, long WXUNUSED(style), long WXUNUSED(extraStyle)){ Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; wxMacControl* peer = new wxMacControl(wxpeer) ; OSStatus err = CreateDisclosureTriangleControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds, kControlDisclosureTrianglePointDefault, wxCFStringRef( label ), 0, // closed TRUE, // draw title TRUE, // auto toggle back and forth peer->GetControlRefAddr() ); verify_noerr( err ); return peer;}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:24,
示例25: WX_HOOK_MODAL_DIALOGint wxMessageDialog::ShowModal(){ WX_HOOK_MODAL_DIALOG(); int resultbutton = wxID_CANCEL; const long style = GetMessageDialogStyle(); wxASSERT_MSG( (style & 0x3F) != wxYES, "this style is not supported on Mac" ); AlertType alertType = kAlertPlainAlert; switch ( GetEffectiveIcon() ) { case wxICON_ERROR: alertType = kAlertStopAlert; break; case wxICON_WARNING: alertType = kAlertCautionAlert; break; case wxICON_QUESTION: case wxICON_INFORMATION: alertType = kAlertNoteAlert; break; } // (the standard alert has two slots [title, text] // for the three wxStrings [caption, message, extended message]) // // if the extended text is empty we use the caption and // the message (for backwards compatibility) // // if the extended text is not empty we ignore the caption // and use the message and the extended message wxString msgtitle,msgtext; if(m_extendedMessage.IsEmpty()) { if ( m_caption.IsEmpty() ) msgtitle = m_message; else { msgtitle = m_caption; msgtext = m_message; } } else { msgtitle = m_message; msgtext = m_extendedMessage; } if ( !wxIsMainThread() ) { CFStringRef defaultButtonTitle = NULL; CFStringRef alternateButtonTitle = NULL; CFStringRef otherButtonTitle = NULL; wxCFStringRef cfTitle( msgtitle, GetFont().GetEncoding() ); wxCFStringRef cfText( msgtext, GetFont().GetEncoding() ); wxCFStringRef cfNoString( GetNoLabel().c_str(), GetFont().GetEncoding() ); wxCFStringRef cfYesString( GetYesLabel().c_str(), GetFont().GetEncoding() ); wxCFStringRef cfOKString( GetOKLabel().c_str() , GetFont().GetEncoding()) ; wxCFStringRef cfCancelString( GetCancelLabel().c_str(), GetFont().GetEncoding() ); int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ }; if (style & wxYES_NO) { if ( style & wxNO_DEFAULT ) { defaultButtonTitle = cfNoString; alternateButtonTitle = cfYesString; buttonId[0] = wxID_NO; buttonId[1] = wxID_YES; } else { defaultButtonTitle = cfYesString; alternateButtonTitle = cfNoString; buttonId[0] = wxID_YES; buttonId[1] = wxID_NO; } if (style & wxCANCEL) { otherButtonTitle = cfCancelString; buttonId[2] = wxID_CANCEL; } } else { // the MSW implementation even shows an OK button if it is not specified, we'll do the same buttonId[0] = wxID_OK; // using null as default title does not work on earlier systems//.........这里部分代码省略.........
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:101,
示例26: wxMacCarbonFontPanelHandlerpascal OSStatuswxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler), EventRef event, void *userData){ OSStatus result = eventNotHandledErr ; wxFontDialog *fontdialog = (wxFontDialog*) userData ; wxFontData& fontdata= fontdialog->GetFontData() ; wxMacCarbonEvent cEvent( event ); switch(cEvent.GetKind()) { case kEventFontSelection : { bool setup = false ;#if wxOSX_USE_CORE_TEXT if ( UMAGetSystemVersion() >= 0x1050 ) { CTFontDescriptorRef descr; if ( cEvent.GetParameter<CTFontDescriptorRef>( kEventParamCTFontDescriptor, typeCTFontDescriptorRef, &descr ) == noErr ) { wxFont font; wxNativeFontInfo fontinfo; fontinfo.Init(descr); font.Create(fontinfo); fontdata.SetChosenFont( font ) ; setup = true; } }#endif#if wxOSX_USE_ATSU_TEXT ATSUFontID fontId = 0 ; if ( !setup && (cEvent.GetParameter<ATSUFontID>(kEventParamATSUFontID, &fontId) == noErr) ) { FMFontStyle fontStyle = cEvent.GetParameter<FMFontStyle>(kEventParamFMFontStyle); FMFontSize fontSize = cEvent.GetParameter<FMFontSize>(kEventParamFMFontSize); CFStringRef cfName = NULL;#if 1 FMFontFamily fontFamily = cEvent.GetParameter<FMFontFamily>(kEventParamFMFontFamily); ATSFontFamilyRef atsfontfamilyref = FMGetATSFontFamilyRefFromFontFamily( fontFamily ) ; OSStatus err = ATSFontFamilyGetName( atsfontfamilyref , kATSOptionFlagsDefault , &cfName ) ; if ( err != noErr ) { wxFAIL_MSG("ATSFontFamilyGetName failed"); }#else // we don't use the ATSU naming anymore ByteCount actualLength = 0; char *c = NULL; OSStatus err = ATSUFindFontName(fontId , kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode, kFontNoLanguageCode , 0 , NULL , &actualLength , NULL ); if ( err == noErr) { actualLength += 1 ; char *c = (char*)malloc( actualLength ); err = ATSUFindFontName(fontId, kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode, kFontNoLanguageCode, actualLength, c , NULL, NULL); cfName = CFStringCreateWithCharacters(NULL, (UniChar*) c, (actualLength-1) >> 1); } else { err = ATSUFindFontName(fontId , kFontFamilyName, kFontNoPlatformCode, kFontNoScriptCode, kFontNoLanguageCode , 0 , NULL , &actualLength , NULL ); if ( err == noErr ) { actualLength += 1 ; c = (char*)malloc(actualLength); err = ATSUFindFontName(fontId, kFontFamilyName, kFontNoPlatformCode, kFontNoScriptCode, kFontNoLanguageCode, actualLength, c , NULL, NULL); c[actualLength-1] = 0; cfName = CFStringCreateWithCString(NULL, c, kCFStringEncodingMacRoman ); } } if ( c!=NULL ) free(c);#endif if ( cfName!=NULL ) { fontdata.m_chosenFont.SetFaceName(wxCFStringRef(cfName).AsString(wxLocale::GetSystemEncoding())); fontdata.m_chosenFont.SetPointSize(fontSize); fontdata.m_chosenFont.SetStyle(fontStyle & italic ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL); fontdata.m_chosenFont.SetUnderlined((fontStyle & underline)!=0); fontdata.m_chosenFont.SetWeight(fontStyle & bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL); } }
开发者ID:NullNoname,项目名称:dolphin,代码行数:86,
示例27: verify_noerrvoid wxMacSearchFieldControl::SetDescriptiveText(const wxString& text){ verify_noerr( HISearchFieldSetDescriptiveText( m_controlRef, wxCFStringRef( text, wxFont::GetDefaultEncoding() )));}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:6,
示例28: UTTypeCreatePreferredIdentifierForTag// Look up a file type by mime type// The mime type is mapped to a UTI// If the requested extension is not know the OS is querried and the results savedwxFileType *wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType){ wxString uti; const TagMap::const_iterator mimeItr = m_mimeMap.find( mimeType ); if( mimeItr == m_mimeMap.end() ) { wxCFStringRef utiRef = UTTypeCreatePreferredIdentifierForTag( kUTTagClassFilenameExtension, wxCFStringRef( mimeType ), NULL ); m_mimeMap[ mimeType ] = uti = utiRef.AsString(); } else uti = mimeItr->second; return GetFileTypeFromUti( uti );}
开发者ID:chromylei,项目名称:third_party,代码行数:19,
注:本文中的wxCFStringRef函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wxCHECK函数代码示例 C++ wxBrush函数代码示例 |