#include "wx/cocoa/autorelease.h"
#include "wx/cocoa/string.h"
+#include "wx/cocoa/objc/objc_uniquifying.h"
#import <AppKit/NSTabView.h>
#import <AppKit/NSTabViewItem.h>
- (NSImage*)image;
- (void)setImage:(NSImage*)image;
@end // interface WXCTabViewImageItem : NSTabViewItem
+WX_DECLARE_GET_OBJC_CLASS(WXCTabViewImageItem,NSTabViewItem)
@implementation WXCTabViewImageItem : NSTabViewItem
- (id)init
}
@end // implementation WXCTabViewImageItem : NSTabViewItem
-
-// ========================================================================
-// wxNotebookEvent
-// ========================================================================
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
+WX_IMPLEMENT_GET_OBJC_CLASS(WXCTabViewImageItem,NSTabViewItem)
// ========================================================================
// wxNotebook
// ========================================================================
-IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
BEGIN_EVENT_TABLE(wxNotebook, wxNotebookBase)
END_EVENT_TABLE()
WX_IMPLEMENT_COCOA_OWNER(wxNotebook,NSTabView,NSView,NSView)
return false;
m_cocoaNSView = NULL;
SetNSTabView([[NSTabView alloc] initWithFrame:MakeDefaultNSRect(size)]);
+
+ do
+ {
+ NSTabViewType tabViewType;
+ if(style & wxNB_TOP)
+ tabViewType = NSTopTabsBezelBorder;
+ else if(style & wxNB_LEFT)
+ tabViewType = NSLeftTabsBezelBorder;
+ else if(style & wxNB_RIGHT)
+ tabViewType = NSRightTabsBezelBorder;
+ else if(style & wxNB_BOTTOM)
+ tabViewType = NSBottomTabsBezelBorder;
+ else
+ break;
+ [GetNSTabView() setTabViewType:tabViewType];
+ } while(0);
+
if(m_parent)
m_parent->CocoaAddChild(this);
SetInitialFrameRect(pos,size);
{
wxAutoNSAutoreleasePool pool;
m_pages.Insert(page,pos);
- NSTabViewItem *tvitem = [[WXCTabViewImageItem alloc] initWithIdentifier:nil];
+ NSTabViewItem *tvitem = [[WX_GET_OBJC_CLASS(WXCTabViewImageItem) alloc] initWithIdentifier:nil];
[tvitem setLabel: wxNSStringWithWxString(title)];
const wxBitmap *bmp = (imageId!=-1)?m_imageList->GetBitmapPtr(imageId):NULL;
if(bmp)
void wxNotebook::CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tabViewItem)
{
// FIXME: oldSel probably == newSel
- wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId(),
+ wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId(),
[GetNSTabView() indexOfTabViewItem:tabViewItem], GetSelection());
event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(event);
}
bool wxNotebook::CocoaDelegate_tabView_shouldSelectTabViewItem(WX_NSTabViewItem tabViewItem)
{
- wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId(),
+ wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId(),
[GetNSTabView() indexOfTabViewItem:tabViewItem], GetSelection());
event.SetEventObject(this);
- return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed();
+ return !HandleWindowEvent(event) || event.IsAllowed();
}
#endif // wxUSE_NOTEBOOK