Skip to content

Instantly share code, notes, and snippets.

View saikat's full-sized avatar

Saikat Chakrabarti saikat

View GitHub Profile
@import <AppKit/CPView.j>
var CPTextFieldBlurFunction = nil;
// Code extended from code at http://gist.github.com/9848
@implementation CPTextView : CPView
{
DOMElement FIXME_textArea;
@import <AppKit/CPView.j>
var CPTextFieldBlurFunction = nil;
// Code extended from code at http://gist.github.com/9848
@implementation CPTextView : CPView
{
DOMElement FIXME_textArea;
var progressIndicator = [[CPProgressIndicator alloc]
initWithFrame:CGRectMake(0, 0, 64, 64)];
[progressIndicator setStyle:CPProgressIndicatorSpinningStyle];
[progressIndicator setControlSize:CPRegularControlSize];
[progressIndicator startAnimation:self];
[progressIndicator setIndeterminate:YES];
/*
* AppController.j
* NewApplication
*
* Created by You on July 5, 2009.
* Copyright 2009, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@import <AppKit/CPView.j>
var CPTextFieldBlurFunction = nil;
// Code extended from code at http://gist.github.com/9848
// TODO there is a huge hack to keep the control text did end editing notification from firing
// when you click on the scroll bar. This spans into the sendEvent for MBWindow.j
@implementation CPTextViewScroller : CPScroller
{
- (void)sendEvent:(CPEvent)anEvent
{
var type = [anEvent type],
point = [anEvent locationInWindow],
currentFirstResponder = [self firstResponder];
[super sendEvent:anEvent];
if (type == CPLeftMouseDown &&
[currentFirstResponder class] == [CPTextViewScroller class] &&
[[self firstResponder] class] == [CPTextViewScroller class]) {
if ([_leftMouseDownView class] !== [CPTextViewScroller class])
@import <AppKit/CPWindow.j>
var IsChangingFirstResponder = NO,
CurrentFirstResponder = nil;
@implementation MBWindow : CPWindow
{ }
// TODO this is a huge hack to basically get text view to work and not exit when
// you click on its scroll bar
+ (void)bootstrap
{
#if PLATFORM(DOM)
var body = document.getElementsByTagName("body")[0];
// Hack to keep white screen from appearing
body.innerHTML = "<div id=\"Loading\" style=\" background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;\"><div style=\"margin:auto auto; width: 440px; padding: 10px 25px 10px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; top: 50px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555\"><p style=\"line-height: 1.4em;\">Just a few more seconds while we initialize everything...</p></div></div>"; // Get rid of anything that might be lingering in the body element.
body.style.overflow = "hidden";
if (document.documentElement)
document.documentElement.style.overflow = "hidden";
//Menu creation code
- (void)applicationWillFinishLaunching:(CPNotification)aNotification
{
// Create menu bar
var menuBackground = [CPColor
colorWithPatternImage:[[CPImage alloc]
initWithContentsOfFile:"Resources/menubar.png"
size:CGSizeMake(1.0, 29.0)]],
menu = [[CPMenu alloc] initWithTitle:@"Menu"];
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];