Code Monkey home page Code Monkey logo

mhuikit's Introduction

Modified 17th August Giles Allensby
UIActivityIndicatorView Thanks to @techdojo

***** UIKit for Gideros Studio ****
**********************************

The original work for this was done by Michael Hartlef. For the original code and license see this thread in the Gideros Forum:

http://www.giderosmobile.com/forum/discussion/578/uikit-plugin-example

UIKit for Gideros Studio is a plugin for iOS that allows usage of UIView, UIButton, UITextField, UIAlertView, UIWebView, UIScrollView, UILabel, UISwitch, UISlider, UIToolbar, UIPickerView, UIImageView,UIActivityIndicatorView, UIProgressView.

Events are dispatched to Gideros Studio.

Note - Andy Bower has ported Wax by Corey Johnson to Gideros Studio. 
This is a bridge between Lua and Objective C, so that all features of Objective C are
now exposed in Gideros Studio.
Please see:
http://bowerhaus.eu/blog/files/hot_wax.html
http://www.giderosmobile.com/forum/discussion/1989/uikit-issue#Item_8

Known issues:

1. Not all methods and properties are implemented.


Gideros UIKit Plugin API

To use the plugin:

Copy uikit.mm to Xcode project "plugins" directory and then add to Xcode project.

In lua file:

require "ui"

Lua API

int hideStatusBar(bool show)
int addToRootView(view v)
int removeFromRootView(view v)
NSArray luaTableToArray(table t)

View : GEventDispatcherProxy
	new()
	void addView(view childView)
	void removeFromParent()
	void setPosition(int x, int y)
	void setSize(int width, int height)

Button : View
	new(string type)
	void setTitle(string title)
	void setTitleColor(float r, float g, float b)
	void setBGColor(float r, float g, float b)
	void setFont(string fontname, float s)
	void setImage(string imagefile)
	void setBGImage(string imagefile)

	Generated event: "onButtonClick"

	NOTE:
	Available Button Types are "Rounded Rect", "Custom", "Detail Disclosure", "Info Light", "Info Dark" and "Add Contact"

Label : View
	new()	
	void setText(string text)
	void setTextColor(float r, float g, float b)
	void setBGColor(float r, float g, float b)
	void setFont(string fontname, float s)

ImageView : View
	new(string imagefile)
	void setImage(string imagefile)
	void setHighlightedImage(string imagefile)
	void setMode(string mode)

	NOTE:
	Available Modes are "Scale To Fill", "Aspect Fit", "Aspect Fill", "Redraw", "Center", "Top", "Bottom", "Left", "Right", "Top Left", "Top Right", "Bottom Left" and "Bottom Right"

ActivityIndicator : View        --Thanks to @techdojo
	new(string type)
	void setColor(float r, float g, float b, float a)

	NOTE:
	Available types are "White", "White Large" and "Gray"

ProgressView : View
	new(string type)
	void setProgress(float progress, bool animated) - progress is 0-1
	void setProgressColor(float r, float g, float b, float a)
	void setTrackColor(float r, float g, float b, float a)
	void setProgressImage(string imagePath)
	void setTrackImage(string imagePath)
	float getProgress()

	NOTE:
	Available types are "Default" and "bar"

AlertView : GEventDispatcherProxy
	new(string title, string message, string button)
	void show()
	void addButton(string title)

	Generated event: "complete"

Switch : View
	new()	
	void setState(bool state)
	bool getState()

	Generated event: "onSwitchClick"

Slider : View
	new(float min, float max)	
	void setValue(float value)
	int getValue()
	void setThumbImage(string imagefile)

	Generated event: "onSliderChange"

TextField2 : View
	void create(string text)
	void setText(string text)
	string getText()	
	void setTextColor(float r, float g, float b)
	void setBGColor(float r, float g, float b)
	void showKeyboard()

	Generated events: "onTextFieldEdit", "onTextFieldReturn"

WebView : View
	new(string url)
	void loadLocalFile(string filename)

	Generated events: "onWebViewNavigation"

PickerView : View
	new(table items)
	virtual int getRowCount()	
	virtual void setRow(int row)	
	virtual int getPickedRow()	
	virtual string getPickedItem()	

	Generated event: "onPickerRows"

Toolbar : View
	new()	
	void addButton()
	void addTextButton(string caption)
	void add(view xview)
	//void setValue(float value)
	//void setThumbImage(string imagefile)

	Generated event: "onToolbarClick"

ScrollView : View
	new(float x, float y, float w, float h, float cw, float ch)	
	void add(view v)

	Generated event: onScrollViewClick

TableView : View
	new(string Type)
	void setData(NSArray data) -- use luaTableToArray()
	void setCellText(string text)

	void setbackColor(float r, float g, float b, float a)
    void setSeperatorStyle(string style)
    void setSeperatorColor(float r, float g, float b, float a)
    void addRow(NSArray data, int rowNum, int sectNum, String animStyle) -- use luaTableToArray()
    void reloadRow(NSArray data, int rowNum, int sectNum, String animStyle) -- use luaTableToArray()
    void toggleEditing(Boolean animated)

	setPosition(x, y)
	setSize(width, height)

	Generated events: "cellForRowAtIndexPath", "didSelectRowAtIndexPath"
	event table includes the additional field: "Row" (event.Row)

	NOTE:
	Available Table Types are "Plain" and "Grouped"
	Available Row Animations are "None", "Fade", "Right", "Left", "Top", "Bottom" and "Middle"
	Available Seperator Styles are "None", "Line" and "Etched"


mhuikit's People

Contributors

mikehart66 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.