⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uma.cpp

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 CPP
📖 第 1 页 / 共 2 页
字号:
{    return QDGlobalsPtr (* (Ptr*) LMGetCurrentA5 ( ) - 0xCA);}#endifvoid UMAShowWatchCursor(){    SetThemeCursor(kThemeWatchCursor);}void UMAShowArrowCursor(){    SetThemeCursor(kThemeArrowCursor);}// window managerGrafPtr UMAGetWindowPort( WindowRef inWindowRef ){    wxASSERT( inWindowRef != NULL ) ;#if TARGET_CARBON    return (GrafPtr) GetWindowPort( inWindowRef ) ;#else    return (GrafPtr) inWindowRef ;#endif}void UMADisposeWindow( WindowRef inWindowRef ){    wxASSERT( inWindowRef != NULL ) ;    DisposeWindow( inWindowRef ) ;}void UMASetWTitle( WindowRef inWindowRef , const wxString& title , wxFontEncoding encoding ){#if TARGET_CARBON    SetWindowTitleWithCFString( inWindowRef , wxMacCFStringHolder(title , encoding) ) ;#else    Str255 ptitle ;    wxMacStringToPascal( title , ptitle ) ;    SetWTitle( inWindowRef , ptitle ) ;#endif}// appearance additionsvoid UMASetControlTitle( ControlRef inControl , const wxString& title , wxFontEncoding encoding ){#if TARGET_CARBON    SetControlTitleWithCFString( inControl , wxMacCFStringHolder(title , encoding) ) ;#else    Str255 ptitle ;    wxMacStringToPascal( title , ptitle ) ;    SetControlTitle( inControl , ptitle ) ;#endif}void UMAActivateControl( ControlRef inControl ){#if TARGET_API_MAC_OSX    ::ActivateControl( inControl ) ;#else    // we have to add the control after again to the update rgn    // otherwise updates get lost    if ( !IsControlActive( inControl ) )    {        bool visible = IsControlVisible( inControl ) ;        if ( visible )            SetControlVisibility( inControl , false , false ) ;        ::ActivateControl( inControl ) ;        if ( visible )        {            SetControlVisibility( inControl , true , false ) ;            Rect ctrlBounds ;            InvalWindowRect( GetControlOwner(inControl), UMAGetControlBoundsInWindowCoords(inControl, &ctrlBounds) ) ;        }    }#endif}void UMAMoveControl( ControlRef inControl , short x , short y ){#if TARGET_API_MAC_OSX    ::MoveControl( inControl , x , y ) ;#else    bool visible = IsControlVisible( inControl ) ;    if ( visible )    {        SetControlVisibility( inControl , false , false ) ;        Rect ctrlBounds ;        InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ;    }    ::MoveControl( inControl , x , y ) ;    if ( visible )    {        SetControlVisibility( inControl , true , false ) ;        Rect ctrlBounds ;        InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ;    }#endif}void UMASizeControl( ControlRef inControl , short x , short y ){#if TARGET_API_MAC_OSX    ::SizeControl( inControl , x , y ) ;#else    bool visible = IsControlVisible( inControl ) ;    if ( visible )    {        SetControlVisibility( inControl , false , false ) ;        Rect ctrlBounds ;        InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ;    }    ::SizeControl( inControl , x , y ) ;    if ( visible )    {        SetControlVisibility( inControl , true , false ) ;        Rect ctrlBounds ;        InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ;    }#endif}void UMADeactivateControl( ControlRef inControl ){#if TARGET_API_MAC_OSX    ::DeactivateControl( inControl ) ;#else    // we have to add the control after again to the update rgn    // otherwise updates get lost    bool visible = IsControlVisible( inControl ) ;    if ( visible )        SetControlVisibility( inControl , false , false ) ;    ::DeactivateControl( inControl ) ;    if ( visible )    {        SetControlVisibility( inControl , true , false ) ;        Rect ctrlBounds ;        InvalWindowRect( GetControlOwner(inControl), UMAGetControlBoundsInWindowCoords(inControl, &ctrlBounds) ) ;    }#endif}// shows the control and adds the region to the update regionvoid UMAShowControl( ControlRef inControl ){    SetControlVisibility( inControl , true , false ) ;    HIViewSetNeedsDisplay( inControl, true );}// hides the control and adds the region to the update regionvoid UMAHideControl( ControlRef inControl ){    SetControlVisibility( inControl , false , false ) ;    HIViewSetNeedsDisplay( inControl, true );}// keyboard focusOSErr UMASetKeyboardFocus( WindowPtr inWindow,                                 ControlRef inControl,                                 ControlFocusPart inPart ){    OSErr err = noErr;#ifndef __LP64__    GrafPtr port ;    GetPort( &port ) ;    SetPortWindowPort( inWindow ) ;#endif    err = SetKeyboardFocus( inWindow , inControl , inPart ) ;#ifndef __LP64__    SetPort( port ) ;#endif    return err ;}bool UMAIsWindowFloating( WindowRef inWindow ){    WindowClass cl ;    GetWindowClass( inWindow , &cl ) ;    return cl == kFloatingWindowClass ;}bool UMAIsWindowModal( WindowRef inWindow ){    WindowClass cl ;    GetWindowClass( inWindow , &cl ) ;    return cl < kFloatingWindowClass ;}// othersvoid UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ){    if ( inWindowRef )    {//        bool isHighlighted = IsWindowHighlited( inWindowRef ) ;//        if ( inActivate != isHighlighted )#ifndef __LP64__        GrafPtr port ;        GetPort( &port ) ;        SetPortWindowPort( inWindowRef ) ;#endif        HiliteWindow( inWindowRef , inActivate ) ;        ControlRef control = NULL ;        ::GetRootControl( inWindowRef , &control ) ;        if ( control )        {            if ( inActivate )                UMAActivateControl( control ) ;            else                UMADeactivateControl( control ) ;        }#ifndef __LP64__        SetPort( port ) ;#endif    }}OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ){#ifndef __LP64__    return ::DrawThemePlacard( inRect , inState ) ;#else    return noErr;#endif}#if !TARGET_CARBONstatic OSStatus helpMenuStatus = noErr ;static MenuItemIndex firstCustomItemIndex = 0 ;#endifOSStatus UMAGetHelpMenu(    MenuRef *        outHelpMenu,    MenuItemIndex *  outFirstCustomItemIndex){#if TARGET_CARBON    return HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ;#else    MenuRef helpMenuHandle ;    helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ;    if ( firstCustomItemIndex == 0 && helpMenuStatus == noErr )        firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ;    if ( outFirstCustomItemIndex )        *outFirstCustomItemIndex = firstCustomItemIndex ;    *outHelpMenu = helpMenuHandle ;    return helpMenuStatus ;#endif}#ifndef __LP64__wxMacPortStateHelper::wxMacPortStateHelper( GrafPtr newport ){    m_clip = NULL ;    Setup( newport ) ;}wxMacPortStateHelper::wxMacPortStateHelper(){    m_clip = NULL ;}void wxMacPortStateHelper::Setup( GrafPtr newport ){    GetPort( &m_oldPort ) ;    SetPort( newport ) ;    SetOrigin(0, 0);    wxASSERT_MSG( m_clip == NULL , wxT("Cannot call setup twice") ) ;    m_clip = NewRgn() ;    GetClip( m_clip );    m_textFont = GetPortTextFont( (CGrafPtr) newport );    m_textSize = GetPortTextSize( (CGrafPtr) newport );    m_textStyle = GetPortTextFace( (CGrafPtr) newport );    m_textMode = GetPortTextMode( (CGrafPtr) newport );    GetThemeDrawingState( &m_drawingState ) ;    m_currentPort = newport ;}void wxMacPortStateHelper::Clear(){    if ( m_clip )    {        DisposeRgn( m_clip ) ;        DisposeThemeDrawingState( m_drawingState ) ;        m_clip = NULL ;    }}wxMacPortStateHelper::~wxMacPortStateHelper(){    if ( m_clip )    {        SetPort( m_currentPort ) ;        SetClip( m_clip ) ;        DisposeRgn( m_clip ) ;        TextFont( m_textFont );        TextSize( m_textSize );        TextFace( m_textStyle );        TextMode( m_textMode );        SetThemeDrawingState( m_drawingState , true ) ;        SetPort( m_oldPort ) ;    }}#endifOSStatus UMAPutScrap( Size size , OSType type , void *data ){    OSStatus err = noErr ;#if !TARGET_CARBON    err = PutScrap( size , type , data ) ;#else    ScrapRef    scrap;    err = GetCurrentScrap( &scrap );    if ( err == noErr )        err = PutScrapFlavor( scrap, type , 0, size, data );#endif    return err ;}Rect * UMAGetControlBoundsInWindowCoords( ControlRef theControl, Rect *bounds ){    GetControlBounds( theControl , bounds ) ;#if TARGET_API_MAC_OSX    WindowRef tlwref = GetControlOwner( theControl ) ;    wxTopLevelWindowMac* tlwwx = wxFindWinFromMacWindow( tlwref ) ;    if ( tlwwx != NULL )    {        ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ;        HIPoint hiPoint = CGPointMake( 0 , 0 ) ;        HIViewConvertPoint( &hiPoint , HIViewGetSuperview(theControl) , rootControl ) ;        OffsetRect( bounds , (short) hiPoint.x , (short) hiPoint.y ) ;    }#endif    return bounds ;}#endif  // wxUSE_GUI#if wxUSE_BASEstatic bool sUMASystemInitialized = false ;bool UMASystemIsInitialized(){    return sUMASystemInitialized ;}void UMASetSystemIsInitialized(bool val){    sUMASystemInitialized = val;}#endif // wxUSE_BASE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -