Re: Question concerning mouseDragged events.

2008-05-27 Thread Graham Reitz
[self convertPoint:eventLocation fromView:nil]; m_controller->left_mouse_dragged(center.x, center.y); } -graham On May 27, 2008, at 10:48 PM, Jens Alfke wrote: On 27 May '08, at 8:38 PM, Graham Reitz wrote: Do folks somehow get the direction of the drag, size of the rectangle,

Question concerning mouseDragged events.

2008-05-27 Thread Graham Reitz
What is the typical information that people get from a mouse dragged event? I have the following: - (void) mouseDragged:(NSEvent*)event { NSPoint eventLocation = [event locationInWindow]; NSPoint center = [self convertPoint:eventLocation fromView:nil]; m_controller->lef

Re: Resizing a view to match the main NSWindow size?

2008-05-25 Thread Graham Reitz
Thanks Eric. I have a CustomOpenGLView example that I downloaded from the apple development site (http://developer.apple.com/samplecode/Custom_Cocoa_OpenGL/listing5.html ). Hopefully that has what I am looking for. Use NSOpenGLView. It's whole reason to exist is to simplify setup and use

Resizing a view to match the main NSWindow size?

2008-05-25 Thread Graham Reitz
I think I am close but don't understand how the coordinate system of an NSView relates to the NSWindow it resides in. It looks like the NSView setFrame method will help but I am getting weird results. Am I on the right track? thanks, graham ___

Re: Detecting a resize window event?

2008-05-25 Thread Graham Reitz
Thanks Greg! Works great. About the time I noticed your post I had ended up with this: (seems to work) - (void) drawRect: (NSRect) rect { NSWindow* main_window = [self window]; NSRect window_rect = [main_window frame]; NSLog(@"my_window_width=%f, my_window_height=%f", window_r

Re: Detecting a resize window event?

2008-05-25 Thread Graham Reitz
he frame of the view has been changed. I don't know of a message to track it real time. Scott On May 25, 2008, at 4:00 PM, Graham Reitz wrote: How do you detect a resize event? I can see that lockFocus and drawRect are getting called. Is there a method to help determine if the user is r

Re: Detecting a resize window event?

2008-05-25 Thread Graham Reitz
taking place, see here: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaPerformance/Articles/CocoaLiveResize.html You'll want to override the -viewWillStartLiveResize and - viewDidEndLiveResize methods. Hope this helps, - Greg On May 25, 2008, at 4:00 PM, Graham

Detecting a resize window event?

2008-05-25 Thread Graham Reitz
How do you detect a resize event? I can see that lockFocus and drawRect are getting called. Is there a method to help determine if the user is resizing the window? thanks, graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not p

Re: Scope in an interface?

2008-05-25 Thread Graham Reitz
Outstanding! Thanks Jens! Did you just type that up now? That seems like a lot of effort. Much appreciated, -graham On May 25, 2008, at 2:41 AM, Jens Alfke wrote: On 24 May '08, at 10:29 PM, Graham Reitz wrote: Can I think of an @interface as something similar to a c++ class?

Re: Scope in an interface?

2008-05-24 Thread Graham Reitz
Sorry, assume the @implementation/@end are there. It's not an example meant to compile. It sounds like what I listed can be considered synonymous with a c++ class? thanks, -graham On May 25, 2008, at 12:36 AM, stephen joseph butler wrote: On Sun, May 25, 2008 at 12:29 AM, Graham

Scope in an interface?

2008-05-24 Thread Graham Reitz
I am coming from the c++ world and I feel I don't understand how objects are scoped in obj-c. What is the scope of m_controller (a c++ class) below? The debugger shows m_controller as {...} with no other information. Other than that it seems to run fine. Can I think of an @interface a

Re: Handling keyDown events results in beeping from a NSView subclass...

2008-05-24 Thread Graham Reitz
board events are sent to the first responder and then up the responder chain, unlike mouse events which are sent to the actual object clicked. -Pete On May 24, 2008, at 10:37 PM, Graham Reitz wrote: 1) Create a simple Cocoa application 2) Open IB and drag a Custom View over to the Window 3)

Handling keyDown events results in beeping from a NSView subclass...

2008-05-24 Thread Graham Reitz
1) Create a simple Cocoa application 2) Open IB and drag a Custom View over to the Window 3) Name the Custom View class 4) Write the class files and add them to the project 5) Derive a class from NSView and implement the keyDown method. - (void)keyDown:(NSEvent *)theEvent; 6) Run the prog

Is there anything pathological with the following NSView simple subclass?

2008-05-24 Thread Graham Reitz
I am endeavoring to learn openGL gui development on the Mac. Any comments on the follow code would be greatly appreciated, i.e. what's wrong, pathological and etc... thanks, graham Code--- // simple.h #import @interface simple : NSView { @private NSOpenGLContext *m_con

Halting a cocoa application?

2008-05-24 Thread Graham Reitz
What is the preferred method to halt a cocoa application on a runtime error occurring in the initWithFrame method? thanks, graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the l

Re: How many times will a sub-classed NSView be instantiated in a simple Cocoa App?

2008-05-24 Thread Graham Reitz
Awesome! Thanks Nathan. That makes a lot more sense to me. Just set the class of the Custom View. What do you specifically mean by 'set the class'? graham On May 24, 2008, at 7:01 PM, Nathan Kinsinger wrote: On May 24, 2008, at 5:43 PM, Graham Reitz wrote: (fyi) I am comin

How many times will a sub-classed NSView be instantiated in a simple Cocoa App?

2008-05-24 Thread Graham Reitz
(fyi) I am coming from the non Mac C++ land and I am trying to grok Obj-C and the Cocoa framework. 1) Create a simple Cocoa application 2) Open IB and drag a Custom View over to the Window 3) Drag an Object to MainMenu.nib 4) Name the Custom View and Object to the same class name 5) Write the c