#import <UIKit/UIKit.h>
#define HB_DONT_DEFINE_BOOL
#include <hbapi.h>
void SetWndMain( UIWindow * window );
HB_FUNC( CREATEWINDOW )
{
UIWindow * window = [ UIWindow alloc ];
// float color[ 4 ] = { 0, 0, 0.63, 1 }; // R, G, B, Alpha
// [ window setView : [ [ UIView alloc ] initWithFrame : [ window bounds ] ] ];
[ window setBackgroundColor: [ UIColor greenColor ] ];
hb_retnl( ( LONG ) window );
}
HB_FUNC( WNDACTIVATE )
{
UIWindow * window = ( UIWindow * ) hb_parnl( 1 );
SetWndMain( window );
// [ window orderFront : nil ];
[ window makeKeyAndVisible ];
}
HB_FUNC( WNDCLOSE )
{
UIWindow * window = ( UIWindow * ) hb_parnl( 1 );
[ window release ];
}
./lib/libfivec.a : ./objc/mainapp.o ./objc/uikit.o ./objc/msgs.o ./objc/windows.o
$(LM) -static -o ./lib/libfivec.a ./objc/mainapp.o ./objc/uikit.o ./objc/msgs.o ./objc/windows.o
function Main()
local oWnd := TWindow():New()
oWnd:Activate()
MsgInfo( "Hello world!" )
return nil
void MsgInfo( NSString * );
@interface Window : UIWindow
{
}
- ( void ) touchesBegan : ( NSSet * ) touches withEvent : ( UIEvent * ) event;
@end
@implementation Window
- ( void ) touchesBegan : ( NSSet * ) touches withEvent : ( UIEvent * ) event
{
MsgInfo( @"touch!" );
}
@end
HB_FUNC( CREATEWINDOW )
{
Window * window = [ [ Window alloc ] initWithFrame : [ [ UIScreen mainScreen ] bounds ] ];
window.backgroundColor = [ UIColor greenColor ];
hb_retnl( ( LONG ) window );
}
void MsgInfo( NSString * text )
{
UIAlertView * alert = [ [ UIAlertView alloc ] initWithTitle : @"Information"
message : text delegate : GetApp()
cancelButtonTitle : @"OK" otherButtonTitles : nil ];
[ alert show ];
[ alert autorelease ];
}
Return to FiveMac / FivePhone (iPhone, iPad)
Users browsing this forum: No registered users and 6 guests