Skip to content

Commit

Permalink
fixes for dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Haynie committed Jul 25, 2010
1 parent 6aa9110 commit d5f011e
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 21 deletions.
Expand Up @@ -23,7 +23,7 @@ for (var c=0;c<10;c++)
{
Ti.API.info("button click on row. index = "+e.index+", row = "+e.source.row+", section = "+e.source.section+",rightButton = "+rightButton);
});
var row = Ti.UI.createTableViewRow({height:'auto'});
var row = Ti.UI.createTableViewRow({height:'auto',className:'row'});
row.add(label);
row.add(rightButton);
data[c].add(row);
Expand Down
Expand Up @@ -10,7 +10,7 @@ var data = [];

for (var i=0;i<50;i++)
{
var row = Ti.UI.createTableViewRow({height:'auto'});
var row = Ti.UI.createTableViewRow({height:'auto',className:"row"});

var textView = Ti.UI.createView({
height:'auto',
Expand Down
26 changes: 23 additions & 3 deletions iphone/Classes/LauncherButton.m
Expand Up @@ -32,6 +32,8 @@
#import <QuartzCore/QuartzCore.h>
#import "LauncherButton.h"
#import "LauncherItem.h"
#import "TiUtils.h"
#import "TiUIView.h"


@implementation LauncherButton
Expand All @@ -56,6 +58,15 @@ -(void)dealloc
[super dealloc];
}

-(void)setFrame:(CGRect)frame
{
[super setFrame:frame];
if (item.view!=nil)
{
[(TiUIView*)item.view relayout:self.bounds];
}
}

-(void)setItem:(LauncherItem *)item_
{
if (item!=nil)
Expand All @@ -69,10 +80,19 @@ -(void)setItem:(LauncherItem *)item_
{
item = [item_ retain];
item.button = self;
[self setImage:item.image forState:UIControlStateNormal];
if (item.selectedImage!=nil)

if (item.view!=nil)
{
[self setImage:item.selectedImage forState:UIControlStateHighlighted];
item.view.userInteractionEnabled = NO;
[self addSubview:item.view];
}
else
{
[self setImage:item.image forState:UIControlStateNormal];
if (item.selectedImage!=nil)
{
[self setImage:item.selectedImage forState:UIControlStateHighlighted];
}
}
}
[self setNeedsLayout];
Expand Down
4 changes: 3 additions & 1 deletion iphone/Classes/LauncherItem.h
Expand Up @@ -40,15 +40,17 @@
NSInteger badgeValue;
BOOL canDelete;
LauncherButton *button;

UIView *view;
id userData;
}

@property(nonatomic,readwrite,retain) NSString *title;
@property(nonatomic,readwrite,retain) UIImage *image;
@property(nonatomic,readwrite,retain) UIImage *selectedImage;
@property(nonatomic,readwrite,retain) UIView *view;
@property(nonatomic,assign) LauncherButton *button;


@property(nonatomic,readwrite,retain) id userData;


Expand Down
10 changes: 9 additions & 1 deletion iphone/Classes/LauncherItem.m
Expand Up @@ -35,7 +35,7 @@

@implementation LauncherItem

@synthesize title, canDelete, badgeValue, image, selectedImage, button, userData;
@synthesize title, canDelete, badgeValue, image, selectedImage, button, userData, view;

-(id)init
{
Expand All @@ -53,6 +53,7 @@ -(void)dealloc
[image release];
[selectedImage release];
[userData release];
[view release];
[super dealloc];
}

Expand Down Expand Up @@ -90,6 +91,13 @@ -(void)setButton:(LauncherButton *)button_
[self repaint];
}

-(void)setView:(UIView*)view_
{
[view release];
view = [view_ retain];
[self repaint];
}


@end

Expand Down
19 changes: 19 additions & 0 deletions iphone/Classes/TiUIDashboardItem.h
@@ -0,0 +1,19 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#ifdef USE_TI_UIDASHBOARDVIEW

#import "TiUIView.h"

@interface TiUIDashboardItem : TiUIView {

@private

}

@end

#endif
16 changes: 16 additions & 0 deletions iphone/Classes/TiUIDashboardItem.m
@@ -0,0 +1,16 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#ifdef USE_TI_UIDASHBOARDVIEW

#import "TiUIDashboardItem.h"
#import "TiUtils.h"

@implementation TiUIDashboardItem

@end

#endif
4 changes: 2 additions & 2 deletions iphone/Classes/TiUIDashboardItemProxy.h
Expand Up @@ -6,10 +6,10 @@
*/
#ifdef USE_TI_UIDASHBOARDVIEW

#import "TiProxy.h"
#import "TiViewProxy.h"
#import "LauncherItem.h"

@interface TiUIDashboardItemProxy : TiProxy {
@interface TiUIDashboardItemProxy : TiViewProxy {
@private
LauncherItem *item;
}
Expand Down
16 changes: 16 additions & 0 deletions iphone/Classes/TiUIDashboardItemProxy.m
Expand Up @@ -64,6 +64,22 @@ -(void)setCanDelete:(id)value
[[self ensureItem] setCanDelete:canDelete];
}

#pragma mark internal

-(void)add:(id)child
{
[super add:child];

// called when we have a child, which means we want to use ourself
// as the view
LauncherItem *item_ = [self ensureItem];
if (item_.view==nil)
{
[item_ setView:[self view]];
}
}


@end

#endif
1 change: 0 additions & 1 deletion iphone/Classes/TiUIDashboardView.h
Expand Up @@ -12,7 +12,6 @@
@interface TiUIDashboardView : TiUIView<LauncherViewDelegate> {

@private
UIView *wrapper;
LauncherView *launcher;

}
Expand Down
10 changes: 3 additions & 7 deletions iphone/Classes/TiUIDashboardView.m
Expand Up @@ -19,22 +19,18 @@ @implementation TiUIDashboardView

-(void)dealloc
{
launcher.delegate = nil;
RELEASE_TO_NIL(launcher);
[super dealloc];
}

-(LauncherView*)launcher
{
if (wrapper==nil)
{
wrapper = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[self addSubview:wrapper];
}
if (launcher==nil)
{
launcher = [[LauncherView alloc] initWithFrame:CGRectMake(0, 0, 320, 400)];
launcher.delegate = self;
[wrapper addSubview:launcher];
[self addSubview:launcher];
}
return launcher;
}
Expand All @@ -43,7 +39,7 @@ -(void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds
{
if (!CGRectIsEmpty(bounds))
{
[TiUtils setView:wrapper positionRect:bounds];
[TiUtils setView:launcher positionRect:bounds];
}
}

Expand Down
8 changes: 4 additions & 4 deletions iphone/Classes/TiUIiPadPopoverProxy.m
Expand Up @@ -35,15 +35,15 @@ -(void)refreshTitleBarWithObject:(id)properties
}
ENSURE_UI_THREAD_1_ARG(properties);

BOOL animated = [TiUtils boolValue:@"animated" properties:properties def:YES];
BOOL animated_ = [TiUtils boolValue:@"animated" properties:properties def:YES];

UINavigationItem * ourItem = [viewController navigationItem];

[ourItem setTitle:[TiUtils stringValue:[self valueForKey:@"title"]]];
[ourItem setLeftBarButtonItem:[[self valueForKey:@"leftNavButton"] barButtonItem] animated:animated];
[ourItem setRightBarButtonItem:[[self valueForKey:@"rightNavButton"] barButtonItem] animated:animated];
[ourItem setLeftBarButtonItem:[[self valueForKey:@"leftNavButton"] barButtonItem] animated:animated_];
[ourItem setRightBarButtonItem:[[self valueForKey:@"rightNavButton"] barButtonItem] animated:animated_];

[[self navigationController] setNavigationBarHidden:[TiUtils boolValue:[self valueForKey:@"navBarHidden"]] animated:animated];
[[self navigationController] setNavigationBarHidden:[TiUtils boolValue:[self valueForKey:@"navBarHidden"]] animated:animated_];

}

Expand Down
8 changes: 8 additions & 0 deletions iphone/iphone/Titanium.xcodeproj/project.pbxproj
Expand Up @@ -23,6 +23,8 @@
242E989A11BAF7DB0046A0D0 /* TiDebuggerCallFrame.mm in Sources */ = {isa = PBXBuildFile; fileRef = 242E989911BAF7DB0046A0D0 /* TiDebuggerCallFrame.mm */; };
242E989B11BAF7DB0046A0D0 /* TiDebuggerCallFrame.mm in Sources */ = {isa = PBXBuildFile; fileRef = 242E989911BAF7DB0046A0D0 /* TiDebuggerCallFrame.mm */; };
242EA11611BD956F0046A0D0 /* ExternalAccessory.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 242EA11511BD956F0046A0D0 /* ExternalAccessory.framework */; };
243AAFB511FCE62600E37D8B /* TiUIDashboardItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 243AAFB411FCE62600E37D8B /* TiUIDashboardItem.m */; };
243AAFB611FCE62600E37D8B /* TiUIDashboardItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 243AAFB411FCE62600E37D8B /* TiUIDashboardItem.m */; };
243ECCAA1126981C00639DF4 /* TiUITableViewSectionProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 243EC5EA112617F900639DF4 /* TiUITableViewSectionProxy.m */; };
243ECCAB1126981C00639DF4 /* TiUITableViewStyleProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 243EC9691126632700639DF4 /* TiUITableViewStyleProxy.m */; };
243ECCAC1126981C00639DF4 /* TiUITableViewSeparatorStyleProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 243ECB2411267CC100639DF4 /* TiUITableViewSeparatorStyleProxy.m */; };
Expand Down Expand Up @@ -552,6 +554,8 @@
242E989811BAF7DB0046A0D0 /* TiDebuggerCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiDebuggerCallFrame.h; path = ../Classes/TiDebuggerCallFrame.h; sourceTree = SOURCE_ROOT; };
242E989911BAF7DB0046A0D0 /* TiDebuggerCallFrame.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TiDebuggerCallFrame.mm; path = ../Classes/TiDebuggerCallFrame.mm; sourceTree = SOURCE_ROOT; };
242EA11511BD956F0046A0D0 /* ExternalAccessory.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExternalAccessory.framework; path = System/Library/Frameworks/ExternalAccessory.framework; sourceTree = SDKROOT; };
243AAFB311FCE62500E37D8B /* TiUIDashboardItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiUIDashboardItem.h; sourceTree = "<group>"; };
243AAFB411FCE62600E37D8B /* TiUIDashboardItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TiUIDashboardItem.m; sourceTree = "<group>"; };
243EC5E9112617F900639DF4 /* TiUITableViewSectionProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiUITableViewSectionProxy.h; sourceTree = "<group>"; };
243EC5EA112617F900639DF4 /* TiUITableViewSectionProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TiUITableViewSectionProxy.m; sourceTree = "<group>"; };
243EC7D5112634AF00639DF4 /* TiUITableViewAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiUITableViewAction.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2126,6 +2130,8 @@
24E50E2A116066B400AF54AF /* TiUIDashboardView.m */,
24E50F8A1160792D00AF54AF /* TiUIDashboardItemProxy.h */,
24E50F8B1160792D00AF54AF /* TiUIDashboardItemProxy.m */,
243AAFB311FCE62500E37D8B /* TiUIDashboardItem.h */,
243AAFB411FCE62600E37D8B /* TiUIDashboardItem.m */,
);
name = Dashboard;
sourceTree = "<group>";
Expand Down Expand Up @@ -2673,6 +2679,7 @@
24F1591E11D7356D000DD736 /* TiMapRouteAnnotationView.m in Sources */,
2467310811E2549300D39AF7 /* Webcolor.m in Sources */,
2465592411E5862F0059BBF4 /* TiFilesystemBlobProxy.m in Sources */,
243AAFB511FCE62600E37D8B /* TiUIDashboardItem.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -2917,6 +2924,7 @@
24F1591D11D7356D000DD736 /* TiMapRouteAnnotationView.m in Sources */,
2467310711E2549300D39AF7 /* Webcolor.m in Sources */,
2465592511E5862F0059BBF4 /* TiFilesystemBlobProxy.m in Sources */,
243AAFB611FCE62600E37D8B /* TiUIDashboardItem.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down

0 comments on commit d5f011e

Please sign in to comment.