本文整理汇总了C++中Gestalt函数的典型用法代码示例。如果您正苦于以下问题:C++ Gestalt函数的具体用法?C++ Gestalt怎么用?C++ Gestalt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Gestalt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxGetOsVersion
// our OS version is the same in non GUI and GUI cases
wxOperatingSystemId wxGetOsVersion(int *majorVsn, int *minorVsn)
{
// This returns 10 and 6 for OS X 10.6, consistent with behaviour on
// other platforms.
SInt32 maj, min;
Gestalt(gestaltSystemVersionMajor, &maj);
Gestalt(gestaltSystemVersionMinor, &min);
if ( majorVsn != NULL )
*majorVsn = maj;
if ( minorVsn != NULL )
*minorVsn = min;
return wxOS_MAC_OSX_DARWIN;
}
示例2: InitMenubar
/*** INITALISE MENUBAR ***/
OSStatus InitMenubar( void )
{
// set menu bar
Handle menuBar;
#if TARGET_API_MAC_CARBON
long result;
if ((Gestalt(gestaltMenuMgrAttr, &result) == noErr) && (result & gestaltMenuMgrAquaLayoutMask))
menuBar = GetNewMBar( kMenuXBaseID);
else
#endif
menuBar = GetNewMBar( kMenuBaseID );
SetMenuBar( menuBar );
// get menu references
appleMenu = GetMenuRef( kAppleMenu );
fileMenu = GetMenuRef( kFileMenu );
editMenu = GetMenuRef( kEditMenu );
findMenu = GetMenuRef( kFindMenu );
optionsMenu = GetMenuRef( kOptionsMenu );
colorMenu = GetMenuRef( kColorMenu );
windowMenu = GetMenuRef( kWindowMenu );
#if !TARGET_API_MAC_CARBON
AppendResMenu( appleMenu, 'DRVR' );
#endif
AppendResMenu( colorMenu, 'HEct' ); // LR: add color scheme menu
DrawMenuBar();
return noErr;
}
示例3: WelsQueryLogicalProcessInfo
WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* pInfo) {
#ifdef LINUX
#define CMD_RES_SIZE 2048
str_t pBuf[CMD_RES_SIZE];
SystemCall ("cat /proc/cpuinfo | grep \"processor\" | wc -l", pBuf, CMD_RES_SIZE);
pInfo->ProcessorCount = atoi (pBuf);
if (pInfo->ProcessorCount == 0) {
pInfo->ProcessorCount = 1;
}
return WELS_THREAD_ERROR_OK;
#undef CMD_RES_SIZE
#else
SInt32 cpunumber;
Gestalt (gestaltCountOfCPUs, &cpunumber);
pInfo->ProcessorCount = cpunumber;
return WELS_THREAD_ERROR_OK;
#endif//LINUX
}
示例4: ListBoxDrawProc
static pascal void ListBoxDrawProc( ControlRef browser , DataBrowserItemID item , DataBrowserPropertyID property ,
DataBrowserItemState itemState , const Rect *itemRect , SInt16 depth , Boolean isColorDevice )
{
CFStringRef cfString;
long systemVersion;
cfString = CFStringCreateWithFormat( NULL, NULL, CFSTR("Row %d"), item );
ThemeDrawingState themeState ;
GetThemeDrawingState( &themeState ) ;
if ( itemState == kDataBrowserItemIsSelected ) // In this sample we handle the "selected" state, all others fall through to our "active" state
{
Gestalt( gestaltSystemVersion, &systemVersion );
if ( (systemVersion >= 0x00001030) && (IsControlActive( browser ) == false) ) // Panther DB starts using kThemeBrushSecondaryHighlightColor for inactive browser hilighting
SetThemePen( kThemeBrushSecondaryHighlightColor, 32, true );
else
SetThemePen( kThemeBrushPrimaryHighlightColor, 32, true );
PaintRect( itemRect ); // First paint the hilite rect, then the text on top
SetThemeDrawingState( themeState , false ) ;
}
DrawThemeTextBox( cfString, kThemeApplicationFont, kThemeStateActive, true, itemRect, teFlushDefault, NULL );
if ( cfString != NULL )
CFRelease( cfString );
SetThemeDrawingState( themeState , true ) ;
}
示例5: rb_GetQTVersion
static VALUE rb_GetQTVersion(VALUE self){
long version = 0L;
if(Gestalt(gestaltQuickTime, &version) == noErr){
char version_str[8];
sprintf(version_str, "%x", ((version >> 16) & 0xFFFF));
return INT2FIX(atoi(version_str));
}else{
示例6: StaticBoundObject
PlatformBinding::PlatformBinding(KObjectRef global) :
StaticBoundObject("Platform"),
global(global)
{
std::string os_name = Poco::Environment::osName();
#ifdef OS_OSX
NSString *str;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4
SInt32 major, minor, bugfix;
OSErr err1 = Gestalt(gestaltSystemVersionMajor, &major);
OSErr err2 = Gestalt(gestaltSystemVersionMinor, &minor);
OSErr err3 = Gestalt(gestaltSystemVersionBugFix, &bugfix);
if (!err1 && !err2 && !err3)
{
str = [NSString stringWithFormat:@"%d.%d.%d", major, minor, bugfix];
}
示例7: Gestalt
wxVideoMode wxDisplay::GetCurrentMode() const
{
unsigned long dwDMVer;
wxVideoMode RetMode;
Gestalt(gestaltDisplayMgrVers, (long*) &dwDMVer);
//Check DM version (for backward compatibility only - 7.5.3+ use 2.0)
if (dwDMVer >= 0x020000) //version 2?
{
VDSwitchInfoRec sMode; //Note - csMode member also contains the bit depth
if (DMGetDisplayMode(m_priv->m_hndl, &sMode) == noErr)
{
DMListIndexType nNumModes;
DMListType pModes;
DMDisplayModeListIteratorUPP uppMLI;
DisplayIDType nDisplayID;
wxASSERT(DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false) == noErr);
//Create a new list...
wxASSERT_MSG(DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes) == noErr,
wxT("Could not create a new display mode list") );
uppMLI = NewDMDisplayModeListIteratorUPP(DMModeTransProc);
wxASSERT(uppMLI);
DMModeTransRec sModeInfo;
sModeInfo.bMatched = false;
sModeInfo.psMode = &sMode;
for (DMListIndexType i = 0; i < nNumModes; ++i)
{
wxASSERT(DMGetIndexedDisplayModeFromList(pModes, i, NULL,
uppMLI, &sModeInfo) == noErr);
if ( sModeInfo.bMatched == true )
{
RetMode = sModeInfo.Mode;
break;
}
}
DisposeDMDisplayModeListIteratorUPP(uppMLI);
wxASSERT(DMDisposeList(pModes) == noErr);
}
else //Can't get current mode?
{
wxLogSysError(wxString::Format(wxT("Couldn't obtain current display mode!!!\ndwDMVer:%u"),
(unsigned int) dwDMVer));
}
}
else //DM ver 1
{
wxLogSysError(wxString::Format(wxT("Display Manager Version %u Not Supported! Present? %s"),
(unsigned int) dwDMVer / 0x10000,
(dwDMVer & (1 << gestaltDisplayMgrPresent) ? wxT("Yes") : wxT("No")) )
);
}
return RetMode;
}
示例8: RVRequestVideoSetting
OSErr RVRequestVideoSetting (VideoRequestRecPtr requestRecPtr)
{
Boolean displayMgrPresent;
short iCount = 0; // just a counter of GDevices we have seen
DMDisplayModeListIteratorUPP myModeIteratorProc = nil; // for DM2.0 searches
SpBlock spBlock;
Boolean suppliedGDevice;
DisplayIDType theDisplayID; // for DM2.0 searches
DMListIndexType theDisplayModeCount; // for DM2.0 searches
DMListType theDisplayModeList; // for DM2.0 searches
long value = 0;
GDHandle walkDevice = nil; // for everybody
Gestalt(gestaltDisplayMgrAttr,&value);
displayMgrPresent=value&(1<<gestaltDisplayMgrPresent);
displayMgrPresent=displayMgrPresent && (SVersion(&spBlock)==noErr); // need slot manager
if (displayMgrPresent)
{
// init the needed data before we start
if (requestRecPtr->screenDevice) // user wants a specifc device?
{
walkDevice = requestRecPtr->screenDevice;
suppliedGDevice = true;
}
else
{
walkDevice = DMGetFirstScreenDevice (dmOnlyActiveDisplays); // for everybody
suppliedGDevice = false;
}
myModeIteratorProc = NewDMDisplayModeListIteratorProc(ModeListIterator); // for DM2.0 searches
// Note that we are hosed if somebody changes the gdevice list behind our backs while we are iterating....
// ...now do the loop if we can start
if( walkDevice && myModeIteratorProc) do // start the search
{
iCount++; // GDevice we are looking at (just a counter)
if( noErr == DMGetDisplayIDByGDevice( walkDevice, &theDisplayID, false ) ) // DM1.0 does not need this, but it fits in the loop
{
theDisplayModeCount = 0; // for DM2.0 searches
if (noErr == DMNewDisplayModeList(theDisplayID, 0, 0, &theDisplayModeCount, &theDisplayModeList) )
{
// search NuBus & PCI the new kool way through Display Manager 2.0
GetRequestTheDM2Way (requestRecPtr, walkDevice, myModeIteratorProc, theDisplayModeCount, &theDisplayModeList);
DMDisposeList(theDisplayModeList); // now toss the lists for this gdevice and go on to the next one
}
else
{
// search NuBus only the old disgusting way through the slot manager
GetRequestTheDM1Way (requestRecPtr, walkDevice);
}
}
} while ( !suppliedGDevice && nil != (walkDevice = DMGetNextScreenDevice ( walkDevice, dmOnlyActiveDisplays )) ); // go until no more gdevices
if( myModeIteratorProc )
DisposeRoutineDescriptor(myModeIteratorProc);
return (noErr); // we were able to get the look for a match
}
return (-1); // return a generic error
}
示例9: Gestalt
QRUNINFO_NAMEPASE_BEGIN
quint64 RunInfo::installedMemory()
{
SInt32 mb = 0;
Gestalt(gestaltPhysicalRAMSizeInMegabytes, &mb);
return quint64(static_cast<quint64>(mb) * 1024LL * 1024LL);
}
示例10: SystemVersionRequired
//-----------------------------------------------
static Boolean SystemVersionRequired(int version)
{
SInt32 result;
Gestalt( gestaltSystemVersion, &result );
gOnPanther = (result >= 0x1030);
gOnTiger = (result >= 0x1040);
return (result >= version);
}
示例11: IsQuickTimeInstalled
Boolean IsQuickTimeInstalled(void)
{
OSErr err;
long lResult;
err = Gestalt(gestaltQuickTime, &lResult);
return (err == noErr);
}
示例12: PBCatSearchSyncCompat
pascal OSErr PBCatSearchSyncCompat(CSParamPtr paramBlock)
{
static Boolean fullExtFSDispatchingtested = false;
static Boolean hasFullExtFSDispatching = false;
OSErr result;
Boolean supportsCatSearch;
long response;
GetVolParmsInfoBuffer volParmsInfo;
long infoSize;
result = noErr;
/* See if File Manager will pass CatSearch requests to external file systems */
/* we will store the results in a static variable so we do NOT have to call Gestalt */
/* everytime we are called. */
if ( !fullExtFSDispatchingtested )
{
fullExtFSDispatchingtested = true;
if ( Gestalt(gestaltFSAttr, &response) == noErr )
{
hasFullExtFSDispatching = ((response & (1L << gestaltFullExtFSDispatching)) != 0);
}
}
/* CatSearch is a per volume attribute, so we have to check each time we are */
/* called to see if it is available on the volume specified. */
supportsCatSearch = false;
if ( hasFullExtFSDispatching )
{
infoSize = sizeof(GetVolParmsInfoBuffer);
result = HGetVolParms(paramBlock->ioNamePtr, paramBlock->ioVRefNum,
&volParmsInfo, &infoSize);
if ( result == noErr )
{
supportsCatSearch = hasCatSearch(volParmsInfo);
}
}
/* noErr or paramErr is OK here. */
/* paramErr just means that GetVolParms is NOT supported by this volume */
if ( (result == noErr) || (result == paramErr) )
{
if ( supportsCatSearch )
{
/* Volume supports CatSearch so use it. */
/* CatSearch is faster than an indexed search. */
result = PBCatSearchSync(paramBlock);
}
else
{
/* Volume does NOT support CatSearch so */
/* search using IndexedSearch from root directory. */
result = IndexedSearch(paramBlock, fsRtDirID);
}
}
return ( result );
}
示例13: GetQuickTimeVersion
Word BURGERCALL GetQuickTimeVersion(void)
{
long gestaltAnswer;
if (!Gestalt(gestaltQuickTimeVersion,&gestaltAnswer)) {
return (gestaltAnswer >> 16)&0xFFFF; /* Major version */
}
return 0; /* No quicktime */
}
示例14: macosx_version
int macosx_version()
{
SInt32 gestalt_version;
static int ver = 0; // cached
if (0 == ver && (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr)) {
ver = gestalt_version;
}
return ver;
}
示例15: QuickTimeVersion
int __stdcall QuickTimeVersion() {
long version;
OSErr result;
// Call the Gestalt manager and ask for QuickTime. If we're lucky,
// this should work even in the absence of the QuickTime DLL.
result = Gestalt(gestaltQuickTime, &version);
return (result == noErr) ? version : 0;
}