当前位置: 首页>>代码示例>>C++>>正文


C++ wxCFStringRef函数代码示例

本文整理汇总了C++中wxCFStringRef函数的典型用法代码示例。如果您正苦于以下问题:C++ wxCFStringRef函数的具体用法?C++ wxCFStringRef怎么用?C++ wxCFStringRef使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wxCFStringRef函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UMASetMenuItemText

void 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,代码来源:uma.cpp

示例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,代码来源:wxcms.cpp

示例3: InstallDebugAssertOutputHandler

bool 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,代码来源:app.cpp

示例4: Stop

bool 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,代码来源:sound.cpp

示例5: cfString

void 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,代码来源:filedlg.cpp

示例6: CFArrayGetCount

void 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,代码来源:printmac.cpp

示例7: BundleRelativeURLToPath

static 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,代码来源:stdpaths_cf.cpp

示例8: UMAAppendSubMenuItem

void 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,代码来源:uma.cpp

示例9: PMPrintSettingsSetJobName

bool 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,代码来源:dcprint.cpp

示例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,代码来源:menu.cpp

示例11: UMANewMenu

MenuRef 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,代码来源:uma.cpp

示例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 failure
wxString 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,代码来源:mimetype.cpp

示例13: SHGetSpecialFolderLocation

/// Set File to hash in wxTextCtrl
void
AlcFrame::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,代码来源:alcframe.cpp

示例14: CFRelease

void 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,代码来源:dataobj.cpp

示例15: docTypesKey

// Look up the (locale) display name and icon file associated with a UTI
void 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,代码来源:mimetype.cpp


注:本文中的wxCFStringRef函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。