本文整理汇总了C++中Gestalt函数的典型用法代码示例。如果您正苦于以下问题:C++ Gestalt函数的具体用法?C++ Gestalt怎么用?C++ Gestalt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Gestalt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:17,代码来源:utilsexc_base.cpp
示例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;
}
开发者ID:alx741,项目名称:vexedit,代码行数:32,代码来源:Menus.c
示例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
}
开发者ID:1and1get2,项目名称:openh264,代码行数:28,代码来源:WelsThreadLib.cpp
示例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 ) ;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:28,代码来源:listbox.cpp
示例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{
开发者ID:dvdplm,项目名称:ruby-qtvr,代码行数:7,代码来源:qtvr.c
示例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];
}
开发者ID:mital,项目名称:titanium_desktop,代码行数:16,代码来源:platform_binding.cpp
示例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;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:59,代码来源:display.cpp
示例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
}
开发者ID:spippolatore,项目名称:abuse,代码行数:59,代码来源:RequestVideo.c
示例9: Gestalt
QRUNINFO_NAMEPASE_BEGIN
quint64 RunInfo::installedMemory()
{
SInt32 mb = 0;
Gestalt(gestaltPhysicalRAMSizeInMegabytes, &mb);
return quint64(static_cast<quint64>(mb) * 1024LL * 1024LL);
}
开发者ID:Augus-Wang,项目名称:QRunInfo,代码行数:8,代码来源:kdsysinfo_mac.cpp
示例10: SystemVersionRequired
//-----------------------------------------------
static Boolean SystemVersionRequired(int version)
{
SInt32 result;
Gestalt( gestaltSystemVersion, &result );
gOnPanther = (result >= 0x1030);
gOnTiger = (result >= 0x1040);
return (result >= version);
}
开发者ID:fruitsamples,项目名称:CarbonSketch,代码行数:9,代码来源:main.c
示例11: IsQuickTimeInstalled
Boolean IsQuickTimeInstalled(void)
{
OSErr err;
long lResult;
err = Gestalt(gestaltQuickTime, &lResult);
return (err == noErr);
}
开发者ID:fruitsamples,项目名称:ImproveYourImage,代码行数:8,代码来源:MacShell.c
示例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 );
}
开发者ID:cooljeanius,项目名称:apple-gdb-1824,代码行数:58,代码来源:Search.c
示例13: GetQuickTimeVersion
Word BURGERCALL GetQuickTimeVersion(void)
{
long gestaltAnswer;
if (!Gestalt(gestaltQuickTimeVersion,&gestaltAnswer)) {
return (gestaltAnswer >> 16)&0xFFFF; /* Major version */
}
return 0; /* No quicktime */
}
开发者ID:joeriedel,项目名称:Abducted,代码行数:9,代码来源:ClMacCode.c
示例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;
}
开发者ID:dirkbr,项目名称:darktable,代码行数:9,代码来源:Common.cpp
示例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;
}
开发者ID:colonelqubit,项目名称:halyard,代码行数:9,代码来源:qtcheck.c
示例16: Sys_LoadOpenAL
/*
===============
Sys_LoadOpenAL
===============
*/
bool Sys_LoadOpenAL( void ) {
OSErr err;
long gestaltOSVersion;
err = Gestalt( gestaltSystemVersion, &gestaltOSVersion );
if( err || gestaltOSVersion < 0x1040 ) {
return false;
}
return true;
}
开发者ID:revelator,项目名称:Revelation,代码行数:14,代码来源:macosx_sound.cpp
示例17: UMAGetSystemVersion
long UMAGetSystemVersion()
{
static SInt32 sUMASystemVersion = 0 ;
if ( sUMASystemVersion == 0 )
{
verify_noerr(Gestalt(gestaltSystemVersion, &sUMASystemVersion));
}
return sUMASystemVersion ;
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:9,代码来源:utilsexc_base.cpp
示例18: getnearestdisplay
void MCScreenDC::boundrect(MCRectangle &rect, Boolean title, Window_mode mode)
{
MCRectangle srect;
if (mode >= WM_MODAL)
{
const MCDisplay *t_display;
t_display = getnearestdisplay(rect);
srect = t_display -> workarea;
}
else
srect = MCwbr;
uint2 sr, sw, sb, sh;
Rect screenRect;
SetRect(&screenRect, srect . x, srect . y, srect . x + srect . width, srect . y + srect . height);
if (title && mode <= WM_SHEET && mode != WM_DRAWER)
{
if (mode == WM_PALETTE)
screenRect.top += 13;
else
{
long osversion;
Gestalt(gestaltSystemVersion, &osversion);
if (osversion >= 0x00000800)
screenRect.top += 22;
else
screenRect.top += 19;
}
sr = sb = 10;
sw = 20;
sh = 12;
}
else
sr = sw = sb = sh = 0;
if (rect.x < screenRect.left)
rect.x = screenRect.left;
if (rect.x + rect.width > screenRect.right - sr)
{
if (rect.width > screenRect.right - screenRect.left - sw)
rect.width = screenRect.right - screenRect.left - sw;
rect.x = screenRect.right - rect.width - sr;
}
if (rect.y < screenRect.top)
rect.y = screenRect.top;
if (rect.y + rect.height > screenRect.bottom - sb)
{
if (rect.height > screenRect.bottom - screenRect.top - sh)
rect.height = screenRect.bottom - screenRect.top - sh;
rect.y = screenRect.bottom - rect.height - sb;
}
}
开发者ID:Bjoernke,项目名称:livecode,代码行数:56,代码来源:osxdce.cpp
示例19: checkMacOSVersion
//----------------------------------------------------------------------------------------
//checkMacOSVersion
// -figure out if we're running OS-X or not
//----------------------------------------------------------------------------------------
void checkMacOSVersion()
{
UInt32 response;
if(Gestalt(gestaltSystemVersion, (SInt32 *) &response) == noErr){
if (response >= 0x1000)
gRunningOSX = true;
else
gRunningOSX = false;
}
}
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:14,代码来源:OPUtils.cpp
示例20: _checkOSXVersion
static Boolean _checkOSXVersion(void) {
long OSXVersion = 0L;
OSStatus err = Gestalt(gestaltSystemVersion, &OSXVersion);
if (err != noErr) {
NSLog(CFSTR("WARNING in GrowlInstallationPrompt: could not get Mac OS X version (selector = %x); got error code %li (will show the installation prompt anyway)"), (unsigned)gestaltSystemVersion, (long)err);
//we proceed anyway, on the theory that it is better to show the installation prompt when inappropriate than to suppress it when not.
OSXVersion = minimumOSXVersionForGrowl;
}
return (OSXVersion >= minimumOSXVersionForGrowl);
}
开发者ID:elelay,项目名称:Notifications2Growl,代码行数:10,代码来源:GrowlInstallationPrompt-Carbon.c
注:本文中的Gestalt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论