~jammy-zhou/+junk/skia

« back to all changes in this revision

Viewing changes to src/utils/mac/.svn/text-base/skia_mac.cp.svn-base

  • Committer: Jammy Zhou
  • Date: 2010-11-05 22:47:35 UTC
  • Revision ID: jammy.zhou@linaro.org-20101105224735-i1miyqbyxwslg7t2
initial version (upstream r622)

http://code.google.com/p/skia/source/list

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <Carbon/Carbon.h>
 
2
#include "SkApplication.h"
 
3
#include "SkWindow.h"
 
4
 
 
5
int main(int argc, char* argv[])
 
6
{
 
7
    IBNibRef                    nibRef;
 
8
    WindowRef                   window;
 
9
    OSStatus                    err = noErr;
 
10
 
 
11
    // Create a Nib reference passing the name of the nib file (without the .nib extension)
 
12
    // CreateNibReference only searches into the application bundle.
 
13
    err = CreateNibReference(CFSTR("main"), &nibRef);
 
14
    require_noerr( err, CantGetNibRef );
 
15
    
 
16
    // Then create a window. "MainWindow" is the name of the window object. This name is set in 
 
17
    // InterfaceBuilder when the nib is created.
 
18
    err = CreateWindowFromNib(nibRef, CFSTR("MainWindow"), &window);
 
19
    require_noerr( err, CantCreateWindow );
 
20
    
 
21
    // We don't need the nib reference anymore.
 
22
    DisposeNibReference(nibRef);
 
23
    
 
24
    // if we get here, we can start our normal Skia sequence
 
25
    {
 
26
        application_init();
 
27
        (void)create_sk_window(window);
 
28
        SizeWindow(window, 640, 480, false);
 
29
    }
 
30
    
 
31
    // The window was created hidden so show it.
 
32
    ShowWindow( window );
 
33
    
 
34
    // Call the event loop
 
35
    RunApplicationEventLoop();
 
36
 
 
37
        application_term();
 
38
 
 
39
CantCreateWindow:
 
40
CantGetNibRef:
 
41
        return err;
 
42
}
 
43