Drawing Native OSX Windows with D
Mike McKee via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Nov 28 18:30:54 PST 2015
On Saturday, 28 November 2015 at 14:05:37 UTC, Jacob Carlborg
wrote:
> If you can't/don't want to go with the App Store then why not
> the second option?
I'm coding an antivirus application for the Mac, using a
third-party antivirus engine, in Qt/C++. It needs some things to
run under high privileges. As far as I know, you can't do that
with a DMG package, but can do it with a PKG package.
I've learned a tremendous amount about PKG packages (the docs are
difficult), but the one thing that doesn't seem possible is to
download a component from a remote URL with it except via a Perl
or Bash script. The PKG flat format supports a way to call a
preinstall and postinstall Perl or Bash script. The trouble with
that technique, however, is that if you have a 30MB download that
takes awhile, the installer screen sits at "Running Package
Scripts..." for like 3 minutes (on 2Mbps DSL) and this can
confuse the consumer into thinking the installer is hung up, when
it isn't.
The thing I'd like to achieve with D is to have my Bash or Perl
script call a command line D application that finds the current
installer window x,y, hides the Cocoa-based window, draws my new
Cocoa-based window to replace it at the same x,y,w,h as the other
one, and then runs curl command to download the file, then uses
the D application again to stop showing my custom window, unhide
the installer window, and exit the Bash script.
So, some things I need to learn in D:
* How to enumerate the currently visible Cocoa windows and their
titles or internal names, along with their window handle.
* How to get the x,y of an existing Cocoa window by its window
handle.
* How to hide a Cocoa window by its window handle.
* How to draw my own Cocoa window at an x,y coordinate.
* How to destroy my Cocoa window by its window handle.
* How to unhide a previously hidden Cocoa window by its window
handle.
If I could pull this off -- I'd make a really nice OSX installer
because I could have a small pkg file that downloads and runs,
and then its window gets hidden and shows a more-user friendly
window (drawn in D and Cocoa) to let the consumer know it's
downloading a larger file, and then show the conclusion when
done. Currently nothing like that exists on OSX, but does exist
on Windows via the Inno Setup and InstallShield platforms.
More information about the Digitalmars-d-learn
mailing list