Ejemplo n.º 1
0
bool
THDApp::OnInit()
{
#ifdef __WXMAC__
    /*
     * On Mac OS, we have one frame per opened document, and the application
     * doesn't exit when the last window is closed.
     */
    SetExitOnFrameDelete(false);

    if (argv[1])
        MacOpenFile(argv[1]);

#else
    /*
     * On other platforms, there is one frame per process.
     */
        
    frame = new THDMainWindow();
    frame->Show();
    SetTopWindow(frame);

    if (argv[1])
        frame->Open(argv[1]);
#endif

    return true;
}
Ejemplo n.º 2
0
short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply))
{
    AEDescList docList;
    AEKeyword keywd;
    DescType returnedType;
    Size actualSize;
    long itemsInList;
    OSErr err;
    short i;
    err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
    if (err != noErr)
        return err;

    err = AECountItems(&docList, &itemsInList);
    if (err != noErr)
        return err;

    ProcessSerialNumber PSN ;
    PSN.highLongOfPSN = 0 ;
    PSN.lowLongOfPSN = kCurrentProcess ;
    SetFrontProcess( &PSN ) ;

    for (i = 1; i <= itemsInList; i++) 
    {
        wxString fName ;

        FSRef theRef ;
        AEGetNthPtr(&docList, i, typeFSRef, &keywd, &returnedType,
        (Ptr) & theRef, sizeof(theRef), &actualSize);
        fName = wxMacFSRefToPath( &theRef ) ;

        MacOpenFile(fName);
    }
    return noErr;
}
Ejemplo n.º 3
0
void wxApp::MacOpenFiles(const wxArrayString & fileNames )
{
    size_t i;
    const size_t fileCount = fileNames.GetCount();
    for (i = 0; i < fileCount; i++)
    {
        MacOpenFile(fileNames[i]);
    }
}