Browse Source

WIP tweaks to mojox for android support + general fixes.

Mark Sibly 9 years ago
parent
commit
0d12d1c008

+ 10 - 3
modules/mojox/action.monkey2

@@ -73,9 +73,9 @@ Class Action
 	
 	#rem monkeydoc Action async flag.
 	
-	If true, then when the action is triggered the [[Triggered]] signal is run on a new fiber.
+	If true (the default), then when the action is triggered the [[Triggered]] signal is run on a new fiber.
 	
-	Default to true.
+	Note: Fiber are not supported in emscripten, so this property has no effect.
 	
 	#end
 	Property Async:Bool()
@@ -83,7 +83,7 @@ Class Action
 		Return _async
 	
 	Setter( async:Bool )
-	
+
 		_async=async
 	End
 	
@@ -134,11 +134,18 @@ Class Action
 	#end	
 	Method Trigger()
 	
+#if __TARGET__<>"emscripten"
+	
 		If _async
 			New Fiber( Triggered )
 		Else
 			Triggered()
 		Endif
+
+#else
+
+		Triggered()
+#endif
 		
 	End
 	

+ 5 - 9
modules/mojox/assets/themes/default.json

@@ -14,8 +14,6 @@
 		"text-disabled": "#888",
 		"text-background": "#888",
 		
-		"menu" : "content",
-
 		"textview-color0":"#0000",
 		"textview-color1":"#fff",
 		"textview-color2":"#ff0",
@@ -156,16 +154,15 @@
 		},
 		
 		"Menu":{
+			
 			"padding":[ 0 ],
 			"skin":"dialog_skin.png",
 			"skinColor":"panel"
 		},
 		
 		"MenuButton":{
-			"extends":"Button",
-			"skin":"",
+			"extends":"Label",
 			"padding":[8,4],
-			"backgroundColor":"menu",
 			"states":{
 				"hover":{
 					"backgroundColor":"hover"
@@ -181,14 +178,13 @@
 		
 		"MenuBar":{
 			"extends":"ToolBar",
-			"backgroundColor":"menu"
+			"backgroundColor":"content"
 		},
 		
 		"MenuSeparator":{
 			"padding":[ 0,0,0,1 ],
-			"backgroundColor":"panel",
-			"border":[ 8,8,7,7 ],
-			"borderColor":"menu"
+			"backgroundColor":"content",
+			"border":[ 8,8,7,7 ]
 		},
 
 		"TabView":{

+ 1 - 1
modules/mojox/checkbutton.monkey2

@@ -20,7 +20,7 @@ End
 
 #rem monkeydoc The CheckButton class.
 #end
-Class CheckButton Extends Button
+Class CheckButton Extends Label
 
 	#rem monkeydoc Invoked when the button's [[Checked]] state changes.
 	

+ 4 - 0
modules/mojox/console.monkey2

@@ -1,6 +1,8 @@
 
 Namespace mojox
 
+#if __TARGET__<>"emscripten"
+
 #rem monkeydoc The Console class.
 #end
 Class Console Extends TextView
@@ -210,3 +212,5 @@ Class Console Extends TextView
 	End
 
 End
+
+#endif

+ 8 - 0
modules/mojox/dialog.monkey2

@@ -156,6 +156,8 @@ Class Dialog Extends View
 		_window=Null
 	End
 
+#if __TARGET__<>"emscripten"
+	
 	#rem monkeydoc Creates and runs a modal dialog.
 	#end
 	Function Run:Int( title:String,view:View,actions:String[],onEnter:Int=-1,onEscape:Int=-1 )
@@ -194,6 +196,8 @@ Class Dialog Extends View
 		Return result
 	End
 	
+	#end
+	
 	Protected
 	
 	Method OnMeasure:Vec2i() Override
@@ -253,6 +257,8 @@ Class TextDialog Extends Dialog
 		_label.Text=text
 	End
 	
+#if __TARGET__<>"emscripten"
+	
 	#rem monkeydoc Creates and runs a modal text dialog.
 	#end
 	Function Run:Int( title:String,text:String,actions:String[],onEnter:Int=-1,onEscape:Int=-1 )
@@ -289,6 +295,8 @@ Class TextDialog Extends Dialog
 		Return r
 	End
 	
+	#end
+	
 	Private
 	
 	Field _label:Label

+ 2 - 0
modules/mojox/htmlview.monkey2

@@ -61,7 +61,9 @@ Class HtmlView Extends ScrollableView
 		Local root:=ExtractRootDir( url )
 		
 		If root="http://" Or root="https://"
+#if __TARGET__="desktop"		
 			requesters.OpenUrl( url )
+#endif
 			Return
 		Endif
 		

+ 3 - 0
modules/mojox/requesters.monkey2

@@ -1,6 +1,8 @@
 
 Namespace mojox
 
+#if __TARGET__<>"emscripten"
+
 #rem monkeydoc Runs a simple 'alert' dialog.
 
 If this function is called from the main fiber, a new fiber is created to the alert on.
@@ -84,3 +86,4 @@ Function RequestString:String( message:String="Enter a string:",title:String="St
 	Return str
 End
 
+#endif

+ 1 - 1
modules/mojox/tabview.monkey2

@@ -248,7 +248,7 @@ Class TabView Extends DockingView
 		
 		tab.CloseClicked=Lambda()
 		
-			CloseClicked( TabIndex( view ) )
+			CloseClicked( TabIndex( tab.View ) )
 		End
 		
 		Local index:=_tabs.Length

+ 2 - 2
modules/mojox/tests/tabview_test.monkey2

@@ -34,9 +34,9 @@ Class MyWindow Extends Window
 		
 			tabView.RemoveTab( index )
 		
-			If tabView.CurrentView Or Not tabView.Count Return
+			If tabView.CurrentView Or Not tabView.NumTabs Return
 			
-			If index=tabView.Count index-=1
+			If index=tabView.NumTabs index-=1
 
 			tabView.CurrentIndex=index
 		End