]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/notebook.mm
Correct format specifiers used to show wxIPV4address.
[wxWidgets.git] / src / osx / cocoa / notebook.mm
index e085d76899d84eab834f18f03302459301902fe2..bba36f5d942a676467d7cbf8ce3d4e17c4d56765 100644 (file)
@@ -30,7 +30,7 @@
 // controller
 //
 
-@interface wxTabViewController : NSObject
+@interface wxTabViewController : NSObject wxOSX_10_6_AND_LATER(<NSTabViewDelegate>)
 {
 }
 
 
 @interface wxNSTabView : NSTabView
 {
-    wxWidgetCocoaImpl* impl;
 }
 
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
-- (wxWidgetCocoaImpl*) implementation;
-- (BOOL) isFlipped;
-
 @end
 
 @implementation wxTabViewController
 
 - (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem
 {
+    wxUnusedVar(tabViewItem);
     wxNSTabView* view = (wxNSTabView*) tabView;
-    wxWidgetCocoaImpl* viewimpl = [view implementation];
+    wxWidgetCocoaImpl* viewimpl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( view );
+
     if ( viewimpl )
     {
-        wxNotebook* wxpeer = (wxNotebook*) viewimpl->GetWXPeer();
+        // wxNotebook* wxpeer = (wxNotebook*) viewimpl->GetWXPeer();
     }
     return YES;
 }
 - (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem;
 
 {
+    wxUnusedVar(tabViewItem);
     wxNSTabView* view = (wxNSTabView*) tabView;
-    wxWidgetCocoaImpl* viewimpl = [view implementation];
+    wxWidgetCocoaImpl* viewimpl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( view );
     if ( viewimpl )
     {
         wxNotebook* wxpeer = (wxNotebook*) viewimpl->GetWXPeer();
-        wxpeer->HandleClicked(0);
+        wxpeer->OSXHandleClicked(0);
     }
 }
 
 
 @implementation wxNSTabView
 
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
-    impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
++ (void)initialize
 {
-    return impl;
-}
-
-- (BOOL) isFlipped
-{
-    return YES;
+    static BOOL initialized = NO;
+    if (!initialized)
+    {
+        initialized = YES;
+        wxOSXCocoaClassAddWXMethods( self );
+    }
 }
 
 @end
@@ -108,18 +101,18 @@ public:
     wxCocoaTabView( wxWindowMac* peer , WXWidget w ) : wxWidgetCocoaImpl(peer, w)
     {
     }
-    
-    void GetContentArea( int &left , int &top , int &width , int &height ) const 
+
+    void GetContentArea( int &left , int &top , int &width , int &height ) const
     {
         wxNSTabView* slf = (wxNSTabView*) m_osxView;
         NSRect r = [slf contentRect];
-        left = r.origin.x;
-        top = r.origin.y;
-        width = r.size.width;
-        height = r.size.height;
+        left = (int)r.origin.x;
+        top = (int)r.origin.y;
+        width = (int)r.size.width;
+        height = (int)r.size.height;
     }
-    
-    void SetValue( wxInt32 value ) 
+
+    void SetValue( wxInt32 value )
     {
         wxNSTabView* slf = (wxNSTabView*) m_osxView;
         // avoid 'changed' events when setting the tab programmatically
@@ -128,7 +121,7 @@ public:
         [slf selectTabViewItemAtIndex:(value-1)];
         [slf setDelegate:controller];
     }
-    
+
     wxInt32 GetValue() const
     {
         wxNSTabView* slf = (wxNSTabView*) m_osxView;
@@ -138,7 +131,7 @@ public:
         else
             return [slf indexOfTabViewItem:selectedItem]+1;
     }
-    
+
     void SetMaximum( wxInt32 maximum )
     {
         wxNSTabView* slf = (wxNSTabView*) m_osxView;
@@ -146,7 +139,7 @@ public:
         // avoid 'changed' events when setting the tab programmatically
         wxTabViewController* controller = [slf delegate];
         [slf setDelegate:nil];
-        
+
         if ( maximum > cocoacount )
         {
             for ( int i = cocoacount ; i < maximum ; ++i )
@@ -170,9 +163,9 @@ public:
     void SetupTabs( const wxNotebook& notebook)
     {
         int pcount = notebook.GetPageCount();
-        
+
         SetMaximum( pcount );
-        
+
         for ( int i = 0 ; i < pcount ; ++i )
         {
             wxNotebookPage* page = notebook.GetPage(i);
@@ -233,23 +226,21 @@ public:
     verify_noerr( err );
 #endif
 */
-wxWidgetImplType* wxWidgetImpl::CreateTabView( wxWindowMac* wxpeer, 
-                                    wxWindowMac* parent, 
-                                    wxWindowID id, 
-                                    const wxPoint& pos, 
+wxWidgetImplType* wxWidgetImpl::CreateTabView( wxWindowMac* wxpeer,
+                                    wxWindowMac* WXUNUSED(parent),
+                                    wxWindowID WXUNUSED(id),
+                                    const wxPoint& pos,
                                     const wxSize& size,
-                                    long style, 
-                                    long extraStyle)
+                                    long style,
+                                    long WXUNUSED(extraStyle))
 {
     static wxTabViewController* controller = NULL;
 
     if ( !controller )
         controller =[[wxTabViewController alloc] init];
 
-    NSView* sv = (wxpeer->GetParent()->GetHandle() );
-    
     NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
-    
+
     NSTabViewType tabstyle = NSTopTabsBezelBorder;
     if ( style & wxBK_LEFT )
         tabstyle = NSLeftTabsBezelBorder;
@@ -257,12 +248,10 @@ wxWidgetImplType* wxWidgetImpl::CreateTabView( wxWindowMac* wxpeer,
         tabstyle = NSRightTabsBezelBorder;
     else if ( style & wxBK_BOTTOM )
         tabstyle = NSBottomTabsBezelBorder;
-    
+
     wxNSTabView* v = [[wxNSTabView alloc] initWithFrame:r];
-    [sv addSubview:v];
     [v setTabViewType:tabstyle];
     wxWidgetCocoaImpl* c = new wxCocoaTabView( wxpeer, v );
-    [v setImplementation:c];
     [v setDelegate: controller];
     return c;
 }