<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -108,13 +108,30 @@ TitaniumViewController * mostRecentController = nil;
 	[super setView:newView];
 	if (newView == nil) {
 		[self setContentView:nil];
-		[self setWebView:nil];
 	}
 }
 
 //- (void) setContentView: (UIView *) newContentView;
 //{
-//	[super setContentView:newContentView];
+//	if (newContentView == contentView) return;
+//	if (contentView == nil){
+//		contentView = [newContentView retain];
+//		return;
+//	}
+//	
+//	if (newContentView == nil){
+//		[self setWebView:nil];
+//		if((webView == nil) || ([[contentView subviews] count] &lt;= 1)){ //Okay, clear on out!
+//			[contentView removeFromSuperview];
+//			[contentView release];
+//			contentView = nil;
+//		}
+//		return;
+//	}
+//	
+//	[[newContentView superview] insertSubview:contentView belowSubview:newContentView];
+//	[contentView setFrame:[newContentView frame]];
+//	[newContentView removeFromSuperview];
 //}
 
 </diff>
      <filename>iphone/Classes/TitaniumWebViewController.m</filename>
    </modified>
    <modified>
      <diff>@@ -94,18 +94,16 @@
 
 	};
 	
-	
+	twitpicer = function(){
 Titanium.Media.openPhotoGallery({
 	success: function(image,details) {
-		var query = 'http://twitpic.com/api/uploadAndPost?password=rogue10&amp;username=kevinwhinnery';
-    var xhr = Titanium.Network.createHTTPClient();
+		var query = 'http://twitpic.com/api/uploadAndPost';
+		var xhr = Titanium.Network.createHTTPClient();
 		xhr.onreadystatechange = function() {
-      if (this.readyState == 4) {
-				Titanium.API.debug(this.responseText);
-			}
+			document.getElementById('twitpicresults').innerHTML = 'State: ' + this.readyState + '&lt;br&gt;Message: ' + this.responseText;
 		};
 		xhr.open('POST',query);
-		xhr.send({media:image});
+		xhr.send({media:image,username:'blainhamon',password:'tweetme',message:'Testing uploading'});
 		//Titanium.Platform.openURL($(this).attr(&quot;href&quot;));
 	},
 	error: function(error) {
@@ -117,10 +115,15 @@ Titanium.Media.openPhotoGallery({
 	},
 	cancel: function() {
 		//no op
+		Titanium.UI.createAlertDialog( {
+			title: &quot;Cancel from Gallery&quot;,
+			message: '',
+			buttonNames: OK
+			}).show();
 	},
 	allowImageEditing:true
 });
-
+}
 	
 	
 	
@@ -161,6 +164,9 @@ Titanium.Media.openPhotoGallery({
 &lt;div id='echo'&gt;
 &lt;/div&gt;
 
+&lt;button onclick=&quot;twitpicer()&quot;&gt;Tweet?&lt;/button&gt;
+&lt;div id='twitpicresults'&gt;Message?&lt;/div&gt;
+
 &lt;!--
 &lt;div class=&quot;test&quot;&gt;
 	&lt;h2&gt;Titanium.Media.createSound()&lt;/h2&gt;</diff>
      <filename>iphone/Resources/network.html</filename>
    </modified>
    <modified>
      <diff>@@ -173,8 +173,13 @@ try{
 		btn8.addEventListener('click',test2);
 //		test2();
 
+		var multiBtn = Ti.UI.createButtonBar({labels:['fee','fi','fo','fum']});
+		function reportEvent(e){Titanium.UI.createAlertDialog({title:&quot;Thing happened!&quot;,message:&quot;You clicked &quot;+e.value}).show();};
+		multiBtn.addEventListener('click',reportEvent);
+
 		Ti.UI.currentWindow.setLeftNavButton(btn8);
-		Ti.UI.currentWindow.setToolbar([btn1,btn2,btn3,btn4,btn5,btn7]);
+//		Ti.UI.currentWindow.setToolbar([btn1,btn2,btn3,btn4,btn5,btn7]);
+		Ti.UI.currentWindow.setToolbar([btn1,btn2,multiBtn]);
 		
 		Titanium.Gesture.addEventListener('shake',function(){
 			var alerty = Titanium.UI.createAlertDialog();</diff>
      <filename>iphone/Resources/ui.html</filename>
    </modified>
    <modified>
      <diff>@@ -27,7 +27,11 @@
 	
 	//Tinting or BG controls
 	UIColor * elementColor;
-	UIColor * elementBackgroundColor;	
+	UIColor * elementBackgroundColor;
+	
+	//For Multibutton/segmented
+	NSArray * segmentLabelArray;
+	NSArray * segmentImageArray;
 
 	//Yes, even integer and bools are represented as floats.
 	float minValue;		//Default is 0
@@ -49,6 +53,9 @@
 @property(nonatomic,readwrite,assign)	int templateValue;
 @property(nonatomic,readwrite,assign)	int barButtonStyle;
 
+@property(nonatomic,readwrite,copy)		NSArray * segmentLabelArray;
+@property(nonatomic,readwrite,copy)		NSArray * segmentImageArray;
+
 @property(nonatomic,readwrite,retain)	UILabel * labelView;
 @property(nonatomic,readwrite,retain)	UIProgressView * progressView;
 @property(nonatomic,readwrite,retain)	UIView * nativeView;</diff>
      <filename>iphone/modules/UiModule/UiModule.h</filename>
    </modified>
    <modified>
      <diff>@@ -37,7 +37,6 @@ enum { //MUST BE NEGATIVE, as it inhabits the same space as UIBarButtonSystemIte
 	UITitaniumNativeItemSlider = -4,
 	UITitaniumNativeItemSwitch = -5,
 	UITitaniumNativeItemMultiButton = -6,
-
 	UITitaniumNativeItemSegmented = -7,
 
 	UITitaniumNativeItemTextView = -8,
@@ -81,6 +80,8 @@ int barButtonSystemItemForString(NSString * inputString){
 				[NSNumber numberWithInt:UITitaniumNativeItemTextField],@&quot;text&quot;,
 				[NSNumber numberWithInt:UITitaniumNativeItemTextView],@&quot;textarea&quot;,
 				[NSNumber numberWithInt:UITitaniumNativeItemSearchBar],@&quot;search&quot;,
+				[NSNumber numberWithInt:UITitaniumNativeItemMultiButton],@&quot;multibutton&quot;,
+				[NSNumber numberWithInt:UITitaniumNativeItemSegmented],@&quot;segmented&quot;,
 				nil];
 	}
 	NSNumber * result = [barButtonSystemItemForStringDict objectForKey:[inputString lowercaseString]];
@@ -89,7 +90,7 @@ int barButtonSystemItemForString(NSString * inputString){
 }
 
 @implementation UIButtonProxy
-@synthesize nativeBarButton;
+@synthesize nativeBarButton, segmentLabelArray, segmentImageArray;
 @synthesize titleString, iconPath, templateValue, barButtonStyle, nativeView, labelView, progressView;
 @synthesize minValue,maxValue,floatValue,stringValue;
 
@@ -140,6 +141,22 @@ int barButtonSystemItemForString(NSString * inputString){
 		needsRefreshing = YES;
 	}
 
+	id labelArray = [newDict objectForKey:@&quot;labels&quot;];
+	if ([labelArray isKindOfClass:[NSArray class]]){
+		[self setSegmentLabelArray:labelArray];
+	} else if (labelArray == [NSNull null]){
+		[self setSegmentLabelArray:nil];
+	}
+
+	id imageArray = [newDict objectForKey:@&quot;images&quot;];
+	if ([imageArray isKindOfClass:[NSArray class]]){
+		[self setSegmentImageArray:imageArray];
+	} else if (imageArray == [NSNull null]) {
+		[self setSegmentImageArray:nil];
+	}
+
+	id bgColorObject = [newDict objectForKey:@&quot;backgroundColor&quot;];
+
 	GRAB_IF_SELECTOR(@&quot;width&quot;,floatValue,frame.size.width);
 	GRAB_IF_SELECTOR(@&quot;height&quot;,floatValue,frame.size.height);
 	GRAB_IF_SELECTOR(@&quot;x&quot;,floatValue,frame.origin.x);
@@ -165,7 +182,7 @@ int barButtonSystemItemForString(NSString * inputString){
 
 	CGRect viewFrame=frame;
 	if (forBar){
-		viewFrame.size.height = 40.0;
+		viewFrame.size.height = 30.0;
 	} else if (viewFrame.size.height &lt; 2) viewFrame.size.height = 20;
 	if (viewFrame.size.width &lt; 2) viewFrame.size.width = 30;
 
@@ -224,7 +241,62 @@ int barButtonSystemItemForString(NSString * inputString){
 			[(UITextView *)resultView setDelegate:self];
 		}
 		[(UITextView *)resultView setText:stringValue];
+
+	} else if ((templateValue == UITitaniumNativeItemMultiButton) || (templateValue == UITitaniumNativeItemSegmented)){
+//		if (forBar) viewFrame.size.height = 30;
+		int imageCount = [segmentImageArray count];
+		int titleCount = [segmentLabelArray count];
+		int segmentCount = MAX(imageCount,titleCount);
+		
+		TitaniumHost * theHost = [TitaniumHost sharedHost];
+		NSMutableArray * thingArray = [[NSMutableArray alloc] initWithCapacity:segmentCount];
+		for(int segmentIndex=0; segmentIndex &lt; segmentCount; segmentIndex ++){
+			UIImage * thisImage;
+			if(segmentIndex &lt; imageCount){
+				thisImage = [theHost imageForResource:[segmentImageArray objectAtIndex:segmentIndex]];
+			} else {
+				thisImage = nil;
+			}
+			
+			NSString * thisTitle;
+			if(segmentIndex &lt; titleCount){
+				thisTitle = [segmentLabelArray objectAtIndex:segmentIndex];
+			} else {
+				thisTitle = nil;
+			}
+			
+			if(thisImage != nil){
+				[thingArray addObject:thisImage];
+//				[(UISegmentedControl *)resultView insertSegmentWithImage:thisImage atIndex:segmentIndex animated:NO];
+			} else if ([thisTitle isKindOfClass:[NSString class]]){
+				[thingArray addObject:thisTitle];
+//				[(UISegmentedControl *)resultView insertSegmentWithTitle:thisTitle atIndex:segmentIndex animated:NO];
+			} else {
+				[thingArray addObject:@&quot;&quot;];
+//				[(UISegmentedControl *)resultView insertSegmentWithTitle:@&quot;&quot; atIndex:segmentIndex animated:NO];
+			}
+		}
 		
+		resultView = [[UISegmentedControl alloc] initWithItems:thingArray];
+		[thingArray release];
+		
+		[(UISegmentedControl *)resultView addTarget:self action:@selector(onSegmentChange:) forControlEvents:UIControlEventValueChanged];
+		
+//		if ([nativeView isKindOfClass:[UISegmentedControl class]]){
+//			resultView = [nativeView retain];
+//			[(UISegmentedControl *)resultView removeAllSegments];
+//		} else {
+//			resultView = [[UISegmentedControl alloc] initWithFrame:viewFrame];
+//			[(UISegmentedControl *)resultView addTarget:self action:@selector(onSegmentChange:) forControlEvents:UIControlEventValueChanged];
+//		}
+		[(UISegmentedControl *)resultView setMomentary:(templateValue == UITitaniumNativeItemMultiButton)];
+		[(UISegmentedControl *)resultView setSegmentedControlStyle:(forBar?UISegmentedControlStyleBar:UISegmentedControlStylePlain)];
+		if (elementBackgroundColor != nil) [(UISegmentedControl *)resultView setTintColor:elementBackgroundColor];
+
+		CGRect oldFrame = [resultView frame];
+		viewFrame.size.height = oldFrame.size.height;
+		if (viewFrame.size.width &lt; oldFrame.size.width) viewFrame.size.width = oldFrame.size.width;
+
 		
 //	} else if (templateValue == UITitaniumNativeItemPicker){
 //		if ([nativeView isKindOfClass:[UIPickerView class]]){
@@ -328,7 +400,7 @@ int barButtonSystemItemForString(NSString * inputString){
 - (IBAction) onSwitchChange: (id) sender;
 {
 	NSString * newValue = ([(UISwitch *)sender isOn] ? @&quot;true&quot;:@&quot;false&quot;);
-	NSString * handleClickCommand = [NSString stringWithFormat:@&quot;(function(){Titanium.UI._BTN.%@.onClick({type:'change',value:%@});}).call(Titanium.UI._BTN.%@);&quot;,token,newValue,token];
+	NSString * handleClickCommand = [NSString stringWithFormat:@&quot;(function(){Titanium.UI._BTN.%@.onClick({type:'click',value:%@});}).call(Titanium.UI._BTN.%@);&quot;,token,newValue,token];
 	[[TitaniumHost sharedHost] sendJavascript:handleClickCommand toPageWithToken:parentPageToken];
 }
 
@@ -351,7 +423,12 @@ int barButtonSystemItemForString(NSString * inputString){
 	[self onTextChange:textView];
 }
 
-
+- (IBAction) onSegmentChange: (id) sender;
+{
+	int newValue = [(UISegmentedControl *)sender selectedSegmentIndex];
+	NSString * handleClickCommand = [NSString stringWithFormat:@&quot;(function(){Titanium.UI._BTN.%@.onClick({type:'click',value:%d});}).call(Titanium.UI._BTN.%@);&quot;,token,newValue,token];
+	[[TitaniumHost sharedHost] sendJavascript:handleClickCommand toPageWithToken:parentPageToken];
+}
 
 - (IBAction) onValueChange: (id) sender;
 {
@@ -681,6 +758,15 @@ int barButtonSystemItemForString(NSString * inputString){
 	[ourVC performSelectorOnMainThread:@selector(setTitleViewImagePath:) withObject:newTitleImagePath waitUntilDone:NO];	
 }
 
+- (void) setWindow:(NSString *)tokenString titleButtonProxy: (id) newTitleButtonProxy;
+{
+	
+	
+//	TitaniumViewController * ourVC = [[TitaniumHost sharedHost] titaniumViewControllerForToken:tokenString];
+//	[ourVC performSelectorOnMainThread:@selector(setTitleViewImagePath:) withObject:newTitleImagePath waitUntilDone:NO];	
+}
+
+
 - (void) setWindow:(NSString *)tokenString showNavBar: (id) animatedObject;
 {
 	TitaniumViewController * ourVC = [[TitaniumHost sharedHost] titaniumViewControllerForToken:tokenString];
@@ -1010,6 +1096,7 @@ int barButtonSystemItemForString(NSString * inputString){
 			[TitaniumJSCode codeWithString:@&quot;function(args){return Ti.UI.createButton(args,'text');}&quot;],@&quot;createTextField&quot;,
 			[TitaniumJSCode codeWithString:@&quot;function(args){return Ti.UI.createButton(args,'textarea');}&quot;],@&quot;createTextArea&quot;,
 			[TitaniumJSCode codeWithString:@&quot;function(args){return Ti.UI.createButton(args,'multibutton');}&quot;],@&quot;createButtonBar&quot;,
+			[TitaniumJSCode codeWithString:@&quot;function(args){return Ti.UI.createButton(args,'segmented');}&quot;],@&quot;createTabbedBar&quot;,
 
 			[TitaniumJSCode codeWithString:@&quot;{}&quot;],@&quot;_MODAL&quot;,
 			[NSNumber numberWithInt:1],@&quot;_NEXTMODAL&quot;,</diff>
      <filename>iphone/modules/UiModule/UiModule.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f081bcbdac4a27af1cdd1877546cc8525467db8a</id>
    </parent>
  </parents>
  <author>
    <name>Blain Hamon</name>
    <email>blain@Millenium-Falcon.local</email>
  </author>
  <url>http://github.com/appcelerator/titanium_mobile/commit/e6df2b1acc0c0f528bd639615d792c00d5228ace</url>
  <id>e6df2b1acc0c0f528bd639615d792c00d5228ace</id>
  <committed-date>2009-06-29T20:19:34-07:00</committed-date>
  <authored-date>2009-06-29T20:19:34-07:00</authored-date>
  <message>More UI work</message>
  <tree>2c884ced89e9049f7c02b60eef6358c8cff41b76</tree>
  <committer>
    <name>Blain Hamon</name>
    <email>blain@Millenium-Falcon.local</email>
  </committer>
</commit>
