Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | Private Attributes
nsNativeAppSupportMac Class Reference
Inheritance diagram for nsNativeAppSupportMac:
Inheritance graph
[legend]
Collaboration diagram for nsNativeAppSupportMac:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { eSplashPictureItem = 1, eSplashStatusTextItem }

Public Member Functions

 nsNativeAppSupportMac ()
NS_IMETHOD Start (PRBool *aRetVal)
NS_IMETHOD ReOpen ()
NS_IMETHOD Enable ()
 nsNativeAppSupportMac ()
virtual ~nsNativeAppSupportMac ()
void observe (in nsISupports aSubject, in string aTopic, in wstring aData)
 Observe will be called when there is a notification for the topic |aTopic|.
NS_DECL_NSINATIVEAPPSUPPORT
NS_IMETHOD 
CreateSplashScreen (nsISplashScreen **splash)
 NS_IMETHOD_ (nsrefcnt) AddRef()
 NS_IMETHOD_ (nsrefcnt) Release()
NS_IMETHOD QueryInterface (const nsIID &iid, void **p)
boolean start ()
boolean start ()
void enable ()
boolean stop ()
boolean stop ()
void quit ()
void quit ()
void onLastWindowClosing ()
void onLastWindowClosing ()
void ensureProfile (in nsICmdLineService aCmdService)
void showSplashScreen ()
void hideSplashScreen ()
void startServerMode ()

Public Attributes

nsrefcnt mRefCnt
nsCOMPtr< nsISplashScreenmSplash
PRBool mServerMode
PRBool mShouldShowUI
PRBool mShownTurboDialog
attribute boolean isServerMode
attribute boolean shouldShowUI

Static Public Attributes

static PRBool mLastWindowIsConfirmation = PR_FALSE

Protected Attributes

DialogPtr mDialog

Private Attributes

PRBool mCanShowUI

Detailed Description

Definition at line 86 of file nsNativeAppSupportMac.cpp.


Member Enumeration Documentation

anonymous enum
Enumerator:
eSplashPictureItem 
eSplashStatusTextItem 

Definition at line 94 of file nsNativeAppSupportMac.cpp.


Constructor & Destructor Documentation

Definition at line 89 of file nsNativeAppSupportMac.cpp.

Definition at line 119 of file nsNativeAppSupportMac.cpp.

{
  HideSplashScreen();
}

Member Function Documentation

Definition at line 145 of file nsNativeAppSupportBase.cpp.

                                                                     {
    NS_ENSURE_ARG( splash );
    *splash = 0;
    return NS_CreateSplashScreen( splash );
}

Here is the call graph for this function:

Definition at line 102 of file nsNativeAppSupportMac.cpp.

{
  mCanShowUI = PR_TRUE;
  return NS_OK;
}
void nsIObserver::observe ( in nsISupports  aSubject,
in string  aTopic,
in wstring  aData 
) [inherited]

Observe will be called when there is a notification for the topic |aTopic|.

This assumes that the object implementing this interface has been registered with an observer service such as the nsIObserverService.

If you expect multiple topics/subjects, the impl is responsible for filtering.

You should not modify, add, remove, or enumerate notifications in the implemention of observe.

Parameters:
aSubject: Notification specific interface pointer.
aTopic: The notification topic or subject.
aData: Notification specific wide string. subject event.

Definition at line 169 of file nsNativeAppSupportBase.cpp.

                                                                  {
    nsresult rv = NS_OK;
    if ( p ) {
        *p = 0;
        if ( iid.Equals( NS_GET_IID( nsINativeAppSupport ) ) ) {
            nsINativeAppSupport *result = this;
            *p = result;
            NS_ADDREF( result );
        } else if ( iid.Equals( NS_GET_IID( nsISupports ) ) ) {
            nsISupports *result = NS_STATIC_CAST( nsISupports*, this );
            *p = result;
            NS_ADDREF( result );
        } else {
            rv = NS_NOINTERFACE;
        }
    } else {
        rv = NS_ERROR_NULL_POINTER;
    }
    return rv;
}

Here is the call graph for this function:

Implements nsINativeAppSupport.

Definition at line 183 of file nsNativeAppSupportMac.cpp.

{
  if (!mCanShowUI)
    return NS_ERROR_FAILURE;

  PRBool haveUncollapsed = PR_FALSE;
  PRBool haveOpenWindows = PR_FALSE;
  PRBool done = PR_FALSE;
  
  nsCOMPtr<nsIWindowMediator> 
    wm(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
  if (!wm)
  {
    return NS_ERROR_FAILURE;
  } 
  else
  {
    nsCOMPtr<nsISimpleEnumerator> windowList;
    wm->GetXULWindowEnumerator(nsnull, getter_AddRefs(windowList));
    PRBool more;
    windowList->HasMoreElements(&more);
    while (more)
    {
      nsCOMPtr<nsISupports> nextWindow = nsnull;
      windowList->GetNext(getter_AddRefs(nextWindow));
      nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(nextWindow));
                if (!baseWindow)
                {
        windowList->HasMoreElements(&more);
        continue;
      }
      else
      {
        haveOpenWindows = PR_TRUE;
      }

      nsCOMPtr<nsIWidget> widget = nsnull;
      baseWindow->GetMainWidget(getter_AddRefs(widget));
      if (!widget)
      {
        windowList->HasMoreElements(&more);
        continue;
      }
      WindowRef windowRef = (WindowRef)widget->GetNativeData(NS_NATIVE_DISPLAY);
      if (!::IsWindowCollapsed(windowRef))
      {
        haveUncollapsed = PR_TRUE;
        break;  //have un-minimized windows, nothing to do
      } 
      windowList->HasMoreElements(&more);
    } // end while
        
    if (!haveUncollapsed)
    {
      //uncollapse the most recenty used window
      nsCOMPtr<nsIDOMWindowInternal> mru = nsnull;
      wm->GetMostRecentWindow(nsnull, getter_AddRefs(mru));
            
      if (mru) 
      {        
        WindowRef mruRef = nil;
        GetNativeWindowPointerFromDOMWindow(mru, &mruRef);
        if (mruRef)
        {
          ::CollapseWindow(mruRef, FALSE);
          ::SelectWindow(mruRef);
          done = PR_TRUE;
        }
      }
      
    } // end if have uncollapsed 
    
    if (!haveOpenWindows && !done)
    {
      char* argv[] = { nsnull };
    
      // use an empty command line to make the right kind(s) of window open
      nsCOMPtr<nsICommandLineRunner> cmdLine
        (do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
      NS_ENSURE_TRUE(cmdLine, NS_ERROR_FAILURE);

      nsresult rv;
      rv = cmdLine->Init(0, argv, nsnull,
                         nsICommandLine::STATE_REMOTE_EXPLICIT);
      NS_ENSURE_SUCCESS(rv, rv);

      return cmdLine->Run();
    }
    
  } // got window mediator
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 109 of file nsNativeAppSupportMac.cpp.

{
  Str255 str1;
  Str255 str2;
  SInt16 outItemHit;
  long   response = 0;
  OSErr  err = ::Gestalt (gestaltSystemVersion, &response);
  // check for at least MacOS 8.5
  if ( err || response < 0x850)
  {
    ::StopAlert (5000, NULL);
    *_retval = PR_FALSE;
    return NS_ERROR_FAILURE;
  }
  
#if TARGET_CARBON
  // If we're running under Mac OS X check for at least Mac OS X 10.1
  // If that fails display a StandardAlert giving the user the option
  // to continue running the app or quitting
  if (response >= 0x00001000 && response < 0x00001010)
  {
    // put up error dialog
    Str255 continueButtonLabel;
    Str255 quitButtonLabel;
    ::GetIndString(str1, kNSOSVersErrsStrArrayID, eOSXVersTooOldErrIndex);
    ::GetIndString(str2, kNSOSVersErrsStrArrayID, eOSXVersTooOldExplanationIndex);
    ::GetIndString(continueButtonLabel, kNSOSVersErrsStrArrayID, eContinueButtonTextIndex);
    ::GetIndString(quitButtonLabel, kNSOSVersErrsStrArrayID, eQuitButtonTextIndex);
    if (StrLength(str1) && StrLength(str1) && StrLength(continueButtonLabel) && StrLength(quitButtonLabel))
    {
      AlertStdAlertParamRec pRec;
      
      pRec.movable      = nil;
      pRec.filterProc       = nil;
      pRec.defaultText  = continueButtonLabel;
      pRec.cancelText   = quitButtonLabel;
      pRec.otherText    = nil;
      pRec.helpButton   = nil;
      pRec.defaultButton = kAlertStdAlertOKButton;
      pRec.cancelButton  = kAlertStdAlertCancelButton;
      pRec.position      = 0;
      
      ::StandardAlert(kAlertNoteAlert, str1, str2, &pRec, &outItemHit);
      if (outItemHit == kAlertStdAlertCancelButton)
        return PR_FALSE;
    }
    else
      return PR_FALSE;
  }
  
  // We also check for CarbonLib version >= 1.4 if OS vers < 10.0
  // which is always cause for the app to quit
  if (response < 0x00001000)
  {
    err = ::Gestalt (gestaltCarbonVersion, &response);
    if (err || response < 0x00000140)
    {
      // put up error dialog
      ::GetIndString(str1, kNSOSVersErrsStrArrayID, eCarbonLibVersTooOldIndex);
      ::GetIndString(str2, kNSOSVersErrsStrArrayID, eCarbonLibVersTooOldExplanationIndex);
      if (StrLength(str1) && StrLength(str1))
      {
        ::StandardAlert(kAlertStopAlert, str1, str2, nil, &outItemHit);
      }
      return PR_FALSE;
    }
  }
#endif

  *_retval = PR_TRUE;
  return NS_OK;
}

Member Data Documentation

Definition at line 186 of file nsINativeAppSupport.idl.

Definition at line 97 of file nsNativeAppSupportMac.cpp.

DialogPtr nsNativeAppSupportMac::mDialog [protected]

Definition at line 108 of file nsNativeAppSupportMac.cpp.

Definition at line 73 of file nsNativeAppSupportBase.h.

Definition at line 68 of file nsNativeAppSupportBase.h.

Definition at line 70 of file nsNativeAppSupportBase.h.

Definition at line 71 of file nsNativeAppSupportBase.h.

Definition at line 72 of file nsNativeAppSupportBase.h.

Definition at line 69 of file nsNativeAppSupportBase.h.

Definition at line 187 of file nsINativeAppSupport.idl.


The documentation for this class was generated from the following files: