Sha256: f2560e07643fe574c16e95560b5cb9a7eb8a1831476bca70a843f4b4eb795efa

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

// -*- objc -*-
#include "reflex/application.h"


#import <Cocoa/Cocoa.h>
#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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reflexion-0.1.2 src/cocoa/application.mm
reflexion-0.1.1 src/cocoa/application.mm