mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-01-18 05:08:55 +01:00
Update to v092r05 release.
byuu says: This release should be polished enough for a general release. This release should be polished enough for a general release. Anyone with a real, clean Mac up for posting compiled binaries? Preferably compile with "make profile=balanced" In fact, I'd like it if someone were willing to host a "higan for Mac" page, with binaries of each of the latest releases. Only really needed for major official releases, but it'd be preferable to have the builds updated as soon as possible after I post new builds. Changelog: - no more keyboard chimes when pressing keys - status bar added, fully functional - Label::minimumSize() takes frame into account (but note a few places hard-code raw Font::size(), so a few text labels are still clipped) - resizing the main window looks smooth regardless of whether a game is running or not - currently, resizing the window pauses the emulation. Allowing it to run the main loop was lagging out the window resize process too much to be worth it Additional OS X integration enhancements: - closing the main window unloads the current game, but does not quit the application (quit via the main menu or the dock menu) - clicking the icon in the dock will (re)display the main menu
This commit is contained in:
parent
fdd3ea490e
commit
5b4bbf5045
@ -3,10 +3,18 @@
|
|||||||
|
|
||||||
namespace Emulator {
|
namespace Emulator {
|
||||||
static const char Name[] = "higan";
|
static const char Name[] = "higan";
|
||||||
static const char Version[] = "092.04";
|
static const char Version[] = "092.05";
|
||||||
static const char Author[] = "byuu";
|
static const char Author[] = "byuu";
|
||||||
static const char License[] = "GPLv3";
|
static const char License[] = "GPLv3";
|
||||||
static const char Website[] = "http://byuu.org/";
|
static const char Website[] = "http://byuu.org/";
|
||||||
|
|
||||||
|
#if defined(PROFILE_ACCURACY)
|
||||||
|
static const char Profile[] = "Accuracy";
|
||||||
|
#elif defined(PROFILE_BALANCED)
|
||||||
|
static const char Profile[] = "Balanced";
|
||||||
|
#elif defined(PROFILE_PERFORMANCE)
|
||||||
|
static const char Profile[] = "Performance";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <nall/platform.hpp>
|
#include <nall/platform.hpp>
|
||||||
|
@ -2,7 +2,7 @@ namespace phoenix {
|
|||||||
|
|
||||||
struct pAction : public pObject {
|
struct pAction : public pObject {
|
||||||
Action &action;
|
Action &action;
|
||||||
NSMenuItem *cocoaAction;
|
NSMenuItem *cocoaAction = nullptr;
|
||||||
|
|
||||||
void setEnabled(bool enabled);
|
void setEnabled(bool enabled);
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaCheckItem : NSMenuItem
|
@implementation CocoaCheckItem : NSMenuItem
|
||||||
|
|
||||||
-(id) initWith :(phoenix::CheckItem&)checkItemReference {
|
-(id) initWith:(phoenix::CheckItem&)checkItemReference {
|
||||||
if(self = [super initWithTitle:@"" action:@selector(activate) keyEquivalent:@""]) {
|
if(self = [super initWithTitle:@"" action:@selector(activate) keyEquivalent:@""]) {
|
||||||
checkItem = &checkItemReference;
|
checkItem = &checkItemReference;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::CheckItem *checkItem;
|
phoenix::CheckItem *checkItem;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::CheckItem&)checkItem;
|
-(id) initWith:(phoenix::CheckItem&)checkItem;
|
||||||
-(void) activate;
|
-(void) activate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ namespace phoenix {
|
|||||||
|
|
||||||
struct pCheckItem : public pAction {
|
struct pCheckItem : public pAction {
|
||||||
CheckItem &checkItem;
|
CheckItem &checkItem;
|
||||||
CocoaCheckItem *cocoaCheckItem;
|
CocoaCheckItem *cocoaCheckItem = nullptr;
|
||||||
|
|
||||||
bool checked();
|
bool checked();
|
||||||
void setChecked(bool checked);
|
void setChecked(bool checked);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaItem : NSMenuItem
|
@implementation CocoaItem : NSMenuItem
|
||||||
|
|
||||||
-(id) initWith :(phoenix::Item&)itemReference {
|
-(id) initWith:(phoenix::Item&)itemReference {
|
||||||
if(self = [super initWithTitle:@"" action:@selector(activate) keyEquivalent:@""]) {
|
if(self = [super initWithTitle:@"" action:@selector(activate) keyEquivalent:@""]) {
|
||||||
item = &itemReference;
|
item = &itemReference;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::Item *item;
|
phoenix::Item *item;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::Item&)item;
|
-(id) initWith:(phoenix::Item&)item;
|
||||||
-(void) activate;
|
-(void) activate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ namespace phoenix {
|
|||||||
|
|
||||||
struct pItem : public pAction {
|
struct pItem : public pAction {
|
||||||
Item &item;
|
Item &item;
|
||||||
CocoaItem *cocoaItem;
|
CocoaItem *cocoaItem = nullptr;
|
||||||
|
|
||||||
void setImage(const image &image);
|
void setImage(const image &image);
|
||||||
void setText(const string &text);
|
void setText(const string &text);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaMenu : NSMenuItem
|
@implementation CocoaMenu : NSMenuItem
|
||||||
|
|
||||||
-(id) initWith :(phoenix::Menu&)menuReference {
|
-(id) initWith:(phoenix::Menu&)menuReference {
|
||||||
if(self = [super initWithTitle:@"" action:nil keyEquivalent:@""]) {
|
if(self = [super initWithTitle:@"" action:nil keyEquivalent:@""]) {
|
||||||
menu = &menuReference;
|
menu = &menuReference;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
phoenix::Menu *menu;
|
phoenix::Menu *menu;
|
||||||
NSMenu *cocoaMenu;
|
NSMenu *cocoaMenu;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::Menu&)menu;
|
-(id) initWith:(phoenix::Menu&)menu;
|
||||||
-(NSMenu*) cocoaMenu;
|
-(NSMenu*) cocoaMenu;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ namespace phoenix {
|
|||||||
|
|
||||||
struct pMenu : public pAction {
|
struct pMenu : public pAction {
|
||||||
Menu &menu;
|
Menu &menu;
|
||||||
CocoaMenu *cocoaMenu;
|
CocoaMenu *cocoaMenu = nullptr;
|
||||||
|
|
||||||
void append(Action &action);
|
void append(Action &action);
|
||||||
void remove(Action &action);
|
void remove(Action &action);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaRadioItem : NSMenuItem
|
@implementation CocoaRadioItem : NSMenuItem
|
||||||
|
|
||||||
-(id) initWith :(phoenix::RadioItem&)radioItemReference {
|
-(id) initWith:(phoenix::RadioItem&)radioItemReference {
|
||||||
if(self = [super initWithTitle:@"" action:@selector(activate) keyEquivalent:@""]) {
|
if(self = [super initWithTitle:@"" action:@selector(activate) keyEquivalent:@""]) {
|
||||||
radioItem = &radioItemReference;
|
radioItem = &radioItemReference;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::RadioItem *radioItem;
|
phoenix::RadioItem *radioItem;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::RadioItem&)radioItem;
|
-(id) initWith:(phoenix::RadioItem&)radioItem;
|
||||||
-(void) activate;
|
-(void) activate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ namespace phoenix {
|
|||||||
|
|
||||||
struct pRadioItem : public pAction {
|
struct pRadioItem : public pAction {
|
||||||
RadioItem &radioItem;
|
RadioItem &radioItem;
|
||||||
CocoaRadioItem *cocoaRadioItem;
|
CocoaRadioItem *cocoaRadioItem = nullptr;
|
||||||
|
|
||||||
bool checked();
|
bool checked();
|
||||||
void setChecked();
|
void setChecked();
|
||||||
|
@ -2,7 +2,7 @@ namespace phoenix {
|
|||||||
|
|
||||||
struct pSeparator : public pAction {
|
struct pSeparator : public pAction {
|
||||||
Separator &separator;
|
Separator &separator;
|
||||||
NSMenuItem *cocoaSeparator;
|
NSMenuItem *cocoaSeparator = nullptr;
|
||||||
|
|
||||||
pSeparator(Separator &separator) : pAction(separator), separator(separator) {}
|
pSeparator(Separator &separator) : pAction(separator), separator(separator) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
@implementation CocoaDelegate : NSObject
|
@implementation CocoaDelegate : NSObject
|
||||||
|
|
||||||
-(NSApplicationTerminateReply) applicationShouldTerminate :(NSApplication*)sender {
|
-(NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication*)sender {
|
||||||
using phoenix::Application;
|
using phoenix::Application;
|
||||||
if(Application::Cocoa::onQuit) Application::Cocoa::onQuit();
|
if(Application::Cocoa::onQuit) Application::Cocoa::onQuit();
|
||||||
else Application::quit();
|
else Application::quit();
|
||||||
return NSTerminateCancel;
|
return NSTerminateCancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) run :(NSTimer*)timer {
|
-(BOOL) applicationShouldHandleReopen:(NSApplication*)application hasVisibleWindows:(BOOL)flag {
|
||||||
|
using phoenix::Application;
|
||||||
|
if(Application::Cocoa::onActivate) Application::Cocoa::onActivate();
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) run:(NSTimer*)timer {
|
||||||
using phoenix::Application;
|
using phoenix::Application;
|
||||||
if(Application::main) Application::main();
|
if(Application::main) Application::main();
|
||||||
}
|
}
|
||||||
@ -21,6 +27,9 @@ namespace phoenix {
|
|||||||
void pApplication::run() {
|
void pApplication::run() {
|
||||||
if(Application::main) {
|
if(Application::main) {
|
||||||
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.0 target:cocoaDelegate selector:@selector(run:) userInfo:nil repeats:YES];
|
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.0 target:cocoaDelegate selector:@selector(run:) userInfo:nil repeats:YES];
|
||||||
|
|
||||||
|
//below line is needed to run application during window resize; however it has a large performance penalty on the resize smoothness
|
||||||
|
//[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];
|
||||||
}
|
}
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
[NSApp run];
|
[NSApp run];
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
@interface CocoaDelegate : NSObject <NSApplicationDelegate> {
|
@interface CocoaDelegate : NSObject <NSApplicationDelegate> {
|
||||||
}
|
}
|
||||||
-(NSApplicationTerminateReply) applicationShouldTerminate :(NSApplication*)sender;
|
-(NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication*)sender;
|
||||||
-(void) run :(NSTimer*)timer;
|
-(BOOL) applicationShouldHandleReopen:(NSApplication*)application hasVisibleWindows:(BOOL)flag;
|
||||||
|
-(void) run:(NSTimer*)timer;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
9
higan/phoenix/cocoa/object.cpp
Normal file
9
higan/phoenix/cocoa/object.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace phoenix {
|
||||||
|
|
||||||
|
void pObject::constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void pObject::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -7,8 +7,8 @@ struct pObject {
|
|||||||
pObject(Object &object) : object(object), locked(false) {}
|
pObject(Object &object) : object(object), locked(false) {}
|
||||||
virtual ~pObject() {}
|
virtual ~pObject() {}
|
||||||
|
|
||||||
void constructor() {}
|
void constructor();
|
||||||
void destructor() {}
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#include "platform.hpp"
|
#include "platform.hpp"
|
||||||
#include "utility.cpp"
|
#include "utility.cpp"
|
||||||
|
|
||||||
|
#include "font.cpp"
|
||||||
#include "desktop.cpp"
|
#include "desktop.cpp"
|
||||||
#include "keyboard.cpp"
|
#include "keyboard.cpp"
|
||||||
#include "mouse.cpp"
|
#include "mouse.cpp"
|
||||||
#include "browser-window.cpp"
|
#include "browser-window.cpp"
|
||||||
#include "message-window.cpp"
|
#include "message-window.cpp"
|
||||||
#include "font.cpp"
|
#include "object.cpp"
|
||||||
#include "timer.cpp"
|
#include "timer.cpp"
|
||||||
#include "window.cpp"
|
#include "window.cpp"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaTimer : NSObject
|
@implementation CocoaTimer : NSObject
|
||||||
|
|
||||||
-(id) initWith :(phoenix::Timer&)timerReference {
|
-(id) initWith:(phoenix::Timer&)timerReference {
|
||||||
if(self = [super init]) {
|
if(self = [super init]) {
|
||||||
timer = &timerReference;
|
timer = &timerReference;
|
||||||
instance = nil;
|
instance = nil;
|
||||||
@ -24,7 +24,7 @@
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) run :(NSTimer*)instance {
|
-(void) run:(NSTimer*)instance {
|
||||||
if(timer->onActivate) timer->onActivate();
|
if(timer->onActivate) timer->onActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,17 +3,17 @@
|
|||||||
phoenix::Timer *timer;
|
phoenix::Timer *timer;
|
||||||
NSTimer *instance;
|
NSTimer *instance;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::Timer&)timer;
|
-(id) initWith:(phoenix::Timer&)timer;
|
||||||
-(NSTimer*) instance;
|
-(NSTimer*) instance;
|
||||||
-(void) update;
|
-(void) update;
|
||||||
-(void) run :(NSTimer*)instance;
|
-(void) run:(NSTimer*)instance;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pTimer : public pObject {
|
struct pTimer : public pObject {
|
||||||
Timer &timer;
|
Timer &timer;
|
||||||
CocoaTimer *cocoaTimer;
|
CocoaTimer *cocoaTimer = nullptr;
|
||||||
|
|
||||||
void setEnabled(bool enabled);
|
void setEnabled(bool enabled);
|
||||||
void setInterval(unsigned milliseconds);
|
void setInterval(unsigned milliseconds);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaButton : NSButton
|
@implementation CocoaButton : NSButton
|
||||||
|
|
||||||
-(id) initWith :(phoenix::Button&)buttonReference {
|
-(id) initWith:(phoenix::Button&)buttonReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
button = &buttonReference;
|
button = &buttonReference;
|
||||||
[self setTarget:self];
|
[self setTarget:self];
|
||||||
@ -11,7 +11,7 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) activate :(id)sender {
|
-(IBAction) activate:(id)sender {
|
||||||
if(button->onActivate) button->onActivate();
|
if(button->onActivate) button->onActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::Button *button;
|
phoenix::Button *button;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::Button&)button;
|
-(id) initWith:(phoenix::Button&)button;
|
||||||
-(IBAction) activate :(id)sender;
|
-(IBAction) activate:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pButton : public pWidget {
|
struct pButton : public pWidget {
|
||||||
Button &button;
|
Button &button;
|
||||||
CocoaButton *cocoaButton;
|
CocoaButton *cocoaButton = nullptr;
|
||||||
|
|
||||||
Size minimumSize();
|
Size minimumSize();
|
||||||
void setImage(const image &image, Orientation orientation);
|
void setImage(const image &image, Orientation orientation);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaCanvas : NSImageView
|
@implementation CocoaCanvas : NSImageView
|
||||||
|
|
||||||
-(id) initWith :(phoenix::Canvas&)canvasReference {
|
-(id) initWith:(phoenix::Canvas&)canvasReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
canvas = &canvasReference;
|
canvas = &canvasReference;
|
||||||
[self setEditable:NO]; //disable image drag-and-drop functionality
|
[self setEditable:NO]; //disable image drag-and-drop functionality
|
||||||
@ -13,7 +13,7 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) mouseButton :(NSEvent*)event down:(BOOL)isDown {
|
-(void) mouseButton:(NSEvent*)event down:(BOOL)isDown {
|
||||||
if(auto &callback = isDown ? canvas->onMousePress : canvas->onMouseRelease) {
|
if(auto &callback = isDown ? canvas->onMousePress : canvas->onMouseRelease) {
|
||||||
switch([event buttonNumber]) {
|
switch([event buttonNumber]) {
|
||||||
case 0: return callback(phoenix::Mouse::Button::Left);
|
case 0: return callback(phoenix::Mouse::Button::Left);
|
||||||
@ -23,49 +23,49 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) mouseExited :(NSEvent*)event {
|
-(void) mouseExited:(NSEvent*)event {
|
||||||
if(canvas->onMouseLeave) canvas->onMouseLeave();
|
if(canvas->onMouseLeave) canvas->onMouseLeave();
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) mouseMove :(NSEvent*)event {
|
-(void) mouseMove:(NSEvent*)event {
|
||||||
if([event window] == nil) return;
|
if([event window] == nil) return;
|
||||||
NSPoint location = [self convertPoint:[event locationInWindow] fromView:nil];
|
NSPoint location = [self convertPoint:[event locationInWindow] fromView:nil];
|
||||||
if(canvas->onMouseMove) canvas->onMouseMove({location.x, [self frame].size.height - 1 - location.y});
|
if(canvas->onMouseMove) canvas->onMouseMove({location.x, [self frame].size.height - 1 - location.y});
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) mouseDown :(NSEvent*)event {
|
-(void) mouseDown:(NSEvent*)event {
|
||||||
[self mouseButton:event down:YES];
|
[self mouseButton:event down:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) mouseUp :(NSEvent*)event {
|
-(void) mouseUp:(NSEvent*)event {
|
||||||
[self mouseButton:event down:NO];
|
[self mouseButton:event down:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) mouseDragged :(NSEvent*)event {
|
-(void) mouseDragged:(NSEvent*)event {
|
||||||
[self mouseMove:event];
|
[self mouseMove:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) rightMouseDown :(NSEvent*)event {
|
-(void) rightMouseDown:(NSEvent*)event {
|
||||||
[self mouseButton:event down:YES];
|
[self mouseButton:event down:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) rightMouseUp :(NSEvent*)event {
|
-(void) rightMouseUp:(NSEvent*)event {
|
||||||
[self mouseButton:event down:NO];
|
[self mouseButton:event down:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) rightMouseDragged :(NSEvent*)event {
|
-(void) rightMouseDragged:(NSEvent*)event {
|
||||||
[self mouseMove:event];
|
[self mouseMove:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) otherMouseDown :(NSEvent*)event {
|
-(void) otherMouseDown:(NSEvent*)event {
|
||||||
[self mouseButton:event down:YES];
|
[self mouseButton:event down:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) otherMouseUp :(NSEvent*)event {
|
-(void) otherMouseUp:(NSEvent*)event {
|
||||||
[self mouseButton:event down:NO];
|
[self mouseButton:event down:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) otherMouseDragged :(NSEvent*)event {
|
-(void) otherMouseDragged:(NSEvent*)event {
|
||||||
[self mouseMove:event];
|
[self mouseMove:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,25 +3,25 @@
|
|||||||
phoenix::Canvas *canvas;
|
phoenix::Canvas *canvas;
|
||||||
}
|
}
|
||||||
-(id) initWith:(phoenix::Canvas&)canvas;
|
-(id) initWith:(phoenix::Canvas&)canvas;
|
||||||
-(void) mouseButton :(NSEvent*)event down:(BOOL)isDown;
|
-(void) mouseButton:(NSEvent*)event down:(BOOL)isDown;
|
||||||
-(void) mouseExited :(NSEvent*)event;
|
-(void) mouseExited:(NSEvent*)event;
|
||||||
-(void) mouseMove :(NSEvent*)event;
|
-(void) mouseMove:(NSEvent*)event;
|
||||||
-(void) mouseDown :(NSEvent*)event;
|
-(void) mouseDown:(NSEvent*)event;
|
||||||
-(void) mouseUp :(NSEvent*)event;
|
-(void) mouseUp:(NSEvent*)event;
|
||||||
-(void) mouseDragged :(NSEvent*)event;
|
-(void) mouseDragged:(NSEvent*)event;
|
||||||
-(void) rightMouseDown :(NSEvent*)event;
|
-(void) rightMouseDown:(NSEvent*)event;
|
||||||
-(void) rightMouseUp :(NSEvent*)event;
|
-(void) rightMouseUp:(NSEvent*)event;
|
||||||
-(void) rightMouseDragged :(NSEvent*)event;
|
-(void) rightMouseDragged:(NSEvent*)event;
|
||||||
-(void) otherMouseDown :(NSEvent*)event;
|
-(void) otherMouseDown:(NSEvent*)event;
|
||||||
-(void) otherMouseUp :(NSEvent*)event;
|
-(void) otherMouseUp:(NSEvent*)event;
|
||||||
-(void) otherMouseDragged :(NSEvent*)event;
|
-(void) otherMouseDragged:(NSEvent*)event;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pCanvas : public pWidget {
|
struct pCanvas : public pWidget {
|
||||||
Canvas &canvas;
|
Canvas &canvas;
|
||||||
CocoaCanvas *cocoaCanvas;
|
CocoaCanvas *cocoaCanvas = nullptr;
|
||||||
|
|
||||||
void setSize(const Size &size);
|
void setSize(const Size &size);
|
||||||
void update();
|
void update();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaCheckButton : NSButton
|
@implementation CocoaCheckButton : NSButton
|
||||||
|
|
||||||
-(id) initWith :(phoenix::CheckButton&)checkButtonReference {
|
-(id) initWith:(phoenix::CheckButton&)checkButtonReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
checkButton = &checkButtonReference;
|
checkButton = &checkButtonReference;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) activate :(id)sender {
|
-(IBAction) activate:(id)sender {
|
||||||
checkButton->state.checked = [self state] != NSOffState;
|
checkButton->state.checked = [self state] != NSOffState;
|
||||||
if(checkButton->onToggle) checkButton->onToggle();
|
if(checkButton->onToggle) checkButton->onToggle();
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::CheckButton *checkButton;
|
phoenix::CheckButton *checkButton;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::CheckButton&)checkButton;
|
-(id) initWith:(phoenix::CheckButton&)checkButton;
|
||||||
-(IBAction) activate :(id)sender;
|
-(IBAction) activate:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pCheckButton : public pWidget {
|
struct pCheckButton : public pWidget {
|
||||||
CheckButton &checkButton;
|
CheckButton &checkButton;
|
||||||
CocoaCheckButton *cocoaCheckButton;
|
CocoaCheckButton *cocoaCheckButton = nullptr;
|
||||||
|
|
||||||
bool checked();
|
bool checked();
|
||||||
Size minimumSize();
|
Size minimumSize();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaComboButton : NSPopUpButton
|
@implementation CocoaComboButton : NSPopUpButton
|
||||||
|
|
||||||
-(id) initWith :(phoenix::ComboButton&)comboButtonReference {
|
-(id) initWith:(phoenix::ComboButton&)comboButtonReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0) pullsDown:NO]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0) pullsDown:NO]) {
|
||||||
comboButton = &comboButtonReference;
|
comboButton = &comboButtonReference;
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) activate :(id)sender {
|
-(IBAction) activate:(id)sender {
|
||||||
if(comboButton->onChange) comboButton->onChange();
|
if(comboButton->onChange) comboButton->onChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::ComboButton *comboButton;
|
phoenix::ComboButton *comboButton;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::ComboButton&)comboButton;
|
-(id) initWith:(phoenix::ComboButton&)comboButton;
|
||||||
-(IBAction) activate :(id)sender;
|
-(IBAction) activate:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pComboButton : public pWidget {
|
struct pComboButton : public pWidget {
|
||||||
ComboButton &comboButton;
|
ComboButton &comboButton;
|
||||||
CocoaComboButton *cocoaComboButton;
|
CocoaComboButton *cocoaComboButton = nullptr;
|
||||||
|
|
||||||
void append(const string &text);
|
void append(const string &text);
|
||||||
Size minimumSize();
|
Size minimumSize();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaHexEdit : NSScrollView
|
@implementation CocoaHexEdit : NSScrollView
|
||||||
|
|
||||||
-(id) initWith :(phoenix::HexEdit&)hexEditReference {
|
-(id) initWith:(phoenix::HexEdit&)hexEditReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
hexEdit = &hexEditReference;
|
hexEdit = &hexEditReference;
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::HexEdit *hexEdit;
|
phoenix::HexEdit *hexEdit;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::HexEdit&)hexEdit;
|
-(id) initWith:(phoenix::HexEdit&)hexEdit;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pHexEdit : public pWidget {
|
struct pHexEdit : public pWidget {
|
||||||
HexEdit &hexEdit;
|
HexEdit &hexEdit;
|
||||||
CocoaHexEdit *cocoaHexEdit;
|
CocoaHexEdit *cocoaHexEdit = nullptr;
|
||||||
|
|
||||||
void setColumns(unsigned columns);
|
void setColumns(unsigned columns);
|
||||||
void setLength(unsigned length);
|
void setLength(unsigned length);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaHorizontalScroller : NSScroller
|
@implementation CocoaHorizontalScroller : NSScroller
|
||||||
|
|
||||||
-(id) initWith :(phoenix::HorizontalScroller&)horizontalScrollerReference {
|
-(id) initWith:(phoenix::HorizontalScroller&)horizontalScrollerReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 1, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 1, 0)]) {
|
||||||
horizontalScroller = &horizontalScrollerReference;
|
horizontalScroller = &horizontalScrollerReference;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
[self setKnobProportion:d];
|
[self setKnobProportion:d];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) scroll :(id)sender {
|
-(IBAction) scroll:(id)sender {
|
||||||
auto &state = horizontalScroller->state;
|
auto &state = horizontalScroller->state;
|
||||||
|
|
||||||
switch([self hitPart]) {
|
switch([self hitPart]) {
|
||||||
|
@ -2,16 +2,16 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::HorizontalScroller *horizontalScroller;
|
phoenix::HorizontalScroller *horizontalScroller;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::HorizontalScroller&)horizontalScroller;
|
-(id) initWith:(phoenix::HorizontalScroller&)horizontalScroller;
|
||||||
-(void) update;
|
-(void) update;
|
||||||
-(IBAction) scroll :(id)sender;
|
-(IBAction) scroll:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pHorizontalScroller : public pWidget {
|
struct pHorizontalScroller : public pWidget {
|
||||||
HorizontalScroller &horizontalScroller;
|
HorizontalScroller &horizontalScroller;
|
||||||
CocoaHorizontalScroller *cocoaHorizontalScroller;
|
CocoaHorizontalScroller *cocoaHorizontalScroller = nullptr;
|
||||||
|
|
||||||
Size minimumSize();
|
Size minimumSize();
|
||||||
unsigned position();
|
unsigned position();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaHorizontalSlider : NSSlider
|
@implementation CocoaHorizontalSlider : NSSlider
|
||||||
|
|
||||||
-(id) initWith :(phoenix::HorizontalSlider&)horizontalSliderReference {
|
-(id) initWith:(phoenix::HorizontalSlider&)horizontalSliderReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 1, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 1, 0)]) {
|
||||||
horizontalSlider = &horizontalSliderReference;
|
horizontalSlider = &horizontalSliderReference;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) activate :(id)sender {
|
-(IBAction) activate:(id)sender {
|
||||||
horizontalSlider->state.position = [self doubleValue];
|
horizontalSlider->state.position = [self doubleValue];
|
||||||
if(horizontalSlider->onChange) horizontalSlider->onChange();
|
if(horizontalSlider->onChange) horizontalSlider->onChange();
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::HorizontalSlider *horizontalSlider;
|
phoenix::HorizontalSlider *horizontalSlider;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::HorizontalSlider&)horizontalSlider;
|
-(id) initWith:(phoenix::HorizontalSlider&)horizontalSlider;
|
||||||
-(IBAction) activate :(id)sender;
|
-(IBAction) activate:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pHorizontalSlider : public pWidget {
|
struct pHorizontalSlider : public pWidget {
|
||||||
HorizontalSlider &horizontalSlider;
|
HorizontalSlider &horizontalSlider;
|
||||||
CocoaHorizontalSlider *cocoaHorizontalSlider;
|
CocoaHorizontalSlider *cocoaHorizontalSlider = nullptr;
|
||||||
|
|
||||||
Size minimumSize();
|
Size minimumSize();
|
||||||
unsigned position();
|
unsigned position();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaLabel : NSTextField
|
@implementation CocoaLabel : NSTextField
|
||||||
|
|
||||||
-(id) initWith :(phoenix::Label&)labelReference {
|
-(id) initWith:(phoenix::Label&)labelReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
label = &labelReference;
|
label = &labelReference;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ namespace phoenix {
|
|||||||
|
|
||||||
Size pLabel::minimumSize() {
|
Size pLabel::minimumSize() {
|
||||||
Size size = Font::size(label.font(), label.state.text);
|
Size size = Font::size(label.font(), label.state.text);
|
||||||
return {size.width, size.height};
|
return {size.width + 6, size.height};
|
||||||
}
|
}
|
||||||
|
|
||||||
void pLabel::setText(const string &text) {
|
void pLabel::setText(const string &text) {
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::Label *label;
|
phoenix::Label *label;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::Label&)label;
|
-(id) initWith:(phoenix::Label&)label;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pLabel : public pWidget {
|
struct pLabel : public pWidget {
|
||||||
Label &label;
|
Label &label;
|
||||||
CocoaLabel *cocoaLabel;
|
CocoaLabel *cocoaLabel = nullptr;
|
||||||
|
|
||||||
Size minimumSize();
|
Size minimumSize();
|
||||||
void setText(const string &text);
|
void setText(const string &text);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaLineEdit : NSTextField
|
@implementation CocoaLineEdit : NSTextField
|
||||||
|
|
||||||
-(id) initWith :(phoenix::LineEdit&)lineEditReference {
|
-(id) initWith:(phoenix::LineEdit&)lineEditReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
lineEdit = &lineEditReference;
|
lineEdit = &lineEditReference;
|
||||||
|
|
||||||
@ -14,11 +14,11 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) textDidChange :(NSNotification*)n {
|
-(void) textDidChange:(NSNotification*)n {
|
||||||
if(lineEdit->onChange) lineEdit->onChange();
|
if(lineEdit->onChange) lineEdit->onChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) activate :(id)sender {
|
-(IBAction) activate:(id)sender {
|
||||||
if(lineEdit->onActivate) lineEdit->onActivate();
|
if(lineEdit->onActivate) lineEdit->onActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,16 +2,16 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::LineEdit *lineEdit;
|
phoenix::LineEdit *lineEdit;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::LineEdit&)lineEdit;
|
-(id) initWith:(phoenix::LineEdit&)lineEdit;
|
||||||
-(void) textDidChange :(NSNotification*)n;
|
-(void) textDidChange:(NSNotification*)n;
|
||||||
-(IBAction) activate :(id)sender;
|
-(IBAction) activate:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pLineEdit : public pWidget {
|
struct pLineEdit : public pWidget {
|
||||||
LineEdit &lineEdit;
|
LineEdit &lineEdit;
|
||||||
CocoaLineEdit *cocoaLineEdit;
|
CocoaLineEdit *cocoaLineEdit = nullptr;
|
||||||
|
|
||||||
Size minimumSize();
|
Size minimumSize();
|
||||||
void setEditable(bool editable);
|
void setEditable(bool editable);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaListView : NSScrollView
|
@implementation CocoaListView : NSScrollView
|
||||||
|
|
||||||
-(id) initWith :(phoenix::ListView&)listViewReference {
|
-(id) initWith:(phoenix::ListView&)listViewReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
listView = &listViewReference;
|
listView = &listViewReference;
|
||||||
content = [[CocoaListViewContent alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)];
|
content = [[CocoaListViewContent alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)];
|
||||||
@ -12,14 +12,14 @@
|
|||||||
[content setDataSource:self];
|
[content setDataSource:self];
|
||||||
[content setDelegate:self];
|
[content setDelegate:self];
|
||||||
[content setTarget:self];
|
[content setTarget:self];
|
||||||
[content setDoubleAction:@selector(activate:)];
|
[content setDoubleAction:@selector(doubleAction:)];
|
||||||
|
|
||||||
[content setAllowsColumnReordering:NO];
|
[content setAllowsColumnReordering:NO];
|
||||||
[content setAllowsColumnResizing:YES];
|
[content setAllowsColumnResizing:YES];
|
||||||
[content setAllowsColumnSelection:NO];
|
[content setAllowsColumnSelection:NO];
|
||||||
[content setAllowsEmptySelection:YES];
|
[content setAllowsEmptySelection:YES];
|
||||||
[content setAllowsMultipleSelection:NO];
|
[content setAllowsMultipleSelection:NO];
|
||||||
[content setColumnAutoresizingStyle:NSTableViewNoColumnAutoresizing];
|
[content setColumnAutoresizingStyle:NSTableViewLastColumnOnlyAutoresizingStyle];
|
||||||
|
|
||||||
font = nil;
|
font = nil;
|
||||||
[self setFont:nil];
|
[self setFont:nil];
|
||||||
@ -41,7 +41,7 @@
|
|||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) setFont :(NSFont*)fontPointer {
|
-(void) setFont:(NSFont*)fontPointer {
|
||||||
if(!fontPointer) fontPointer = [NSFont systemFontOfSize:12];
|
if(!fontPointer) fontPointer = [NSFont systemFontOfSize:12];
|
||||||
[fontPointer retain];
|
[fontPointer retain];
|
||||||
if(font) [font release];
|
if(font) [font release];
|
||||||
@ -94,11 +94,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSInteger) numberOfRowsInTableView :(NSTableView*)table {
|
-(NSInteger) numberOfRowsInTableView:(NSTableView*)table {
|
||||||
return listView->state.text.size();
|
return listView->state.text.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
-(id) tableView :(NSTableView*)table objectValueForTableColumn :(NSTableColumn*)tableColumn row:(NSInteger)row {
|
-(id) tableView:(NSTableView*)table objectValueForTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row {
|
||||||
if([[tableColumn identifier] isEqualToString:@"check"]) {
|
if([[tableColumn identifier] isEqualToString:@"check"]) {
|
||||||
auto checked = listView->state.checked(row) ? NSOnState : NSOffState;
|
auto checked = listView->state.checked(row) ? NSOnState : NSOffState;
|
||||||
return [NSNumber numberWithInteger:checked];
|
return [NSNumber numberWithInteger:checked];
|
||||||
@ -114,37 +114,53 @@
|
|||||||
return @{ @"text":text };
|
return @{ @"text":text };
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) tableView :(NSTableView*)table setObjectValue:(id)object forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row {
|
-(BOOL) tableView:(NSTableView*)table shouldShowCellExpansionForTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*) tableView:(NSTableView*)table toolTipForCell:(NSCell*)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) tableView:(NSTableView*)table setObjectValue:(id)object forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row {
|
||||||
if([[tableColumn identifier] isEqualToString:@"check"]) {
|
if([[tableColumn identifier] isEqualToString:@"check"]) {
|
||||||
listView->state.checked(row) = [object integerValue] != NSOffState;
|
listView->state.checked(row) = [object integerValue] != NSOffState;
|
||||||
if(listView->onToggle) listView->onToggle(row);
|
if(listView->onToggle) listView->onToggle(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) tableView :(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row {
|
-(void) tableView:(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row {
|
||||||
[cell setFont:[self font]];
|
[cell setFont:[self font]];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) tableViewSelectionDidChange :(NSNotification*)notification {
|
-(void) tableViewSelectionDidChange:(NSNotification*)notification {
|
||||||
if(listView->onChange) listView->onChange();
|
if(listView->onChange) listView->onChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) activate :(id)sender {
|
-(IBAction) activate:(id)sender {
|
||||||
if([content clickedRow] < 0) return;
|
|
||||||
if(listView->onActivate) listView->onActivate();
|
if(listView->onActivate) listView->onActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(IBAction) doubleAction:(id)sender {
|
||||||
|
if([content clickedRow] >= 0) {
|
||||||
|
[self activate:self];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation CocoaListViewContent : NSTableView
|
@implementation CocoaListViewContent : NSTableView
|
||||||
|
|
||||||
-(void) keyDown :(NSEvent*)event {
|
-(void) keyDown:(NSEvent*)event {
|
||||||
[super keyDown:event];
|
|
||||||
|
|
||||||
auto character = [[event characters] characterAtIndex:0];
|
auto character = [[event characters] characterAtIndex:0];
|
||||||
if(character == NSEnterCharacter || character == NSCarriageReturnCharacter) {
|
if(character == NSEnterCharacter || character == NSCarriageReturnCharacter) {
|
||||||
|
if([self selectedRow] >= 0) {
|
||||||
[[self delegate] activate:self];
|
[[self delegate] activate:self];
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[super keyDown:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -156,7 +172,7 @@
|
|||||||
return [[self objectValue] objectForKey:@"text"];
|
return [[self objectValue] objectForKey:@"text"];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) drawWithFrame :(NSRect)frame inView:(NSView*)view {
|
-(void) drawWithFrame:(NSRect)frame inView:(NSView*)view {
|
||||||
NSString *text = [[self objectValue] objectForKey:@"text"];
|
NSString *text = [[self objectValue] objectForKey:@"text"];
|
||||||
NSImage *image = [[self objectValue] objectForKey:@"image"];
|
NSImage *image = [[self objectValue] objectForKey:@"image"];
|
||||||
unsigned textDisplacement = 0;
|
unsigned textDisplacement = 0;
|
||||||
@ -206,7 +222,7 @@ void pListView::autoSizeColumns() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned height = [[cocoaView content] rowHeight];
|
unsigned height = [[cocoaView content] rowHeight];
|
||||||
for(unsigned column = 0; column < listView.state.headerText.size(); column++) {
|
for(unsigned column = 0; column < max(1u, listView.state.headerText.size()); column++) {
|
||||||
NSTableColumn *tableColumn = [[cocoaView content] tableColumnWithIdentifier:[[NSNumber numberWithInteger:column] stringValue]];
|
NSTableColumn *tableColumn = [[cocoaView content] tableColumnWithIdentifier:[[NSNumber numberWithInteger:column] stringValue]];
|
||||||
unsigned minimumWidth = pFont::size([[tableColumn headerCell] font], listView.state.headerText(column)).width + 4;
|
unsigned minimumWidth = pFont::size([[tableColumn headerCell] font], listView.state.headerText(column)).width + 4;
|
||||||
for(unsigned row = 0; row < listView.state.text.size(); row++) {
|
for(unsigned row = 0; row < listView.state.text.size(); row++) {
|
||||||
@ -216,6 +232,8 @@ void pListView::autoSizeColumns() {
|
|||||||
}
|
}
|
||||||
[tableColumn setWidth:minimumWidth];
|
[tableColumn setWidth:minimumWidth];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[cocoaView content] sizeLastColumnToFit];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,36 +6,39 @@
|
|||||||
CocoaListViewContent *content;
|
CocoaListViewContent *content;
|
||||||
NSFont *font;
|
NSFont *font;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::ListView&)listView;
|
-(id) initWith:(phoenix::ListView&)listView;
|
||||||
-(void) dealloc;
|
-(void) dealloc;
|
||||||
-(CocoaListViewContent*) content;
|
-(CocoaListViewContent*) content;
|
||||||
-(NSFont*) font;
|
-(NSFont*) font;
|
||||||
-(void) setFont :(NSFont*)font;
|
-(void) setFont:(NSFont*)font;
|
||||||
-(void) reloadColumns;
|
-(void) reloadColumns;
|
||||||
-(NSInteger) numberOfRowsInTableView :(NSTableView*)table;
|
-(NSInteger) numberOfRowsInTableView:(NSTableView*)table;
|
||||||
-(id) tableView :(NSTableView*)table objectValueForTableColumn :(NSTableColumn*)tableColumn row:(NSInteger)row;
|
-(id) tableView:(NSTableView*)table objectValueForTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row;
|
||||||
-(void) tableView :(NSTableView*)table setObjectValue:(id)object forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row;
|
-(BOOL) tableView:(NSTableView*)table shouldShowCellExpansionForTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row;
|
||||||
-(void) tableView :(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row;
|
-(NSString*) tableView:(NSTableView*)table toolTipForCell:(NSCell*)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation;
|
||||||
-(void) tableViewSelectionDidChange :(NSNotification*)notification;
|
-(void) tableView:(NSTableView*)table setObjectValue:(id)object forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row;
|
||||||
-(IBAction) activate :(id)sender;
|
-(void) tableView:(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row;
|
||||||
|
-(void) tableViewSelectionDidChange:(NSNotification*)notification;
|
||||||
|
-(IBAction) activate:(id)sender;
|
||||||
|
-(IBAction) doubleAction:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface CocoaListViewContent : NSTableView {
|
@interface CocoaListViewContent : NSTableView {
|
||||||
}
|
}
|
||||||
-(void) keyDown :(NSEvent*)event;
|
-(void) keyDown:(NSEvent*)event;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface CocoaListViewCell : NSTextFieldCell {
|
@interface CocoaListViewCell : NSTextFieldCell {
|
||||||
}
|
}
|
||||||
-(NSString*) stringValue;
|
-(NSString*) stringValue;
|
||||||
-(void) drawWithFrame :(NSRect)frame inView:(NSView*)view;
|
-(void) drawWithFrame:(NSRect)frame inView:(NSView*)view;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pListView : public pWidget {
|
struct pListView : public pWidget {
|
||||||
ListView &listView;
|
ListView &listView;
|
||||||
CocoaListView *cocoaListView;
|
CocoaListView *cocoaListView = nullptr;
|
||||||
|
|
||||||
void append(const lstring &text);
|
void append(const lstring &text);
|
||||||
void autoSizeColumns();
|
void autoSizeColumns();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaProgressBar : NSProgressIndicator
|
@implementation CocoaProgressBar : NSProgressIndicator
|
||||||
|
|
||||||
-(id) initWith :(phoenix::ProgressBar&)progressBarReference {
|
-(id) initWith:(phoenix::ProgressBar&)progressBarReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
progressBar = &progressBarReference;
|
progressBar = &progressBarReference;
|
||||||
|
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::ProgressBar *progressBar;
|
phoenix::ProgressBar *progressBar;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::ProgressBar&)progressBar;
|
-(id) initWith:(phoenix::ProgressBar&)progressBar;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pProgressBar : public pWidget {
|
struct pProgressBar : public pWidget {
|
||||||
ProgressBar &progressBar;
|
ProgressBar &progressBar;
|
||||||
CocoaProgressBar *cocoaProgressBar;
|
CocoaProgressBar *cocoaProgressBar = nullptr;
|
||||||
|
|
||||||
void setPosition(unsigned position);
|
void setPosition(unsigned position);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaRadioButton : NSButton
|
@implementation CocoaRadioButton : NSButton
|
||||||
|
|
||||||
-(id) initWith :(phoenix::RadioButton&)radioButtonReference {
|
-(id) initWith:(phoenix::RadioButton&)radioButtonReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
radioButton = &radioButtonReference;
|
radioButton = &radioButtonReference;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) activate :(id)sender {
|
-(IBAction) activate:(id)sender {
|
||||||
radioButton->setChecked();
|
radioButton->setChecked();
|
||||||
if(radioButton->onActivate) radioButton->onActivate();
|
if(radioButton->onActivate) radioButton->onActivate();
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::RadioButton *radioButton;
|
phoenix::RadioButton *radioButton;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::RadioButton&)radioButton;
|
-(id) initWith:(phoenix::RadioButton&)radioButton;
|
||||||
|
-(IBAction) activate:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pRadioButton : public pWidget {
|
struct pRadioButton : public pWidget {
|
||||||
RadioButton &radioButton;
|
RadioButton &radioButton;
|
||||||
CocoaRadioButton *cocoaRadioButton;
|
CocoaRadioButton *cocoaRadioButton = nullptr;
|
||||||
|
|
||||||
bool checked();
|
bool checked();
|
||||||
Size minimumSize();
|
Size minimumSize();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaTextEdit : NSScrollView
|
@implementation CocoaTextEdit : NSScrollView
|
||||||
|
|
||||||
-(id) initWith :(phoenix::TextEdit&)textEditReference {
|
-(id) initWith:(phoenix::TextEdit&)textEditReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
textEdit = &textEditReference;
|
textEdit = &textEditReference;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@
|
|||||||
[self setHasVerticalScroller:YES];
|
[self setHasVerticalScroller:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) textDidChange :(NSNotification*)notification {
|
-(void) textDidChange:(NSNotification*)notification {
|
||||||
textEdit->state.text = [[content string] UTF8String];
|
textEdit->state.text = [[content string] UTF8String];
|
||||||
if(textEdit->onChange) textEdit->onChange();
|
if(textEdit->onChange) textEdit->onChange();
|
||||||
}
|
}
|
||||||
|
@ -3,17 +3,17 @@
|
|||||||
phoenix::TextEdit *textEdit;
|
phoenix::TextEdit *textEdit;
|
||||||
NSTextView *content;
|
NSTextView *content;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::TextEdit&)textEdit;
|
-(id) initWith:(phoenix::TextEdit&)textEdit;
|
||||||
-(NSTextView*) content;
|
-(NSTextView*) content;
|
||||||
-(void) configure;
|
-(void) configure;
|
||||||
-(void) textDidChange :(NSNotification*)notification;
|
-(void) textDidChange:(NSNotification*)notification;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pTextEdit : public pWidget {
|
struct pTextEdit : public pWidget {
|
||||||
TextEdit &textEdit;
|
TextEdit &textEdit;
|
||||||
CocoaTextEdit *cocoaTextEdit;
|
CocoaTextEdit *cocoaTextEdit = nullptr;
|
||||||
|
|
||||||
void setCursorPosition(unsigned position);
|
void setCursorPosition(unsigned position);
|
||||||
void setEditable(bool editable);
|
void setEditable(bool editable);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaVerticalScroller : NSScroller
|
@implementation CocoaVerticalScroller : NSScroller
|
||||||
|
|
||||||
-(id) initWith :(phoenix::VerticalScroller&)verticalScrollerReference {
|
-(id) initWith:(phoenix::VerticalScroller&)verticalScrollerReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 1)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 1)]) {
|
||||||
verticalScroller = &verticalScrollerReference;
|
verticalScroller = &verticalScrollerReference;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
[self setKnobProportion:d];
|
[self setKnobProportion:d];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) scroll :(id)sender {
|
-(IBAction) scroll:(id)sender {
|
||||||
auto &state = verticalScroller->state;
|
auto &state = verticalScroller->state;
|
||||||
|
|
||||||
switch([self hitPart]) {
|
switch([self hitPart]) {
|
||||||
|
@ -2,14 +2,16 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::VerticalScroller *verticalScroller;
|
phoenix::VerticalScroller *verticalScroller;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::VerticalScroller&)verticalScroller;
|
-(id) initWith:(phoenix::VerticalScroller&)verticalScroller;
|
||||||
|
-(void) update;
|
||||||
|
-(IBAction) scroll:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pVerticalScroller : public pWidget {
|
struct pVerticalScroller : public pWidget {
|
||||||
VerticalScroller &verticalScroller;
|
VerticalScroller &verticalScroller;
|
||||||
CocoaVerticalScroller *cocoaVerticalScroller;
|
CocoaVerticalScroller *cocoaVerticalScroller = nullptr;
|
||||||
|
|
||||||
Size minimumSize();
|
Size minimumSize();
|
||||||
unsigned position();
|
unsigned position();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaVerticalSlider : NSSlider
|
@implementation CocoaVerticalSlider : NSSlider
|
||||||
|
|
||||||
-(id) initWith :(phoenix::VerticalSlider&)verticalSliderReference {
|
-(id) initWith:(phoenix::VerticalSlider&)verticalSliderReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 1)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 1)]) {
|
||||||
verticalSlider = &verticalSliderReference;
|
verticalSlider = &verticalSliderReference;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) activate :(id)sender {
|
-(IBAction) activate:(id)sender {
|
||||||
verticalSlider->state.position = [self doubleValue];
|
verticalSlider->state.position = [self doubleValue];
|
||||||
if(verticalSlider->onChange) verticalSlider->onChange();
|
if(verticalSlider->onChange) verticalSlider->onChange();
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::VerticalSlider *verticalSlider;
|
phoenix::VerticalSlider *verticalSlider;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::VerticalSlider&)verticalSlider;
|
-(id) initWith:(phoenix::VerticalSlider&)verticalSlider;
|
||||||
-(IBAction) activate :(id)sender;
|
-(IBAction) activate:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pVerticalSlider : public pWidget {
|
struct pVerticalSlider : public pWidget {
|
||||||
VerticalSlider &verticalSlider;
|
VerticalSlider &verticalSlider;
|
||||||
CocoaVerticalSlider *cocoaVerticalSlider;
|
CocoaVerticalSlider *cocoaVerticalSlider = nullptr;
|
||||||
|
|
||||||
Size minimumSize();
|
Size minimumSize();
|
||||||
unsigned position();
|
unsigned position();
|
||||||
|
@ -1,16 +1,25 @@
|
|||||||
@implementation CocoaViewport : NSView
|
@implementation CocoaViewport : NSView
|
||||||
|
|
||||||
-(id) initWith :(phoenix::Viewport&)viewportReference {
|
-(id) initWith:(phoenix::Viewport&)viewportReference {
|
||||||
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
||||||
viewport = &viewportReference;
|
viewport = &viewportReference;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) drawRect :(NSRect)rect {
|
-(void) drawRect:(NSRect)rect {
|
||||||
NSColor *background = [NSColor blackColor];
|
[[NSColor blackColor] setFill];
|
||||||
[background set];
|
NSRectFillUsingOperation(rect, NSCompositeSourceOver);
|
||||||
NSRectFill([self bounds]);
|
}
|
||||||
|
|
||||||
|
-(BOOL) acceptsFirstResponder {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) keyDown:(NSEvent*)event {
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) keyUp:(NSEvent*)event {
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -2,15 +2,18 @@
|
|||||||
@public
|
@public
|
||||||
phoenix::Viewport *viewport;
|
phoenix::Viewport *viewport;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::Viewport&)viewport;
|
-(id) initWith:(phoenix::Viewport&)viewport;
|
||||||
-(void) drawRect :(NSRect)rect;
|
-(void) drawRect:(NSRect)rect;
|
||||||
|
-(BOOL) acceptsFirstResponder;
|
||||||
|
-(void) keyDown:(NSEvent*)event;
|
||||||
|
-(void) keyUp:(NSEvent*)event;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pViewport : public pWidget {
|
struct pViewport : public pWidget {
|
||||||
Viewport &viewport;
|
Viewport &viewport;
|
||||||
CocoaViewport *cocoaViewport;
|
CocoaViewport *cocoaViewport = nullptr;
|
||||||
|
|
||||||
uintptr_t handle();
|
uintptr_t handle();
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ namespace phoenix {
|
|||||||
|
|
||||||
struct pWidget : public pSizable {
|
struct pWidget : public pSizable {
|
||||||
Widget &widget;
|
Widget &widget;
|
||||||
NSView *cocoaView;
|
NSView *cocoaView = nullptr;
|
||||||
|
|
||||||
bool enabled();
|
bool enabled();
|
||||||
bool focused();
|
bool focused();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@implementation CocoaWindow : NSWindow
|
@implementation CocoaWindow : NSWindow
|
||||||
|
|
||||||
-(id) initWith :(phoenix::Window&)windowReference {
|
-(id) initWith:(phoenix::Window&)windowReference {
|
||||||
window = &windowReference;
|
window = &windowReference;
|
||||||
|
|
||||||
NSUInteger style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask;
|
NSUInteger style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask;
|
||||||
@ -10,7 +10,6 @@
|
|||||||
[self setDelegate:self];
|
[self setDelegate:self];
|
||||||
[self setReleasedWhenClosed:NO];
|
[self setReleasedWhenClosed:NO];
|
||||||
[self setAcceptsMouseMovedEvents:YES];
|
[self setAcceptsMouseMovedEvents:YES];
|
||||||
[self setLevel:NSFloatingWindowLevel]; //when launched from a terminal, this places the window above it
|
|
||||||
[self setTitle:@""];
|
[self setTitle:@""];
|
||||||
|
|
||||||
menuBar = [[NSMenu alloc] init];
|
menuBar = [[NSMenu alloc] init];
|
||||||
@ -35,6 +34,16 @@
|
|||||||
text = {"Quit ", phoenix::applicationState.name};
|
text = {"Quit ", phoenix::applicationState.name};
|
||||||
item = [[[NSMenuItem alloc] initWithTitle:[NSString stringWithUTF8String:text] action:@selector(menuQuit) keyEquivalent:@""] autorelease];
|
item = [[[NSMenuItem alloc] initWithTitle:[NSString stringWithUTF8String:text] action:@selector(menuQuit) keyEquivalent:@""] autorelease];
|
||||||
[rootMenu addItem:item];
|
[rootMenu addItem:item];
|
||||||
|
|
||||||
|
statusBar = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)];
|
||||||
|
[statusBar setAlignment:NSLeftTextAlignment];
|
||||||
|
[statusBar setBordered:YES];
|
||||||
|
[statusBar setBezeled:YES];
|
||||||
|
[statusBar setBezelStyle:NSTextFieldSquareBezel];
|
||||||
|
[statusBar setEditable:NO];
|
||||||
|
[statusBar setHidden:YES];
|
||||||
|
|
||||||
|
[[self contentView] addSubview:statusBar positioned:NSWindowBelow relativeTo:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@ -48,21 +57,21 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) windowDidBecomeMain :(NSNotification*)notification {
|
-(void) windowDidBecomeMain:(NSNotification*)notification {
|
||||||
if(window->state.menu.size() > 0) {
|
if(window->state.menu.size() > 0) {
|
||||||
[NSApp setMainMenu:menuBar];
|
[NSApp setMainMenu:menuBar];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) windowDidMove :(NSNotification*)notification {
|
-(void) windowDidMove:(NSNotification*)notification {
|
||||||
window->p.moveEvent();
|
window->p.moveEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) windowDidResize :(NSNotification*)notification {
|
-(void) windowDidResize:(NSNotification*)notification {
|
||||||
window->p.sizeEvent();
|
window->p.sizeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL) windowShouldClose :(id)sender {
|
-(BOOL) windowShouldClose:(id)sender {
|
||||||
if(window->onClose) window->onClose();
|
if(window->onClose) window->onClose();
|
||||||
else window->setVisible(false);
|
else window->setVisible(false);
|
||||||
if(window->state.modal && !window->visible()) window->setModal(false);
|
if(window->state.modal && !window->visible()) window->setModal(false);
|
||||||
@ -88,6 +97,10 @@
|
|||||||
if(Application::Cocoa::onQuit) Application::Cocoa::onQuit();
|
if(Application::Cocoa::onQuit) Application::Cocoa::onQuit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(NSTextField*) statusBar {
|
||||||
|
return statusBar;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
@ -102,6 +115,8 @@ void pWindow::append(Layout &layout) {
|
|||||||
Geometry geometry = window.state.geometry;
|
Geometry geometry = window.state.geometry;
|
||||||
geometry.x = geometry.y = 0;
|
geometry.x = geometry.y = 0;
|
||||||
layout.setGeometry(geometry);
|
layout.setGeometry(geometry);
|
||||||
|
|
||||||
|
statusBarReposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pWindow::append(Menu &menu) {
|
void pWindow::append(Menu &menu) {
|
||||||
@ -117,7 +132,7 @@ void pWindow::append(Widget &widget) {
|
|||||||
|
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
[widget.p.cocoaView removeFromSuperview];
|
[widget.p.cocoaView removeFromSuperview];
|
||||||
[[cocoaWindow contentView] addSubview:widget.p.cocoaView positioned:NSWindowAbove relativeTo:nil];
|
[[cocoaWindow contentView] addSubview:widget.p.cocoaView positioned:NSWindowBelow relativeTo:nil];
|
||||||
widget.p.setGeometry(widget.geometry());
|
widget.p.setGeometry(widget.geometry());
|
||||||
[[cocoaWindow contentView] setNeedsDisplay:YES];
|
[[cocoaWindow contentView] setNeedsDisplay:YES];
|
||||||
}
|
}
|
||||||
@ -151,6 +166,7 @@ Geometry pWindow::frameMargin() {
|
|||||||
Geometry pWindow::geometry() {
|
Geometry pWindow::geometry() {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSRect area = [cocoaWindow contentRectForFrameRect:[cocoaWindow frame]];
|
NSRect area = [cocoaWindow contentRectForFrameRect:[cocoaWindow frame]];
|
||||||
|
area.size.height -= statusBarHeight();
|
||||||
return {area.origin.x, Desktop::size().height - area.origin.y - area.size.height, area.size.width, area.size.height};
|
return {area.origin.x, Desktop::size().height - area.origin.y - area.size.height, area.size.width, area.size.height};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,7 +229,10 @@ void pWindow::setGeometry(const Geometry &geometry) {
|
|||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
[cocoaWindow
|
[cocoaWindow
|
||||||
setFrame:[cocoaWindow
|
setFrame:[cocoaWindow
|
||||||
frameRectForContentRect:NSMakeRect(geometry.x, Desktop::size().height - geometry.y - geometry.height, geometry.width, geometry.height)
|
frameRectForContentRect:NSMakeRect(
|
||||||
|
geometry.x, Desktop::size().height - geometry.y - geometry.height,
|
||||||
|
geometry.width, geometry.height + statusBarHeight()
|
||||||
|
)
|
||||||
]
|
]
|
||||||
display:YES
|
display:YES
|
||||||
];
|
];
|
||||||
@ -223,6 +242,8 @@ void pWindow::setGeometry(const Geometry &geometry) {
|
|||||||
geometry.x = geometry.y = 0;
|
geometry.x = geometry.y = 0;
|
||||||
layout.setGeometry(geometry);
|
layout.setGeometry(geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
statusBarReposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
locked = false;
|
locked = false;
|
||||||
@ -255,12 +276,23 @@ void pWindow::setResizable(bool resizable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void pWindow::setStatusFont(const string &font) {
|
void pWindow::setStatusFont(const string &font) {
|
||||||
|
@autoreleasepool {
|
||||||
|
[[cocoaWindow statusBar] setFont:pFont::cocoaFont(font)];
|
||||||
|
}
|
||||||
|
statusBarReposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pWindow::setStatusText(const string &text) {
|
void pWindow::setStatusText(const string &text) {
|
||||||
|
@autoreleasepool {
|
||||||
|
[[cocoaWindow statusBar] setStringValue:[NSString stringWithUTF8String:text]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pWindow::setStatusVisible(bool visible) {
|
void pWindow::setStatusVisible(bool visible) {
|
||||||
|
@autoreleasepool {
|
||||||
|
[[cocoaWindow statusBar] setHidden:!visible];
|
||||||
|
setGeometry(geometry());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pWindow::setTitle(const string &text) {
|
void pWindow::setTitle(const string &text) {
|
||||||
@ -271,12 +303,8 @@ void pWindow::setTitle(const string &text) {
|
|||||||
|
|
||||||
void pWindow::setVisible(bool visible) {
|
void pWindow::setVisible(bool visible) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
if(visible) {
|
if(visible) [cocoaWindow makeKeyAndOrderFront:nil];
|
||||||
[cocoaWindow makeKeyAndOrderFront:nil];
|
else [cocoaWindow orderOut:nil];
|
||||||
[cocoaWindow setLevel:NSNormalWindowLevel];
|
|
||||||
} else {
|
|
||||||
[cocoaWindow orderOut:nil];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,9 +348,24 @@ void pWindow::sizeEvent() {
|
|||||||
layout.setGeometry(geometry);
|
layout.setGeometry(geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
statusBarReposition();
|
||||||
|
|
||||||
if(locked == false) {
|
if(locked == false) {
|
||||||
if(window.onSize) window.onSize();
|
if(window.onSize) window.onSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned pWindow::statusBarHeight() {
|
||||||
|
if(!window.state.statusVisible) return 0;
|
||||||
|
return Font::size(window.state.statusFont, " ").height + 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pWindow::statusBarReposition() {
|
||||||
|
@autoreleasepool {
|
||||||
|
NSRect area = [cocoaWindow contentRectForFrameRect:[cocoaWindow frame]];
|
||||||
|
[[cocoaWindow statusBar] setFrame:NSMakeRect(0, 0, area.size.width, statusBarHeight())];
|
||||||
|
[[cocoaWindow contentView] setNeedsDisplay:YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,25 +3,27 @@
|
|||||||
phoenix::Window *window;
|
phoenix::Window *window;
|
||||||
NSMenu *menuBar;
|
NSMenu *menuBar;
|
||||||
NSMenu *rootMenu;
|
NSMenu *rootMenu;
|
||||||
|
NSTextField *statusBar;
|
||||||
}
|
}
|
||||||
-(id) initWith :(phoenix::Window&)window;
|
-(id) initWith:(phoenix::Window&)window;
|
||||||
-(BOOL) canBecomeKeyWindow;
|
-(BOOL) canBecomeKeyWindow;
|
||||||
-(BOOL) canBecomeMainWindow;
|
-(BOOL) canBecomeMainWindow;
|
||||||
-(void) windowDidBecomeMain :(NSNotification*)notification;
|
-(void) windowDidBecomeMain:(NSNotification*)notification;
|
||||||
-(void) windowDidMove :(NSNotification*)notification;
|
-(void) windowDidMove:(NSNotification*)notification;
|
||||||
-(void) windowDidResize :(NSNotification*)notification;
|
-(void) windowDidResize:(NSNotification*)notification;
|
||||||
-(BOOL) windowShouldClose :(id)sender;
|
-(BOOL) windowShouldClose:(id)sender;
|
||||||
-(NSMenu*) menuBar;
|
-(NSMenu*) menuBar;
|
||||||
-(void) menuAbout;
|
-(void) menuAbout;
|
||||||
-(void) menuPreferences;
|
-(void) menuPreferences;
|
||||||
-(void) menuQuit;
|
-(void) menuQuit;
|
||||||
|
-(NSTextField*) statusBar;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
namespace phoenix {
|
namespace phoenix {
|
||||||
|
|
||||||
struct pWindow : public pObject {
|
struct pWindow : public pObject {
|
||||||
Window &window;
|
Window &window;
|
||||||
CocoaWindow *cocoaWindow;
|
CocoaWindow *cocoaWindow = nullptr;
|
||||||
|
|
||||||
static Window& none();
|
static Window& none();
|
||||||
|
|
||||||
@ -55,6 +57,8 @@ struct pWindow : public pObject {
|
|||||||
void destructor();
|
void destructor();
|
||||||
void moveEvent();
|
void moveEvent();
|
||||||
void sizeEvent();
|
void sizeEvent();
|
||||||
|
unsigned statusBarHeight();
|
||||||
|
void statusBarReposition();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,11 +37,12 @@ namespace phoenix {
|
|||||||
//Application
|
//Application
|
||||||
//===========
|
//===========
|
||||||
|
|
||||||
nall::function<void ()> Application::main;
|
function<void ()> Application::main;
|
||||||
|
|
||||||
nall::function<void ()> Application::Cocoa::onAbout;
|
function<void ()> Application::Cocoa::onAbout;
|
||||||
nall::function<void ()> Application::Cocoa::onPreferences;
|
function<void ()> Application::Cocoa::onActivate;
|
||||||
nall::function<void ()> Application::Cocoa::onQuit;
|
function<void ()> Application::Cocoa::onPreferences;
|
||||||
|
function<void ()> Application::Cocoa::onQuit;
|
||||||
|
|
||||||
void Application::run() {
|
void Application::run() {
|
||||||
return pApplication::run();
|
return pApplication::run();
|
||||||
|
@ -65,6 +65,7 @@ struct Application {
|
|||||||
|
|
||||||
struct Cocoa {
|
struct Cocoa {
|
||||||
static nall::function<void ()> onAbout;
|
static nall::function<void ()> onAbout;
|
||||||
|
static nall::function<void ()> onActivate;
|
||||||
static nall::function<void ()> onPreferences;
|
static nall::function<void ()> onPreferences;
|
||||||
static nall::function<void ()> onQuit;
|
static nall::function<void ()> onQuit;
|
||||||
};
|
};
|
||||||
|
@ -9,4 +9,7 @@ void pAction::setVisible(bool visible) {
|
|||||||
void pAction::constructor() {
|
void pAction::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pAction::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ struct pAction : public pObject {
|
|||||||
|
|
||||||
pAction(Action &action) : pObject(action), action(action) {}
|
pAction(Action &action) : pObject(action), action(action) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
9
higan/phoenix/reference/object.cpp
Normal file
9
higan/phoenix/reference/object.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace phoenix {
|
||||||
|
|
||||||
|
void pObject::constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void pObject::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -7,8 +7,8 @@ struct pObject {
|
|||||||
pObject(Object &object) : object(object), locked(locked) {}
|
pObject(Object &object) : object(object), locked(locked) {}
|
||||||
virtual ~pObject() {}
|
virtual ~pObject() {}
|
||||||
|
|
||||||
void constructor() {}
|
void constructor();
|
||||||
void destructor() {}
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#include "platform.hpp"
|
#include "platform.hpp"
|
||||||
|
|
||||||
|
#include "font.cpp"
|
||||||
#include "desktop.cpp"
|
#include "desktop.cpp"
|
||||||
#include "keyboard.cpp"
|
#include "keyboard.cpp"
|
||||||
#include "mouse.cpp"
|
#include "mouse.cpp"
|
||||||
#include "browser-window.cpp"
|
#include "browser-window.cpp"
|
||||||
#include "message-window.cpp"
|
#include "message-window.cpp"
|
||||||
#include "font.cpp"
|
#include "object.cpp"
|
||||||
#include "timer.cpp"
|
#include "timer.cpp"
|
||||||
#include "window.cpp"
|
#include "window.cpp"
|
||||||
|
|
||||||
|
@ -9,4 +9,7 @@ void pTimer::setInterval(unsigned milliseconds) {
|
|||||||
void pTimer::constructor() {
|
void pTimer::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pTimer::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ struct pTimer : public pObject {
|
|||||||
|
|
||||||
pTimer(Timer &timer) : pObject(timer), timer(timer) {}
|
pTimer(Timer &timer) : pObject(timer), timer(timer) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,4 +9,7 @@ void pButton::setText(const string &text) {
|
|||||||
void pButton::constructor() {
|
void pButton::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pButton::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ struct pButton : public pWidget {
|
|||||||
|
|
||||||
pButton(Button &button) : pWidget(button), button(button) {}
|
pButton(Button &button) : pWidget(button), button(button) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,4 +9,7 @@ void pCanvas::update() {
|
|||||||
void pCanvas::constructor() {
|
void pCanvas::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pCanvas::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ struct pCanvas : public pWidget {
|
|||||||
|
|
||||||
pCanvas(Canvas &canvas) : pWidget(canvas), canvas(canvas) {}
|
pCanvas(Canvas &canvas) : pWidget(canvas), canvas(canvas) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,7 @@ void pCheckButton::setText(const string &text) {
|
|||||||
void pCheckButton::constructor() {
|
void pCheckButton::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pCheckButton::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ struct pCheckButton : public pWidget {
|
|||||||
|
|
||||||
pCheckButton(CheckButton &checkButton) : pWidget(checkButton), checkButton(checkButton) {}
|
pCheckButton(CheckButton &checkButton) : pWidget(checkButton), checkButton(checkButton) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,4 +22,7 @@ void pComboButton::setSelection(unsigned row) {
|
|||||||
void pComboButton::constructor() {
|
void pComboButton::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pComboButton::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ struct pComboButton : public pWidget {
|
|||||||
|
|
||||||
pComboButton(ComboButton &comboButton) : pWidget(comboButton), comboButton(comboButton) {}
|
pComboButton(ComboButton &comboButton) : pWidget(comboButton), comboButton(comboButton) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,7 @@ void pHexEdit::update() {
|
|||||||
void pHexEdit::constructor() {
|
void pHexEdit::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pHexEdit::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ struct pHexEdit : public pWidget {
|
|||||||
|
|
||||||
pHexEdit(HexEdit &hexEdit) : pWidget(hexEdit), hexEdit(hexEdit) {}
|
pHexEdit(HexEdit &hexEdit) : pWidget(hexEdit), hexEdit(hexEdit) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,7 @@ void pHorizontalScroller::setPosition(unsigned position) {
|
|||||||
void pHorizontalScroller::constructor() {
|
void pHorizontalScroller::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pHorizontalScroller::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ struct pHorizontalScroller : public pWidget {
|
|||||||
|
|
||||||
pHorizontalScroller(HorizontalScroller &horizontalScroller) : pWidget(horizontalScroller), horizontalScroller(horizontalScroller) {}
|
pHorizontalScroller(HorizontalScroller &horizontalScroller) : pWidget(horizontalScroller), horizontalScroller(horizontalScroller) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,7 @@ void pHorizontalSlider::setPosition(unsigned position) {
|
|||||||
void pHorizontalSlider::constructor() {
|
void pHorizontalSlider::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pHorizontalSlider::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ struct pHorizontalSlider : public pWidget {
|
|||||||
|
|
||||||
pHorizontalSlider(HorizontalSlider &horizontalSlider) : pWidget(horizontalSlider), horizontalSlider(horizontalSlider) {}
|
pHorizontalSlider(HorizontalSlider &horizontalSlider) : pWidget(horizontalSlider), horizontalSlider(horizontalSlider) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,7 @@ void pLabel::setText(const string &text) {
|
|||||||
void pLabel::constructor() {
|
void pLabel::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pLabel::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ struct pLabel : public pWidget {
|
|||||||
|
|
||||||
pLabel(Label &label) : pWidget(label), label(label) {}
|
pLabel(Label &label) : pWidget(label), label(label) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,4 +12,7 @@ string pLineEdit::text() {
|
|||||||
void pLineEdit::constructor() {
|
void pLineEdit::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pLineEdit::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ struct pLineEdit : public pWidget {
|
|||||||
|
|
||||||
pLineEdit(LineEdit &lineEdit) : pWidget(lineEdit), lineEdit(lineEdit) {}
|
pLineEdit(LineEdit &lineEdit) : pWidget(lineEdit), lineEdit(lineEdit) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,4 +50,7 @@ void pListView::setSelection(unsigned row) {
|
|||||||
void pListView::constructor() {
|
void pListView::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pListView::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ struct pListView : public pWidget {
|
|||||||
|
|
||||||
pListView(ListView &listView) : pWidget(listView), listView(listView) {}
|
pListView(ListView &listView) : pWidget(listView), listView(listView) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,7 @@ void pProgressBar::setPosition(unsigned position) {
|
|||||||
void pProgressBar::constructor() {
|
void pProgressBar::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pProgressBar::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ struct pProgressBar : public pWidget {
|
|||||||
|
|
||||||
pProgressBar(ProgressBar &progressBar) : pWidget(progressBar), progressBar(progressBar) {}
|
pProgressBar(ProgressBar &progressBar) : pWidget(progressBar), progressBar(progressBar) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,4 +16,7 @@ void pRadioButton::setText(const string &text) {
|
|||||||
void pRadioButton::constructor() {
|
void pRadioButton::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pRadioButton::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ struct pRadioButton : public pWidget {
|
|||||||
|
|
||||||
pRadioButton(RadioButton &radioButton) : pWidget(radioButton), radioButton(radioButton) {}
|
pRadioButton(RadioButton &radioButton) : pWidget(radioButton), radioButton(radioButton) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,7 @@ string pTextEdit::text() {
|
|||||||
void pTextEdit::constructor() {
|
void pTextEdit::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pTextEdit::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ struct pTextEdit : public pWidget {
|
|||||||
|
|
||||||
pTextEdit(TextEdit &textEdit) : pWidget(textEdit), textEdit(textEdit) {}
|
pTextEdit(TextEdit &textEdit) : pWidget(textEdit), textEdit(textEdit) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,7 @@ void pVerticalScroller::setPosition(unsigned position) {
|
|||||||
void pVerticalScroller::constructor() {
|
void pVerticalScroller::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pVerticalScroller::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ struct pVerticalScroller : public pWidget {
|
|||||||
|
|
||||||
pVerticalScroller(VerticalScroller &verticalScroller) : pWidget(verticalScroller), verticalScroller(verticalScroller) {}
|
pVerticalScroller(VerticalScroller &verticalScroller) : pWidget(verticalScroller), verticalScroller(verticalScroller) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,7 @@ void pVerticalSlider::setPosition(unsigned position) {
|
|||||||
void pVerticalSlider::constructor() {
|
void pVerticalSlider::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pVerticalSlider::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ struct pVerticalSlider : public pWidget {
|
|||||||
|
|
||||||
pVerticalSlider(VerticalSlider &verticalSlider) : pWidget(verticalSlider), verticalSlider(verticalSlider) {}
|
pVerticalSlider(VerticalSlider &verticalSlider) : pWidget(verticalSlider), verticalSlider(verticalSlider) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,4 +7,7 @@ uintptr_t pViewport::handle() {
|
|||||||
void pViewport::constructor() {
|
void pViewport::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pViewport::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ struct pViewport : public pWidget {
|
|||||||
|
|
||||||
pViewport(Viewport &viewport) : pWidget(viewport), viewport(viewport) {}
|
pViewport(Viewport &viewport) : pWidget(viewport), viewport(viewport) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,7 @@ void pWidget::setVisible(bool visible) {
|
|||||||
void pWidget::constructor() {
|
void pWidget::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pWidget::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ struct pWidget : public pSizable {
|
|||||||
|
|
||||||
pWidget(Widget &widget) : pSizable(widget), widget(widget) {}
|
pWidget(Widget &widget) : pSizable(widget), widget(widget) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,4 +85,7 @@ void pWindow::setWidgetFont(const string &font) {
|
|||||||
void pWindow::constructor() {
|
void pWindow::constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pWindow::destructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ struct pWindow : public pObject {
|
|||||||
|
|
||||||
pWindow(Window &window) : pObject(window), window(window) {}
|
pWindow(Window &window) : pObject(window), window(window) {}
|
||||||
void constructor();
|
void constructor();
|
||||||
|
void destructor();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,22 @@
|
|||||||
#include "opengl.hpp"
|
#include "opengl.hpp"
|
||||||
|
|
||||||
|
namespace ruby {
|
||||||
|
class pVideoCGL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@interface RubyVideoCGL : NSOpenGLView {
|
||||||
|
@public
|
||||||
|
ruby::pVideoCGL *video;
|
||||||
|
}
|
||||||
|
-(id) initWith:(ruby::pVideoCGL*)video pixelFormat:(NSOpenGLPixelFormat*)pixelFormat;
|
||||||
|
-(void) reshape;
|
||||||
|
@end
|
||||||
|
|
||||||
namespace ruby {
|
namespace ruby {
|
||||||
|
|
||||||
class pVideoCGL : public OpenGL {
|
class pVideoCGL : public OpenGL {
|
||||||
public:
|
public:
|
||||||
NSOpenGLView *view;
|
RubyVideoCGL *view;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
NSView *handle;
|
NSView *handle;
|
||||||
@ -121,8 +133,8 @@ public:
|
|||||||
|
|
||||||
auto size = [settings.handle frame].size;
|
auto size = [settings.handle frame].size;
|
||||||
auto format = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease];
|
auto format = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease];
|
||||||
view = [[NSOpenGLView alloc] initWithFrame:NSMakeRect(0, 0, 0, 0) pixelFormat:format];
|
|
||||||
|
|
||||||
|
view = [[RubyVideoCGL alloc] initWith:this pixelFormat:format];
|
||||||
[view setFrame:NSMakeRect(0, 0, size.width, size.height)];
|
[view setFrame:NSMakeRect(0, 0, size.width, size.height)];
|
||||||
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||||
[settings.handle addSubview:view];
|
[settings.handle addSubview:view];
|
||||||
@ -140,6 +152,7 @@ public:
|
|||||||
[view unlockFocus];
|
[view unlockFocus];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,3 +185,18 @@ public:
|
|||||||
DeclareVideo(CGL)
|
DeclareVideo(CGL)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@implementation RubyVideoCGL : NSOpenGLView
|
||||||
|
|
||||||
|
-(id) initWith:(ruby::pVideoCGL*)videoPointer pixelFormat:(NSOpenGLPixelFormat*)pixelFormat {
|
||||||
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0) pixelFormat:pixelFormat]) {
|
||||||
|
video = videoPointer;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) reshape {
|
||||||
|
video->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
namespace Info {
|
|
||||||
static const char Profile[] = "Accuracy";
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <sfc/cpu/cpu.hpp>
|
#include <sfc/cpu/cpu.hpp>
|
||||||
#include <sfc/smp/smp.hpp>
|
#include <sfc/smp/smp.hpp>
|
||||||
#include <sfc/dsp/dsp.hpp>
|
#include <sfc/dsp/dsp.hpp>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user