// -*- objc -*- #include "reflex/application.h" #import #include "applicationdata.h" #import "cocoaapplication.h" namespace Reflex { Application::Application () { self->this_ = this; self->self_ = NSApp ? [NSApp retain] : nil; if (self->self_) [self->self_ setApplicationData: self]; } Application::~Application () { if (self->self_) { [self->self_ release]; self->self_ = nil; } self->this_ = NULL; } bool Application::run () { if (!*this) return false; [self->self_ run]; return true; } bool Application::quit () { if (!*this) return false; [self->self_ terminate: nil]; return true; } bool Application::preference () { return *this; } bool Application::about () { if (!*this) return false; [self->self_ orderFrontStandardAboutPanel: nil]; return true; } bool Application::get_name (String* name) const { if (!*this || !name) return false; *name = self->name; return true; } bool Application::set_name (const char* name) { if (!*this || !name) return false; self->name = name; return true; } Application::operator bool () const { return self && *self; } bool Application::operator ! () const { return !operator bool(); } }// Reflex