Index: src/CodeBlocks.cbp
===================================================================
--- src/CodeBlocks.cbp	(revision 3049)
+++ src/CodeBlocks.cbp	(working copy)
@@ -3513,6 +3513,42 @@
 			<Option link="0" />
 			<Option target="sdk" />
 		</Unit>
+		<Unit filename="sdk\wxFlatNotebook\fnb_resources.cpp">
+			<Option compilerVar="CPP" />
+			<Option target="wxFlatNotebook" />
+		</Unit>
+		<Unit filename="sdk\wxFlatNotebook\popup_dlg.cpp">
+			<Option compilerVar="CPP" />
+			<Option target="wxFlatNotebook" />
+		</Unit>
+		<Unit filename="sdk\wxFlatNotebook\popup_dlg.h">
+			<Option compilerVar="CPP" />
+			<Option compile="0" />
+			<Option link="0" />
+			<Option target="wxFlatNotebook" />
+		</Unit>
+		<Unit filename="sdk\wxFlatNotebook\renderer.cpp">
+			<Option compilerVar="CPP" />
+			<Option target="wxFlatNotebook" />
+		</Unit>
+		<Unit filename="sdk\wxFlatNotebook\renderer.h">
+			<Option compilerVar="CPP" />
+			<Option compile="0" />
+			<Option link="0" />
+			<Option target="wxFlatNotebook" />
+		</Unit>
+		<Unit filename="sdk\wxFlatNotebook\singleton.h">
+			<Option compilerVar="CPP" />
+			<Option compile="0" />
+			<Option link="0" />
+			<Option target="wxFlatNotebook" />
+		</Unit>
+		<Unit filename="sdk\wxFlatNotebook\smart_ptr.h">
+			<Option compilerVar="CPP" />
+			<Option compile="0" />
+			<Option link="0" />
+			<Option target="wxFlatNotebook" />
+		</Unit>
 		<Unit filename="sdk\wxFlatNotebook\wxFNBDropTarget.h">
 			<Option compilerVar="CPP" />
 			<Option compile="0" />
Index: src/sdk/editormanager.cpp
===================================================================
--- src/sdk/editormanager.cpp	(revision 3049)
+++ src/sdk/editormanager.cpp	(working copy)
@@ -671,7 +671,7 @@
     //    LOGSTREAM << wxString::Format(_T("RemoveEditorBase(): ed=%p, title=%s\n"), eb, eb ? eb->GetFilename().c_str() : _T(""));
     int page = FindPageFromEditor(eb);
    if (page != -1 && !Manager::isappShuttingDown())
-        m_pNotebook->RemovePage(page, false);
+        m_pNotebook->RemovePage(page);

 #ifdef USE_OPENFILES_TREE
     //        if (eb->IsBuiltinEditor())
@@ -809,7 +809,7 @@
                     return false;
             wxString filename = editor->GetFilename();
             //            LOGSTREAM << wxString::Format(_T("Close(): ed=%p, title=%s\n"), editor, editor ? editor->GetTitle().c_str() : _T(""));
-            m_pNotebook->DeletePage(idx, false);
+            m_pNotebook->DeletePage(idx);
         }
     }
     m_pData->m_NeedsRefresh = true;
@@ -2736,3 +2736,4 @@
     return m_zoom;
 }

+
Index: src/sdk/wxFlatNotebook/fnb_resources.cpp
===================================================================
--- src/sdk/wxFlatNotebook/fnb_resources.cpp	(revision 0)
+++ src/sdk/wxFlatNotebook/fnb_resources.cpp	(revision 0)
@@ -0,0 +1,36 @@
+#include <stdlib.h>
+
+size_t tab_selection_png_size = 665;
+unsigned char tab_selection_png[] = {
+137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0,
+0,31,243,255,97,0,0,0,43,116,69,88,116,67,114,101,97,116,105,111,110,32,
+84,105,109,101,0,83,111,32,50,51,32,70,101,98,32,50,48,48,51,32,50,49,58,
+49,54,58,49,56,32,43,48,49,48,48,249,138,209,35,0,0,0,7,116,73,77,69,7,
+211,2,23,23,43,34,85,9,241,31,0,0,0,9,112,72,89,115,0,0,11,18,0,0,11,18,
+1,210,221,126,252,0,0,0,4,103,65,77,65,0,0,177,143,11,252,97,5,0,0,1,241,
+73,68,65,84,120,218,205,146,93,72,83,113,24,198,127,103,231,28,79,219,100,
+51,231,44,22,125,24,187,8,34,210,28,4,125,32,72,31,116,19,10,65,93,134,
+87,38,120,81,215,177,139,160,91,7,101,144,208,69,17,116,149,133,72,130,
+33,102,65,84,216,72,152,125,136,133,180,173,176,114,211,181,143,179,237,
+108,231,244,223,164,66,49,161,59,223,139,255,159,247,125,159,247,225,229,
+121,94,216,112,49,117,27,45,246,236,228,131,239,51,61,75,31,39,218,147,
+145,129,218,254,245,240,182,213,133,241,52,254,184,148,232,240,170,134,
+91,93,138,110,14,133,143,95,160,43,222,205,185,72,51,109,95,148,213,120,
+105,69,214,207,145,19,173,173,119,118,53,186,119,15,14,141,115,240,209,
+89,70,246,92,179,90,218,26,217,86,39,250,63,75,57,163,172,132,71,103,185,
+196,101,41,92,25,249,195,184,247,201,206,224,249,192,225,160,167,214,46,
+135,238,61,38,17,5,87,141,9,79,71,164,55,207,11,124,240,186,173,253,1,191,
+67,245,249,142,146,40,12,210,59,23,224,122,211,194,50,193,21,154,156,41,
+35,104,232,105,91,207,141,251,228,23,139,213,221,36,75,244,156,14,176,107,
+232,168,210,203,201,40,245,190,52,218,190,3,59,10,217,236,93,209,61,85,
+213,64,41,219,186,37,7,242,232,228,123,242,63,138,203,202,228,32,149,149,
+5,139,11,52,65,162,213,136,149,156,36,117,19,51,22,23,128,186,87,149,89,
+185,242,88,237,132,138,154,233,141,207,164,40,228,74,18,223,160,119,19,
+156,110,152,70,158,27,211,223,38,143,13,160,169,110,52,197,131,98,139,153,
+178,183,139,190,45,55,255,138,120,145,6,50,244,97,113,70,252,153,161,102,
+92,126,1,127,49,5,95,63,177,24,28,163,190,138,107,25,222,142,236,73,242,
+250,80,118,109,23,58,113,98,96,143,119,16,249,156,99,107,36,2,177,89,22,
+174,78,224,253,215,29,172,244,245,33,21,230,108,166,147,252,239,146,208,
+209,252,175,67,170,132,105,162,171,170,16,72,174,58,177,46,129,178,86,241,
+221,52,195,194,4,223,252,60,37,163,204,45,54,116,252,2,37,129,169,151,17,
+201,65,77,0,0,0,0,73,69,78,68,174,66,96,130};
Index: src/sdk/wxFlatNotebook/popup_dlg.cpp
===================================================================
--- src/sdk/wxFlatNotebook/popup_dlg.cpp	(revision 0)
+++ src/sdk/wxFlatNotebook/popup_dlg.cpp	(revision 0)
@@ -0,0 +1,237 @@
+#include "popup_dlg.h"
+#include <wx/listctrl.h>
+#include "wxFlatNotebook.h"
+#include "renderer.h"
+#include <wx/listbox.h>
+#include <wx/image.h>
+#include <wx/mstream.h>
+
+extern unsigned char tab_selection_png[];
+extern size_t tab_selection_png_size;
+
+wxBitmap wxTabNavigatorWindow::m_bmp;
+
+wxTabNavigatorWindow::wxTabNavigatorWindow(wxWindow* parent)
+: m_listBox(NULL)
+, m_selectedItem(-1)
+, m_panel(NULL)
+{
+	Create(parent);
+	GetSizer()->Fit(this);
+	GetSizer()->SetSizeHints(this);
+	GetSizer()->Layout();
+	Centre();
+}
+
+wxTabNavigatorWindow::wxTabNavigatorWindow()
+: wxDialog()
+, m_listBox(NULL)
+, m_selectedItem(-1)
+, m_panel(NULL)
+{
+}
+
+wxTabNavigatorWindow::~wxTabNavigatorWindow()
+{
+}
+
+void wxTabNavigatorWindow::Create(wxWindow* parent)
+{
+	long style = 0;
+	if(  !wxDialog::Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, style) )
+		return;
+
+	wxBoxSizer *sz = new wxBoxSizer( wxVERTICAL );
+	SetSizer( sz );
+
+	long flags = wxLB_SINGLE | wxNO_BORDER ;
+	m_listBox = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxSize(200, 150), 0, NULL, flags);
+
+	static int panelHeight = 0;
+	if( panelHeight == 0 )
+	{
+		wxMemoryDC mem_dc;
+		wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
+		font.SetWeight( wxBOLD );
+		mem_dc.SetFont(font);
+		int w;
+		mem_dc.GetTextExtent(wxT("Tp"), &w, &panelHeight);
+		panelHeight += 4; // Place a spacer of 2 pixels
+
+		// Out signpost bitmap is 24 pixels
+		if( panelHeight < 24 )
+			panelHeight = 24;
+	}
+
+	m_panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize(200, panelHeight));
+
+	sz->Add( m_panel );
+	sz->Add( m_listBox, 1, wxEXPAND );
+
+	SetSizer( sz );
+
+	// Connect events to the list box
+	m_listBox->Connect(wxID_ANY, wxEVT_KEY_UP, wxKeyEventHandler(wxTabNavigatorWindow::OnKeyUp), NULL, this);
+	m_listBox->Connect(wxID_ANY, wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(wxTabNavigatorWindow::OnNavigationKey), NULL, this);
+	m_listBox->Connect(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler(wxTabNavigatorWindow::OnItemSelected), NULL, this);
+
+	// Connect paint event to the panel
+	m_panel->Connect(wxID_ANY, wxEVT_PAINT, wxPaintEventHandler(wxTabNavigatorWindow::OnPanelPaint), NULL, this);
+	m_panel->Connect(wxID_ANY, wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(wxTabNavigatorWindow::OnPanelEraseBg), NULL, this);
+
+	SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) );
+	m_listBox->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+	PopulateListControl( static_cast<wxFlatNotebook*>( parent ) );
+
+	// Create the bitmap, only once
+	if( !m_bmp.Ok() )
+	{
+		wxImage::AddHandler( new wxPNGHandler );
+		wxInputStream *str = new wxMemoryInputStream(tab_selection_png, tab_selection_png_size);
+		wxImage img(*str);
+		m_bmp =  wxBitmap(img);
+		delete str;
+	}
+}
+
+void wxTabNavigatorWindow::OnKeyUp(wxKeyEvent &event)
+{
+	if( event.GetKeyCode() == WXK_CONTROL )
+	{
+		CloseDialog();
+	}
+}
+
+void wxTabNavigatorWindow::OnNavigationKey(wxNavigationKeyEvent &event)
+{
+	long selected = m_listBox->GetSelection();
+	wxFlatNotebook* bk = static_cast<wxFlatNotebook*>(GetParent());
+	long maxItems = bk->GetPageCount();
+	long itemToSelect;
+
+	if( event.GetDirection() )
+	{
+		// Select next page
+		if (selected == maxItems - 1)
+			itemToSelect = 0;
+		else
+			itemToSelect = selected + 1;
+	}
+	else
+	{
+		// Previous page
+		if( selected == 0 )
+			itemToSelect = maxItems - 1;
+		else
+			itemToSelect = selected - 1;
+	}
+
+	m_listBox->SetSelection( itemToSelect );
+}
+
+void wxTabNavigatorWindow::PopulateListControl(wxFlatNotebook *book)
+{
+	int selection = book->GetSelection();
+	int count     = book->GetPageCount();
+
+
+	m_listBox->Append( book->GetPageText(static_cast<int>(selection)) );
+	m_indexMap[0] = selection;
+
+	int itemIdx(1);
+	int prevSel = book->GetPreviousSelection();
+	if( prevSel != wxNOT_FOUND )
+	{
+		// Insert the previous selection as second entry
+		m_listBox->Append( book->GetPageText(static_cast<int>(prevSel)) );
+		m_indexMap[1] = prevSel;
+		itemIdx++;
+	}
+
+	for(int c=0; c<count; c++)
+	{
+		// Skip selected page
+		if( c == selection )
+			continue;
+
+		// Skip previous selected page as well
+		if( c == prevSel )
+			continue;
+
+		m_listBox->Append( book->GetPageText(static_cast<int>(c)) );
+		m_indexMap[itemIdx] = c;
+		itemIdx++;
+	}
+
+	// Select the next entry after the current selection
+	m_listBox->SetSelection( 0 );
+	wxNavigationKeyEvent dummy;
+	dummy.SetDirection(true);
+	OnNavigationKey(dummy);
+}
+
+void wxTabNavigatorWindow::OnItemSelected(wxCommandEvent & event )
+{
+	wxUnusedVar( event );
+	CloseDialog();
+}
+
+void wxTabNavigatorWindow::CloseDialog()
+{
+	wxFlatNotebook* bk = static_cast<wxFlatNotebook*>(GetParent());
+	m_selectedItem = m_listBox->GetSelection();
+	std::map<int, int>::iterator iter = m_indexMap.find(m_selectedItem);
+	bk->SetSelection( iter->second );
+	EndModal( wxID_OK );
+}
+
+void wxTabNavigatorWindow::OnPanelPaint(wxPaintEvent &event)
+{
+	wxUnusedVar(event);
+	wxPaintDC dc(m_panel);
+	wxRect rect = m_panel->GetClientRect();
+
+	static bool first = true;
+	static wxBitmap bmp( rect.width, rect.height );
+
+	if( first )
+	{
+		first = false;
+		wxMemoryDC mem_dc;
+		mem_dc.SelectObject( bmp );
+
+		wxColour endColour( wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW) );
+		wxColour startColour( wxFNBRenderer::LightColour(endColour, 50) );
+		wxFNBRenderer::PaintStraightGradientBox(mem_dc, rect, startColour, endColour);
+
+		// Draw the caption title and place the bitmap
+		wxPoint bmpPt;
+		wxPoint txtPt;
+
+		// get the bitmap optimal position, and draw it
+		bmpPt.y = (rect.height - m_bmp.GetHeight()) / 2;
+		bmpPt.x = 3;
+		mem_dc.DrawBitmap( m_bmp, bmpPt, true );
+
+		// get the text position, and draw it
+		int fontHeight(0), w(0);
+		wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+		font.SetWeight( wxBOLD );
+		mem_dc.SetFont( font );
+		mem_dc.GetTextExtent( wxT("Tp"), &w, &fontHeight );
+
+		txtPt.x = bmpPt.x + m_bmp.GetWidth() + 4;
+		txtPt.y = (rect.height - fontHeight)/2;
+		mem_dc.SetTextForeground( *wxWHITE );
+		mem_dc.DrawText( wxT("Opened tabs:"), txtPt );
+		mem_dc.SelectObject( wxNullBitmap );
+	}
+
+	dc.DrawBitmap( bmp, 0, 0 );
+}
+
+void wxTabNavigatorWindow::OnPanelEraseBg(wxEraseEvent &event)
+{
+	wxUnusedVar(event);
+
+}
Index: src/sdk/wxFlatNotebook/popup_dlg.h
===================================================================
--- src/sdk/wxFlatNotebook/popup_dlg.h	(revision 0)
+++ src/sdk/wxFlatNotebook/popup_dlg.h	(revision 0)
@@ -0,0 +1,58 @@
+#ifndef FNB_POPUPDLG_H
+#define FNB_POPUPDLG_H
+
+#include <wx/dialog.h>
+#include <map>
+#include <wx/bitmap.h>
+
+class wxListBox;
+class wxFlatNotebook;
+class wxPanel;
+
+class wxTabNavigatorWindow : public wxDialog
+{
+protected:
+	wxListBox *m_listBox;
+	long m_selectedItem;
+	std::map<int, int> m_indexMap;
+	wxPanel *m_panel;
+	static wxBitmap m_bmp;
+
+protected:
+	void CloseDialog();
+
+public:
+	/**
+	 * Parameterized constructor
+	 * \param parent dialog parent window
+	 */
+	wxTabNavigatorWindow(wxWindow* parent);
+
+	/**
+	 * Default constructor
+	 */
+	wxTabNavigatorWindow();
+
+	/**
+	 * Destructor
+	 */
+	virtual ~wxTabNavigatorWindow();
+
+	/**
+	 * Create the dialog, usually part of the two steps construction of a
+	 * dialog
+	 * \param parent dialog parent window
+	 */
+	void Create(wxWindow* parent);
+
+	/// Event handling
+	void OnKeyUp(wxKeyEvent &event);
+	void OnNavigationKey(wxNavigationKeyEvent &event);
+	void OnItemSelected(wxCommandEvent &event);
+	void OnPanelPaint(wxPaintEvent &event);
+	void OnPanelEraseBg(wxEraseEvent &event);
+	void PopulateListControl(wxFlatNotebook *book);
+};
+
+#endif // FNB_POPUPDLG_H
+
Index: src/sdk/wxFlatNotebook/README
===================================================================
--- src/sdk/wxFlatNotebook/README	(revision 3049)
+++ src/sdk/wxFlatNotebook/README	(working copy)
@@ -11,17 +11,11 @@

 # cd contrib/build/wxFlatNotebook
 # make clean
-# make
+# make type=[release | debug ]

 This will create both the library and the wxFlatNotebookTest executable

-To build in debug mode:

-# cd contrib/build/wxFlatNotebook
-# make clean
-# make type=debug
-
-
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 VERSIONS:
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -109,3 +103,46 @@
 + Fixed minor drawing issues
 + Fixed bug that when closing the a tab using the mouse middle button, the page was set to active and only then closed.
 + Fixed bug that the old selection value in the event when closing a page was incorrect
+
+
+
+======================================================
+Version 1.5  9/13/2006 7:40PM
+======================================================
+
+Features:
+
++ New style added - VC8 style, with curved tabs
+  The new style has the following features
+	- Background of tab area can be painted in gradient
+	- Colourful tabs - a random gentle colour is generated for each new tab (very cool :))
+
+	Note: that the new tab DOES NOT support 'X' button on the tab
+
++ Build for DLL debug/release was fixed (on windows)
++ Makefile for Linux is now more generic using wx-config tool
++ Several drawing issues were fixed
++ Tabs now has an extra line that separate them from the page
+
+========================================================
+Version 2.0
+========================================================
+
+ - Code refactoring:
+   + remove wxStyledNotebook class, the same functionality now exist under wxFlatNotebook
+   + All drawing was moved to renderers (wxFlatNotebook.cpp file is now cleaned from drawing)
+   + Now using smart_ptr & singleton template classes where ever possible
+
+ - Added smart tabbing style with new and easy way to select tabs (request #1527285)
+   Once this style is enabled, pressing Ctrl+[Shift]+T will popup a dialog with all the open tabs, another Ctrl+[Shift]+T will run throw the
+   dialog list, until the Ctrl key is released.
+
+ - Added new styles:
+   wxFNB_SMART_TABS - which enables the above feature
+   wxFNB_DROPDOWN_TABS_LIST - which replaces the '<>' (left, right arrows buttons) with a drop down list (popup menu) with all the open tabs
+   this feature is similar to VS8 tabs styles.
+
+- Fixed a bug in SetSelection - in case that the navigation buttons were hidden, and the selection was not visible, it did not ensure that it will be visible
+
+Have fun !
+Eran
Index: src/sdk/wxFlatNotebook/renderer.cpp
===================================================================
--- src/sdk/wxFlatNotebook/renderer.cpp	(revision 0)
+++ src/sdk/wxFlatNotebook/renderer.cpp	(revision 0)
@@ -0,0 +1,1595 @@
+#include "renderer.h"
+#include "wxFlatNotebook.h" // for the styles
+
+wxFNBRenderer::wxFNBRenderer()
+: m_tabXBgBmp(16, 16)
+, m_xBgBmp(16, 14)
+, m_leftBgBmp(16, 14)
+, m_rightBgBmp(16, 14)
+{
+}
+
+wxFNBRenderer::~wxFNBRenderer()
+{
+}
+
+int wxFNBRenderer::GetLeftButtonPos(wxWindow* pageContainer)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	long style = pc->GetParent()->GetWindowStyleFlag();
+	wxRect rect = pc->GetClientRect();
+	int clientWidth = rect.width;
+	if(style & wxFNB_NO_X_BUTTON)
+		return clientWidth - 38;
+	else
+		return clientWidth - 54;
+}
+
+int wxFNBRenderer::GetRightButtonPos(wxWindow* pageContainer)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	long style = pc->GetParent()->GetWindowStyleFlag();
+	wxRect rect = pc->GetClientRect();
+	int clientWidth = rect.width;
+	if(style & wxFNB_NO_X_BUTTON)
+		return clientWidth - 22;
+	else
+		return clientWidth - 38;
+}
+
+int wxFNBRenderer::GetDropArrowButtonPos(wxWindow *pageContainer)
+{
+	return GetRightButtonPos(pageContainer);
+}
+
+int wxFNBRenderer::GetXPos(wxWindow* pageContainer)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	long style = pc->GetParent()->GetWindowStyleFlag();
+	wxRect rect = pc->GetClientRect();
+	int clientWidth = rect.width;
+	if(style & wxFNB_NO_X_BUTTON)
+		return clientWidth;
+	else
+		return clientWidth - 22;
+}
+
+int wxFNBRenderer::GetButtonsAreaLength(wxWindow* pageContainer)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	long style = pc->GetParent()->GetWindowStyleFlag();
+
+	// ''
+	if(style & wxFNB_NO_NAV_BUTTONS && style & wxFNB_NO_X_BUTTON && !(style & wxFNB_DROPDOWN_TABS_LIST))
+		return 0;
+
+	// 'x'
+	if((style & wxFNB_NO_NAV_BUTTONS) && !(style & wxFNB_NO_X_BUTTON) && !(style & wxFNB_DROPDOWN_TABS_LIST))
+		return 22;
+
+	// '<>'
+	if(!(style & wxFNB_NO_NAV_BUTTONS) && (style & wxFNB_NO_X_BUTTON) && !(style & wxFNB_DROPDOWN_TABS_LIST))
+		return 53 - 16;
+
+	// 'vx'
+	if((style & wxFNB_DROPDOWN_TABS_LIST) && !(style & wxFNB_NO_X_BUTTON))
+		return 22 + 16;
+
+	// 'v'
+	if((style & wxFNB_DROPDOWN_TABS_LIST) && (style & wxFNB_NO_X_BUTTON))
+		return 22;
+
+	// '<>x'
+	return 53;
+}
+
+void wxFNBRenderer::DrawLeftArrow(wxWindow* pageContainer, wxDC& dc)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	long style = pc->GetParent()->GetWindowStyleFlag();
+	if(style & wxFNB_NO_NAV_BUTTONS)
+		return;
+
+	// Make sure that there are pages in the container
+	if(pc->GetPageInfoVector().empty())
+		return;
+
+	// Set the bitmap according to the button status
+	wxBitmap arrowBmp;
+	switch(pc->m_nLeftButtonStatus)
+	{
+	case wxFNB_BTN_HOVER:
+		arrowBmp = wxBitmap(FNB::left_arrow_hilite_xpm);
+		break;
+	case wxFNB_BTN_PRESSED:
+		arrowBmp = wxBitmap(FNB::left_arrow_pressed_xpm);
+		break;
+	case wxFNB_BTN_NONE:
+	default:
+		arrowBmp = wxBitmap(FNB::left_arrow_xpm);
+		break;
+	}
+
+	if(pc->m_nFrom == 0)
+	{
+		// Handle disabled arrow
+		arrowBmp = wxBitmap(FNB::left_arrow_disabled_xpm);
+	}
+
+	arrowBmp.SetMask(new wxMask(arrowBmp, MASK_COLOR));
+
+	// Erase old bitmap
+	int posx = GetLeftButtonPos( pc );
+	dc.DrawBitmap(m_leftBgBmp, posx, 6);
+
+	// Draw the new bitmap
+	dc.DrawBitmap(arrowBmp, posx, 6, true);
+}
+
+void wxFNBRenderer::DrawRightArrow(wxWindow* pageContainer, wxDC& dc)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	long style = pc->GetParent()->GetWindowStyleFlag();
+	if(style & wxFNB_NO_NAV_BUTTONS)
+		return;
+
+	// Make sure that there are pages in the container
+	if(pc->GetPageInfoVector().empty())
+		return;
+
+	// Set the bitmap according to the button status
+	wxBitmap arrowBmp;
+	switch(pc->m_nRightButtonStatus)
+	{
+	case wxFNB_BTN_HOVER:
+		arrowBmp = wxBitmap(FNB::right_arrow_hilite_xpm);
+		break;
+	case wxFNB_BTN_PRESSED:
+		arrowBmp = wxBitmap(FNB::right_arrow_pressed_xpm);
+		break;
+	case wxFNB_BTN_NONE:
+	default:
+		arrowBmp = wxBitmap(FNB::right_arrow_xpm);
+		break;
+	}
+
+
+	// Check if the right most tab is visible, if it is
+	// don't rotate right anymore
+	if(pc->GetPageInfoVector()[pc->GetPageInfoVector().GetCount()-1].GetPosition() != wxPoint(-1, -1))
+	{
+		arrowBmp = wxBitmap(FNB::right_arrow_disabled_xpm);
+	}
+
+	arrowBmp.SetMask(new wxMask(arrowBmp, MASK_COLOR));
+
+	// erase old bitmap
+	int posx = GetRightButtonPos( pc ) ;
+	dc.DrawBitmap(m_rightBgBmp, posx, 6);
+
+	// Draw the new bitmap
+	dc.DrawBitmap(arrowBmp, posx, 6, true);
+}
+
+void wxFNBRenderer::DrawDropDownArrow(wxWindow* pageContainer, wxDC& dc)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	// Check if this style is enabled
+	long style = pc->GetParent()->GetWindowStyleFlag();
+	if(! (style & wxFNB_DROPDOWN_TABS_LIST) )
+		return;
+
+	// Make sure that there are pages in the container
+	if(pc->GetPageInfoVector().empty())
+		return;
+
+	// Set the bitmap according to the button status
+	wxBitmap xbmp;
+
+	switch(pc->m_nArrowDownButtonStatus)
+	{
+	case wxFNB_BTN_HOVER:
+		xbmp = wxBitmap(FNB::down_arrow_hilite_xpm);
+		break;
+	case wxFNB_BTN_PRESSED:
+		xbmp = wxBitmap(FNB::down_arrow_pressed_xpm);
+		break;
+	case wxFNB_BTN_NONE:
+	default:
+		xbmp = wxBitmap(FNB::down_arrow_xpm);
+		break;
+	}
+
+	xbmp.SetMask(new wxMask(xbmp, MASK_COLOR));
+	// erase old bitmap
+	int posx = GetDropArrowButtonPos( pc );
+	dc.DrawBitmap(m_xBgBmp, posx, 6);
+
+	// Draw the new bitmap
+	dc.DrawBitmap(xbmp, posx, 6, true);
+}
+
+void wxFNBRenderer::DrawX(wxWindow* pageContainer, wxDC& dc)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	// Check if this style is enabled
+	long style = pc->GetParent()->GetWindowStyleFlag();
+	if(style & wxFNB_NO_X_BUTTON)
+		return;
+
+	// Make sure that there are pages in the container
+	if(pc->GetPageInfoVector().empty())
+		return;
+
+	// Set the bitmap according to the button status
+	wxBitmap xbmp;
+	switch(pc->m_nXButtonStatus)
+	{
+	case wxFNB_BTN_HOVER:
+		xbmp = wxBitmap(FNB::x_button_hilite_xpm);
+		break;
+	case wxFNB_BTN_PRESSED:
+		xbmp = wxBitmap(FNB::x_button_pressed_xpm);
+		break;
+	case wxFNB_BTN_NONE:
+	default:
+		xbmp = wxBitmap(FNB::x_button_xpm);
+		break;
+	}
+
+	xbmp.SetMask(new wxMask(xbmp, MASK_COLOR));
+	// erase old bitmap
+	int posx = GetXPos( pc );
+	dc.DrawBitmap(m_xBgBmp, posx, 6);
+
+	// Draw the new bitmap
+	dc.DrawBitmap(xbmp, posx, 6, true);
+}
+
+void wxFNBRenderer::PaintStraightGradientBox(wxDC& dc, const wxRect& rect, const wxColour& startColor, const wxColour& endColor, bool  vertical)
+{
+	int rd, gd, bd, high = 0;
+	rd = endColor.Red() - startColor.Red();
+	gd = endColor.Green() - startColor.Green();
+	bd = endColor.Blue() - startColor.Blue();
+
+	/// Save the current pen and brush
+	wxPen savedPen = dc.GetPen();
+	wxBrush savedBrush = dc.GetBrush();
+
+	if ( vertical )
+		high = rect.GetHeight()-1;
+	else
+		high = rect.GetWidth()-1;
+
+	if( high < 1 )
+		return;
+
+	for (int i = 0; i <= high; ++i)
+	{
+		int r = startColor.Red() +  ((i*rd*100)/high)/100;
+		int g = startColor.Green() + ((i*gd*100)/high)/100;
+		int b = startColor.Blue() + ((i*bd*100)/high)/100;
+
+		wxPen p(wxColor(r, g, b));
+		dc.SetPen(p);
+
+		if ( vertical )
+			dc.DrawLine(rect.x, rect.y+i, rect.x+rect.width, rect.y+i);
+		else
+			dc.DrawLine(rect.x+i, rect.y, rect.x+i, rect.y+rect.height);
+	}
+
+	/// Restore the pen and brush
+	dc.SetPen( savedPen );
+	dc.SetBrush( savedBrush );
+}
+
+void wxFNBRenderer::DrawTabX(wxWindow* pageContainer, wxDC& dc, const wxRect& rect, const int& tabIdx, const int btnStatus)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	if(!pc->HasFlag(wxFNB_X_ON_TAB))
+		return;
+
+	/// We draw the 'x' on the active tab only
+	if(tabIdx != pc->GetSelection() || tabIdx < 0)
+		return;
+
+	// Set the bitmap according to the button status
+	wxBitmap xBmp;
+	switch(btnStatus)
+	{
+	case wxFNB_BTN_HOVER:
+		xBmp = wxBitmap(FNB::x_button_hilite_xpm);
+		break;
+	case wxFNB_BTN_PRESSED:
+		xBmp = wxBitmap(FNB::x_button_pressed_xpm);
+		break;
+	case wxFNB_BTN_NONE:
+	default:
+		xBmp = wxBitmap(FNB::x_button_xpm);
+		break;
+	}
+
+	/// Set the masking
+	xBmp.SetMask(new wxMask(xBmp, MASK_COLOR));
+
+	// erase old button
+	dc.DrawBitmap(m_tabXBgBmp, rect.x, rect.y);
+
+	// Draw the new bitmap
+	dc.DrawBitmap(xBmp, rect.x, rect.y, true);
+
+	// Update the vectpr
+	pc->GetPageInfoVector()[tabIdx].SetXRect(rect);
+}
+
+void wxFNBRenderer::GetBitmap(wxDC &dc, const wxRect &rect, wxBitmap &bmp)
+{
+	wxMemoryDC mem_dc;
+	mem_dc.SelectObject(bmp);
+	mem_dc.Blit(0, 0, rect.width, rect.height, &dc, rect.x, rect.y);
+	mem_dc.SelectObject(wxNullBitmap);
+}
+
+wxColor wxFNBRenderer::RandomColor()
+{
+	int r, g, b;
+	r = rand() % 256; // Random value betweem 0-255
+	g = rand() % 256; // Random value betweem 0-255
+	b = rand() % 256; // Random value betweem 0-255
+	return wxColor(r, g, b);
+}
+
+wxColor wxFNBRenderer::LightColour(const wxColour& color, int percent)
+{
+	int rd, gd, bd, high = 0;
+	wxColor end_color = wxT("WHITE");
+	rd = end_color.Red() - color.Red();
+	gd = end_color.Green() - color.Green();
+	bd = end_color.Blue() - color.Blue();
+	high = 100;
+
+	// We take the percent way of the color from color --> white
+	int i = percent;
+	int r = color.Red() +  ((i*rd*100)/high)/100;
+	int g = color.Green() + ((i*gd*100)/high)/100;
+	int b = color.Blue() + ((i*bd*100)/high)/100;
+	return wxColor(r, g, b);
+}
+
+void wxFNBRenderer::DrawTabsLine(wxWindow* pageContainer, wxDC& dc)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	wxRect clntRect = pc->GetClientRect();
+	wxRect clientRect, clientRect2, clientRect3;
+	clientRect3 = wxRect(0, 0, clntRect.width, clntRect.height);
+
+	if(pc->HasFlag(wxFNB_BOTTOM))
+	{
+		clientRect = wxRect(0, 2, clntRect.width, clntRect.height - 2);
+		clientRect2 = wxRect(0, 1, clntRect.width, clntRect.height - 1);
+	}
+	else
+	{
+		clientRect = wxRect(0, 0, clntRect.width, clntRect.height - 2);
+		clientRect2 = wxRect(0, 0, clntRect.width, clntRect.height - 1);
+	}
+
+	dc.SetBrush(*wxTRANSPARENT_BRUSH);
+	dc.SetPen( wxPen(pc->GetSingleLineBorderColor()) );
+	dc.DrawRectangle(clientRect2);
+	dc.DrawRectangle(clientRect3);
+
+	dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)));
+	dc.DrawRectangle(clientRect);
+
+	if( !pc->HasFlag(wxFNB_TABS_BORDER_SIMPLE) )
+	{
+		dc.SetPen(wxPen( pc->HasFlag( wxFNB_VC71) ? wxColour(247, 243, 233) : pc->m_tabAreaColor));
+		dc.DrawLine(0, 0, 0, clientRect.height+1);
+		if(pc->HasFlag(wxFNB_BOTTOM))
+		{
+			dc.DrawLine(0, clientRect.height+1, clientRect.width, clientRect.height+1);
+		}
+		else
+			dc.DrawLine(0, 0, clientRect.width, 0);
+		dc.DrawLine(clientRect.width - 1, 0, clientRect.width - 1, clientRect.height+1);
+	}
+}
+
+int wxFNBRenderer::CalcTabWidth(wxWindow *pageContainer, int tabIdx, int tabHeight)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	int tabWidth, shapePoints(0), width, pom;
+	wxMemoryDC dc;
+
+	wxFont boldFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+	boldFont.SetWeight(wxFONTWEIGHT_BOLD);
+
+	if( pc->IsDefaultTabs() )
+		shapePoints = (int)(tabHeight*tan((double)pc->GetPageInfoVector()[tabIdx].GetTabAngle()/180.0*M_PI));
+
+	// Calculate the text length using the bold font, so when selecting a tab
+	// its width will not change
+	dc.SetFont(boldFont);
+	dc.GetTextExtent(pc->GetPageText(tabIdx), &width, &pom);
+
+	// Set a minimum size to a tab
+	if(width < 20)
+		width = 20;
+
+	tabWidth = ((wxFlatNotebook *)pc->m_pParent)->GetPadding() * 2 + width;
+
+	/// Style to add a small 'x' button on the top right
+	/// of the tab
+	if(pc->HasFlag(wxFNB_X_ON_TAB) && tabIdx == pc->GetSelection())
+	{
+		/// The xpm image that contains the 'x' button is 9 pixles
+		tabWidth += ((wxFlatNotebook *)pc->m_pParent)->GetPadding() + 9;
+	}
+
+	if( pc->IsDefaultTabs() )
+		// Default style
+		tabWidth += 2 * shapePoints;
+
+	bool hasImage = (pc->m_ImageList != NULL && pc->GetPageInfoVector()[tabIdx].GetImageIndex() != -1);
+
+	// For VC71 style, we only add the icon size (16 pixels)
+	if(hasImage)
+	{
+		if( ! pc->IsDefaultTabs() )
+			tabWidth += (16 + ((wxFlatNotebook*)pc->m_pParent)->GetPadding());
+		else
+			// Default style
+			tabWidth += (16 + ((wxFlatNotebook*)pc->m_pParent)->GetPadding()) + shapePoints / 2;
+	}
+	return tabWidth;
+}
+
+int wxFNBRenderer::CalcTabHeight(wxWindow *pageContainer)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	int tabHeight;
+	wxMemoryDC dc;
+
+	// For GTK it seems that we must do this steps in order
+	// for the tabs will get the proper height on initialization
+	// on MSW, preforming these steps yields wierd results
+	wxFont normalFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+	wxFont boldFont = normalFont;
+	boldFont.SetWeight(wxFONTWEIGHT_BOLD);
+#ifdef __WXGTK__
+	dc.SetFont( boldFont );
+#endif
+
+	static int height(-1);
+	static int width(-1);
+
+	if( height == -1 && width == -1 )
+	{
+		wxString stam = wxT("Tp");	// Temp data to get the text height;
+		dc.GetTextExtent(stam, &width, &height);
+	}
+
+	tabHeight = height + wxFNB_HEIGHT_SPACER; // We use 8 pixels as padding
+#ifdef __WXGTK__
+	// On GTK the tabs are should be larger
+	tabHeight += 6;
+#endif
+
+	if( pc->HasFlag( wxFNB_VC71 ) )
+		tabHeight = (pc->HasFlag(wxFNB_BOTTOM)) ? tabHeight - 4 :  tabHeight;
+	else if(pc->HasFlag(wxFNB_FANCY_TABS))
+		tabHeight = (pc->HasFlag(wxFNB_BOTTOM)) ? tabHeight - 2 :  tabHeight;
+
+	return tabHeight;
+}
+
+void wxFNBRenderer::DrawTabs(wxWindow *pageContainer, wxDC &dc)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+#ifndef __WXMAC__
+	// Works well on MSW & GTK, however this lines should be skipped on MAC
+	if(pc->GetPageInfoVector().empty() || pc->m_nFrom >= (int)pc->GetPageInfoVector().GetCount())
+	{
+		pc->Hide();
+		return;
+	}
+#endif
+
+	// Get the text hight
+	int tabHeight = CalcTabHeight(pageContainer);
+	long style = pc->GetParent()->GetWindowStyleFlag();
+
+	// Calculate the number of rows required for drawing the tabs
+	wxRect rect = pc->GetClientRect();
+	int clientWidth = rect.width;
+
+	// Set the maximum client size
+	pc->SetSizeHints(wxSize(GetButtonsAreaLength( pc ), tabHeight));
+	wxPen borderPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
+
+	wxBrush backBrush;
+	if(style & wxFNB_VC71)
+		backBrush = wxBrush(wxColour(247, 243, 233));
+	else
+		backBrush = wxBrush(pc->m_tabAreaColor);
+
+	wxBrush noselBrush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
+	wxBrush selBrush = wxBrush(pc->m_activeTabColor);
+
+	wxSize size = pc->GetSize();
+
+	// Background
+    dc.SetTextBackground((style & wxFNB_VC71 ? wxColour(247, 243, 233) : pc->GetBackgroundColour()));
+	dc.SetTextForeground(pc->m_activeTextColor);
+	dc.SetBrush(backBrush);
+
+	// If border style is set, set the pen to be border pen
+	if(pc->HasFlag(wxFNB_TABS_BORDER_SIMPLE))
+		dc.SetPen(borderPen);
+	else
+	{
+		wxColor colr = pc->HasFlag( wxFNB_VC71 ) ? wxColour(247, 243, 233) : pc->GetBackgroundColour();
+		dc.SetPen( wxPen(colr) );
+	}
+	dc.DrawRectangle(0, 0, size.x, size.y);
+
+	// Take 3 bitmaps for the background for the buttons
+	{
+		wxMemoryDC mem_dc;
+		wxRect rect;
+
+		//---------------------------------------
+		// X button
+		//---------------------------------------
+		rect = wxRect(GetXPos( pc ), 6, 16, 14);
+		mem_dc.SelectObject(m_xBgBmp);
+		mem_dc.Blit(0, 0, rect.width, rect.height, &dc, rect.x, rect.y);
+		mem_dc.SelectObject(wxNullBitmap);
+
+		//---------------------------------------
+		// Right button
+		//---------------------------------------
+		rect = wxRect(GetRightButtonPos( pc ), 6, 16, 14);
+		mem_dc.SelectObject(m_rightBgBmp);
+		mem_dc.Blit(0, 0, rect.width, rect.height, &dc, rect.x, rect.y);
+		mem_dc.SelectObject(wxNullBitmap);
+
+		//---------------------------------------
+		// Left button
+		//---------------------------------------
+		rect = wxRect(GetLeftButtonPos( pc ), 6, 16, 14);
+		mem_dc.SelectObject(m_leftBgBmp);
+		mem_dc.Blit(0, 0, rect.width, rect.height, &dc, rect.x, rect.y);
+		mem_dc.SelectObject(wxNullBitmap);
+	}
+
+	// We always draw the bottom/upper line of the tabs
+	// regradless the style
+	dc.SetPen(borderPen);
+	DrawTabsLine(pc, dc);
+
+	// Restore the pen
+	dc.SetPen(borderPen);
+
+	if(pc->HasFlag( wxFNB_VC71 ))
+	{
+		int greyLineYVal  = pc->HasFlag( wxFNB_BOTTOM ) ? 0 : size.y - 2;
+		int whiteLineYVal = pc->HasFlag( wxFNB_BOTTOM ) ? 3 : size.y - 3;
+
+		wxPen pen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+		dc.SetPen(pen);
+
+		// Draw thik grey line between the windows area and
+		// the tab area
+		int num = 0;
+		for(; num<3; num++)
+			dc.DrawLine(0, greyLineYVal + num, size.x, greyLineYVal + num);
+
+		wxPen wbPen = pc->HasFlag(wxFNB_BOTTOM) ? *wxBLACK_PEN : *wxWHITE_PEN;
+		dc.SetPen( wbPen );
+		dc.DrawLine(1, whiteLineYVal, size.x - 1, whiteLineYVal);
+
+		// Restore the pen
+		dc.SetPen(borderPen);
+	}
+
+#ifdef __WXMAC__
+	// On MAC, Add these lines so the tab background gets painted
+	if(pc->GetPageInfoVector().empty() || pc->m_nFrom >= (int)pc->GetPageInfoVector().GetCount())
+	{
+		pc->Hide();
+		return;
+	}
+#endif
+
+	// Draw labels
+	wxFont normalFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+	wxFont boldFont = normalFont;
+	boldFont.SetWeight(wxFONTWEIGHT_BOLD);
+	dc.SetFont(boldFont);
+
+	int posx = ((wxFlatNotebook *)pc->m_pParent)->GetPadding();
+	int i = 0;
+
+	// Update all the tabs from 0 to 'pc->m_nFrom' to be non visible
+	for(i=0; i<pc->m_nFrom; i++)
+	{
+		pc->GetPageInfoVector()[i].SetPosition(wxPoint(-1, -1));
+		pc->GetPageInfoVector()[i].GetRegion().Clear();
+	}
+
+	//----------------------------------------------------------
+	// Go over and draw the visible tabs
+	//----------------------------------------------------------
+	for(i=pc->m_nFrom; i<(int)pc->GetPageInfoVector().GetCount(); i++)
+	{
+		dc.SetPen(borderPen);
+		dc.SetBrush((i==pc->GetSelection()) ? selBrush : noselBrush);
+
+		// Now set the font to the correct font
+		dc.SetFont((i==pc->GetSelection()) ? boldFont : normalFont);
+
+		// Add the padding to the tab width
+		// Tab width:
+		// +-----------------------------------------------------------+
+		// | PADDING | IMG | IMG_PADDING | TEXT | PADDING | x |PADDING |
+		// +-----------------------------------------------------------+
+		int tabWidth = CalcTabWidth(pageContainer, i, tabHeight);
+
+		// Check if we can draw more
+		if(posx + tabWidth + GetButtonsAreaLength( pc ) >= clientWidth)
+			break;
+
+		// By default we clean the tab region
+		pc->GetPageInfoVector()[i].GetRegion().Clear();
+
+		// Clean the 'x' buttn on the tab.
+		// A 'Clean' rectanlge, is a rectangle with width or height
+		// with values lower than or equal to 0
+		pc->GetPageInfoVector()[i].GetXRect().SetSize(wxSize(-1, -1));
+
+		// Draw the tab (border, text, image & 'x' on tab)
+		DrawTab(pc, dc, posx, i, tabWidth, tabHeight, pc->m_nTabXButtonStatus);
+
+		// Restore the text forground
+		dc.SetTextForeground(pc->m_activeTextColor);
+
+		// Update the tab position & size
+		int posy = pc->HasFlag(wxFNB_BOTTOM) ? 0 : VERTICAL_BORDER_PADDING;
+
+		pc->GetPageInfoVector()[i].SetPosition(wxPoint(posx, posy));
+		pc->GetPageInfoVector()[i].SetSize(wxSize(tabWidth, tabHeight));
+		posx += tabWidth;
+	}
+
+	// Update all tabs that can not fit into the screen as non-visible
+	for(; i<(int)pc->GetPageInfoVector().GetCount(); i++)
+	{
+		pc->GetPageInfoVector()[i].SetPosition(wxPoint(-1, -1));
+		pc->GetPageInfoVector()[i].GetRegion().Clear();
+	}
+
+	// Draw the left/right/close buttons
+	// Left arrow
+	DrawLeftArrow(pc, dc);
+	DrawRightArrow(pc, dc);
+	DrawX(pc, dc);
+	DrawDropDownArrow(pc, dc);
+}
+
+//------------------------------------------
+// Renderer manager
+//------------------------------------------
+wxFNBRendererMgr::wxFNBRendererMgr()
+{
+	// register renderers
+	m_renderers[-1] = wxFNBRendererPtr(new wxFNBRendererDefault());
+	m_renderers[wxFNB_VC71] = wxFNBRendererPtr(new wxFNBRendererVC71());
+	m_renderers[wxFNB_FANCY_TABS] = wxFNBRendererPtr(new wxFNBRendererFancy());
+	m_renderers[wxFNB_VC8] = wxFNBRendererPtr(new wxFNBRendererVC8());
+}
+
+wxFNBRendererMgr::~wxFNBRendererMgr()
+{
+}
+
+wxFNBRendererPtr wxFNBRendererMgr::GetRenderer(long style)
+{
+	// since we dont have a style for default tabs, we
+	// test for all others - FIXME: add style for default tabs
+	if( !(style & wxFNB_VC71) && !(style & wxFNB_VC8) && !(style & wxFNB_FANCY_TABS) )
+		return m_renderers[-1];
+
+	if( style & wxFNB_VC71 )
+		return m_renderers[wxFNB_VC71];
+
+	if( style & wxFNB_FANCY_TABS )
+		return m_renderers[wxFNB_FANCY_TABS];
+
+	if( style & wxFNB_VC8 )
+		return m_renderers[wxFNB_VC8];
+
+	// the default is to return the default renderer
+	return m_renderers[-1];
+}
+
+//------------------------------------------
+// Default renderer
+//------------------------------------------
+
+void wxFNBRendererDefault::DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus)
+{
+		// Default style
+	wxPen borderPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+
+	wxPoint tabPoints[7];
+	tabPoints[0].x = posx;
+	tabPoints[0].y = pc->HasFlag(wxFNB_BOTTOM) ? 2 : tabHeight - 2;
+
+	tabPoints[1].x = (int)(posx+(tabHeight-2)*tan((double)(pc->GetPageInfoVector())[tabIdx].GetTabAngle()/180.0*M_PI));
+	tabPoints[1].y = pc->HasFlag(wxFNB_BOTTOM) ? tabHeight - (VERTICAL_BORDER_PADDING+2) : (VERTICAL_BORDER_PADDING+2);
+
+	tabPoints[2].x = tabPoints[1].x+2;
+	tabPoints[2].y = pc->HasFlag(wxFNB_BOTTOM) ? tabHeight - VERTICAL_BORDER_PADDING : VERTICAL_BORDER_PADDING;
+
+	tabPoints[3].x = (int)(posx+tabWidth-(tabHeight-2)*tan((double)(pc->GetPageInfoVector())[tabIdx].GetTabAngle()/180.0*M_PI))-2;
+	tabPoints[3].y = pc->HasFlag(wxFNB_BOTTOM) ? tabHeight - VERTICAL_BORDER_PADDING : VERTICAL_BORDER_PADDING;
+
+	tabPoints[4].x = tabPoints[3].x+2;
+	tabPoints[4].y = pc->HasFlag(wxFNB_BOTTOM) ? tabHeight - (VERTICAL_BORDER_PADDING+2) : (VERTICAL_BORDER_PADDING+2);
+
+	tabPoints[5].x = (int)(tabPoints[4].x+(tabHeight-2)*tan((double)(pc->GetPageInfoVector())[tabIdx].GetTabAngle()/180.0*M_PI));
+	tabPoints[5].y = pc->HasFlag(wxFNB_BOTTOM) ? 2 : tabHeight - 2;
+
+	tabPoints[6].x = tabPoints[0].x;
+	tabPoints[6].y = tabPoints[0].y;
+
+	if(tabIdx == pc->GetSelection())
+	{
+		// Draw the tab as rounded rectangle
+		dc.DrawPolygon(7, tabPoints);
+	}
+	else
+	{
+		if(tabIdx != pc->GetSelection() - 1)
+		{
+			// Draw a vertical line to the right of the text
+			int pt1x, pt1y, pt2x, pt2y;
+			pt1x = tabPoints[5].x;
+			pt1y = pc->HasFlag(wxFNB_BOTTOM) ? 4 : tabHeight - 6;
+			pt2x = tabPoints[5].x;
+			pt2y = pc->HasFlag(wxFNB_BOTTOM) ? tabHeight - 4 : 4 ;
+			dc.DrawLine(pt1x, pt1y, pt2x, pt2y);
+		}
+	}
+
+	if(tabIdx == pc->GetSelection())
+	{
+		wxPen savePen = dc.GetPen();
+		wxPen whitePen = wxPen(*wxWHITE);
+		whitePen.SetWidth(1);
+		dc.SetPen(whitePen);
+
+		wxPoint secPt = wxPoint(tabPoints[5].x + 1, tabPoints[5].y);
+		dc.DrawLine(tabPoints[0], secPt);
+
+		// Restore the pen
+		dc.SetPen(savePen);
+	}
+
+	// -----------------------------------
+	// Text and image drawing
+	// -----------------------------------
+
+	// Text drawing offset from the left border of the
+	// rectangle
+	int textOffset;
+
+	// The width of the images are 16 pixels
+	int padding = static_cast<wxFlatNotebook*>( pc->GetParent() )->GetPadding();
+	int shapePoints = (int)(tabHeight * tan((double)pc->GetPageInfoVector()[tabIdx].GetTabAngle()/180.0*M_PI));
+	bool hasImage = pc->GetPageInfoVector()[tabIdx].GetImageIndex() != -1;
+	int imageYCoord = pc->HasFlag(wxFNB_BOTTOM) ? 6 : 8;
+
+	hasImage ? textOffset = padding * 2 + 16 + shapePoints / 2 : textOffset = padding + shapePoints / 2 ;
+	textOffset += 2;
+
+	if(tabIdx != pc->GetSelection())
+	{
+		// Set the text background to be like the vertical lines
+		dc.SetTextForeground( pc->GetNonoActiveTextColor() );
+	}
+
+	if(hasImage)
+	{
+		int imageXOffset = textOffset - 16 - padding;
+		dc.DrawBitmap((*pc->GetImageList())[pc->GetPageInfoVector()[tabIdx].GetImageIndex()],
+			posx + imageXOffset, imageYCoord, true);
+	}
+
+	dc.DrawText(pc->GetPageText(tabIdx), posx + textOffset, imageYCoord);
+
+	// draw 'x' on tab (if enabled)
+	if(pc->HasFlag(wxFNB_X_ON_TAB) && tabIdx == pc->GetSelection())
+	{
+		int textWidth, textHeight;
+		dc.GetTextExtent(pc->GetPageText(tabIdx), &textWidth, &textHeight);
+		int tabCloseButtonXCoord = posx + textOffset + textWidth + 1;
+
+		// take a bitmap from the position of the 'x' button (the x on tab button)
+		// this bitmap will be used later to delete old buttons
+		int tabCloseButtonYCoord = imageYCoord;
+		wxRect x_rect(tabCloseButtonXCoord, tabCloseButtonYCoord, 16, 16);
+		GetBitmap(dc, x_rect, m_tabXBgBmp);
+
+		// Draw the tab
+		DrawTabX(pc, dc, x_rect, tabIdx, btnStatus);
+	}
+}
+
+//------------------------------------------------------------------
+// Visual studio 7.1
+//------------------------------------------------------------------
+
+void wxFNBRendererVC71::DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus)
+{
+		// Visual studio 7.1 style
+	wxPen borderPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+
+	dc.SetPen((tabIdx == pc->GetSelection()) ? wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)) : borderPen);
+    dc.SetBrush(((tabIdx == pc->GetSelection()) ? wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)) : wxBrush(wxColour(247, 243, 233))));
+
+	if(tabIdx == pc->GetSelection())
+	{
+		int posy = pc->HasFlag(wxFNB_BOTTOM) ? 0 : VERTICAL_BORDER_PADDING;
+		dc.DrawRectangle(posx, posy, tabWidth, tabHeight - 1);
+
+		// Draw a black line on the left side of the
+		// rectangle
+		wxPen pen = wxPen(*wxBLACK);
+		dc.SetPen(pen);
+
+		int blackLineY1 = VERTICAL_BORDER_PADDING;
+		int blackLineY2 = pc->HasFlag(wxFNB_BOTTOM) ? pc->GetSize().y - 5 : pc->GetSize().y - 3;
+		dc.DrawLine(posx + tabWidth, blackLineY1, posx + tabWidth, blackLineY2);
+
+		// To give the tab more 3D look we do the following
+		// Incase the tab is on top,
+		// Draw a thik white line on topof the rectangle
+		// Otherwise, draw a thin (1 pixel) black line at the bottom
+
+		pen = wxPen(pc->HasFlag(wxFNB_BOTTOM) ? *wxBLACK : *wxWHITE);
+		dc.SetPen(pen);
+		int whiteLinePosY = pc->HasFlag(wxFNB_BOTTOM) ? blackLineY2 : VERTICAL_BORDER_PADDING ;
+		dc.DrawLine(posx , whiteLinePosY, posx + tabWidth + 1, whiteLinePosY);
+
+		// Draw a white vertical line to the left of the tab
+		dc.SetPen( *wxWHITE_PEN );
+		if( !pc->HasFlag(wxFNB_BOTTOM) ) blackLineY2 += 1;
+		dc.DrawLine(posx, blackLineY1, posx, blackLineY2);
+	}
+	else
+	{
+		// We dont draw a rectangle for non selected tabs, but only
+		// vertical line on the left
+
+		int blackLineY1 = pc->HasFlag(wxFNB_BOTTOM) ? VERTICAL_BORDER_PADDING + 2 : VERTICAL_BORDER_PADDING + 1;
+		int blackLineY2 = pc->GetSize().y - 5 ;
+		dc.DrawLine(posx + tabWidth, blackLineY1, posx + tabWidth, blackLineY2);
+	}
+
+	// -----------------------------------
+	// Text and image drawing
+	// -----------------------------------
+
+	// Text drawing offset from the left border of the
+	// rectangle
+	int textOffset;
+
+	// The width of the images are 16 pixels
+	int padding = static_cast<wxFlatNotebook*>( pc->GetParent() )->GetPadding();
+	bool hasImage = pc->GetPageInfoVector()[tabIdx].GetImageIndex() != -1;
+	int imageYCoord = pc->HasFlag(wxFNB_BOTTOM) ? 6 : 8;
+
+	hasImage ? textOffset = padding * 2 + 16 : textOffset = padding;
+
+	if(tabIdx != pc->GetSelection())
+	{
+		// Set the text background to be like the vertical lines
+		dc.SetTextForeground(pc->GetNonoActiveTextColor());
+	}
+
+	if(hasImage)
+	{
+		int imageXOffset = textOffset - 16 - padding;
+		dc.DrawBitmap((*pc->GetImageList())[pc->GetPageInfoVector()[tabIdx].GetImageIndex()],
+			posx + imageXOffset, imageYCoord, true);
+	}
+
+	dc.DrawText(pc->GetPageText(tabIdx), posx + textOffset, imageYCoord);
+
+	// draw 'x' on tab (if enabled)
+	if(pc->HasFlag(wxFNB_X_ON_TAB) && tabIdx == pc->GetSelection())
+	{
+		int textWidth, textHeight;
+		dc.GetTextExtent(pc->GetPageText(tabIdx), &textWidth, &textHeight);
+		int tabCloseButtonXCoord = posx + textOffset + textWidth + 1;
+
+		// take a bitmap from the position of the 'x' button (the x on tab button)
+		// this bitmap will be used later to delete old buttons
+		int tabCloseButtonYCoord = imageYCoord;
+		wxRect x_rect(tabCloseButtonXCoord, tabCloseButtonYCoord, 16, 16);
+		GetBitmap(dc, x_rect, m_tabXBgBmp);
+
+		// Draw the tab
+		DrawTabX(pc, dc, x_rect, tabIdx, btnStatus);
+	}
+}
+
+//------------------------------------------------------------------
+// Fancy style
+//------------------------------------------------------------------
+
+void wxFNBRendererFancy::DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus)
+{
+		// Fancy tabs - like with VC71 but with the following differences:
+	// - The Selected tab is colored with gradient color
+	wxPen borderPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+
+	wxPen pen = (tabIdx == pc->GetSelection()) ? wxPen( pc->GetBorderColour() ) : wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+
+	if(tabIdx == pc->GetSelection())
+	{
+		int posy = pc->HasFlag(wxFNB_BOTTOM) ? 2 : VERTICAL_BORDER_PADDING;
+		int th = pc->HasFlag(wxFNB_BOTTOM) ? tabHeight - 2: tabHeight - 5;
+
+		wxRect rect(posx, posy, tabWidth, th);
+
+		wxColour col2 = (pc->HasFlag( wxFNB_BOTTOM ) ) ? pc->GetGradientColourTo() : pc->GetGradientColourFrom();
+		wxColour col1 = (pc->HasFlag( wxFNB_BOTTOM ) ) ? pc->GetGradientColourFrom() : pc->GetGradientColourTo();
+
+		PaintStraightGradientBox(dc, rect, col1, col2);
+		dc.SetBrush(*wxTRANSPARENT_BRUSH);
+		dc.SetPen(pen);
+		dc.DrawRectangle(rect);
+
+		// erase the bottom/top line of the rectangle
+		dc.SetPen( wxPen( pc->GetGradientColourFrom() ) );
+		if(pc->HasFlag(wxFNB_BOTTOM))
+            dc.DrawLine(rect.x, 2, rect.x + rect.width, 2);
+		else
+			dc.DrawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width, rect.y + rect.height - 1);
+	}
+	else
+	{
+		// We dont draw a rectangle for non selected tabs, but only
+		// vertical line on the left
+		dc.SetPen(borderPen);
+		dc.DrawLine(posx + tabWidth, VERTICAL_BORDER_PADDING + 3, posx + tabWidth, tabHeight - 4);
+	}
+
+	// -----------------------------------
+	// Text and image drawing
+	// -----------------------------------
+
+	// Text drawing offset from the left border of the
+	// rectangle
+	int textOffset;
+
+	// The width of the images are 16 pixels
+	int padding = static_cast<wxFlatNotebook*>( pc->GetParent() )->GetPadding();
+	bool hasImage = pc->GetPageInfoVector()[tabIdx].GetImageIndex() != -1;
+	int imageYCoord = pc->HasFlag(wxFNB_BOTTOM) ? 6 : 8;
+
+	hasImage ? textOffset = padding * 2 + 16 : textOffset = padding ;
+
+	if(tabIdx != pc->GetSelection())
+	{
+		// Set the text background to be like the vertical lines
+		dc.SetTextForeground(pc->GetNonoActiveTextColor());
+	}
+
+	if(hasImage)
+	{
+		int imageXOffset = textOffset - 16 - padding;
+		dc.DrawBitmap((*pc->GetImageList())[pc->GetPageInfoVector()[tabIdx].GetImageIndex()],
+			posx + imageXOffset, imageYCoord, true);
+	}
+
+	dc.DrawText(pc->GetPageText(tabIdx), posx + textOffset, imageYCoord);
+
+	// draw 'x' on tab (if enabled)
+	if(pc->HasFlag(wxFNB_X_ON_TAB) && tabIdx == pc->GetSelection())
+	{
+		int textWidth, textHeight;
+		dc.GetTextExtent(pc->GetPageText(tabIdx), &textWidth, &textHeight);
+		int tabCloseButtonXCoord = posx + textOffset + textWidth + 1;
+
+		// take a bitmap from the position of the 'x' button (the x on tab button)
+		// this bitmap will be used later to delete old buttons
+		int tabCloseButtonYCoord = imageYCoord;
+		wxRect x_rect(tabCloseButtonXCoord, tabCloseButtonYCoord, 16, 16);
+		GetBitmap(dc, x_rect, m_tabXBgBmp);
+
+		// Draw the tab
+		DrawTabX(pc, dc, x_rect, tabIdx, btnStatus);
+	}
+}
+
+//------------------------------------------------------------------
+// Visual studio 2005 (VS8)
+//------------------------------------------------------------------
+void wxFNBRendererVC8::DrawTabs(wxWindow *pageContainer, wxDC &dc)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+
+#ifndef __WXMAC__
+	// Works well on MSW & GTK, however this lines should be skipped on MAC
+	if(pc->GetPageInfoVector().empty() || pc->m_nFrom >= (int)pc->GetPageInfoVector().GetCount())
+	{
+		pc->Hide();
+		return;
+	}
+#endif
+
+	// Get the text hight
+	int tabHeight = CalcTabHeight( pageContainer );
+
+	// Set the font for measuring the tab height
+	wxFont normalFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+	wxFont boldFont = normalFont;
+	boldFont.SetWeight(wxFONTWEIGHT_BOLD);
+
+	// Calculate the number of rows required for drawing the tabs
+	wxRect rect = pc->GetClientRect();
+
+	// Set the maximum client size
+	pc->SetSizeHints(wxSize(GetButtonsAreaLength( pc ), tabHeight));
+	wxPen borderPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
+
+	/// Create brushes
+	wxBrush backBrush;
+	backBrush = wxBrush(pc->m_tabAreaColor);
+	wxBrush noselBrush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
+	wxBrush selBrush = wxBrush(pc->m_activeTabColor);
+	wxSize size = pc->GetSize();
+
+	// Background
+	dc.SetTextBackground(pc->GetBackgroundColour());
+	dc.SetTextForeground(pc->m_activeTextColor);
+
+	// If border style is set, set the pen to be border pen
+	if( pc->HasFlag(wxFNB_TABS_BORDER_SIMPLE) )
+		dc.SetPen(borderPen);
+	else
+		dc.SetPen(*wxTRANSPARENT_PEN);
+
+	int lightFactor = pc->HasFlag(wxFNB_BACKGROUND_GRADIENT) ? 70 : 0;
+	/// For VC8 style, we color the tab area in gradient coloring
+	PaintStraightGradientBox(dc, pc->GetClientRect(), pc->m_tabAreaColor, LightColour(pc->m_tabAreaColor, lightFactor));
+
+	dc.SetBrush(*wxTRANSPARENT_BRUSH);
+	dc.DrawRectangle(0, 0, size.x, size.y);
+
+	// Take 3 bitmaps for the background for the buttons
+	{
+		wxMemoryDC mem_dc;
+		wxRect rect;
+
+		//---------------------------------------
+		// X button
+		//---------------------------------------
+		rect = wxRect(GetXPos( pc ), 6, 16, 14);
+		mem_dc.SelectObject(m_xBgBmp);
+		mem_dc.Blit(0, 0, rect.width, rect.height, &dc, rect.x, rect.y);
+		mem_dc.SelectObject(wxNullBitmap);
+
+		//---------------------------------------
+		// Right button
+		//---------------------------------------
+		rect = wxRect(GetRightButtonPos( pc ), 6, 16, 14);
+		mem_dc.SelectObject(m_rightBgBmp);
+		mem_dc.Blit(0, 0, rect.width, rect.height, &dc, rect.x, rect.y);
+		mem_dc.SelectObject(wxNullBitmap);
+
+		//---------------------------------------
+		// Left button
+		//---------------------------------------
+		rect = wxRect(GetLeftButtonPos( pc ), 6, 16, 14);
+		mem_dc.SelectObject(m_leftBgBmp);
+		mem_dc.Blit(0, 0, rect.width, rect.height, &dc, rect.x, rect.y);
+		mem_dc.SelectObject(wxNullBitmap);
+	}
+
+	// We always draw the bottom/upper line of the tabs
+	// regradless the style
+	dc.SetPen(borderPen);
+	DrawTabsLine(pc, dc);
+
+	// Restore the pen
+	dc.SetPen(borderPen);
+
+	// Draw labels
+	dc.SetFont(boldFont);
+	int posx;
+	int i = 0, cur = 0;
+
+	// Update all the tabs from 0 to 'pc->m_nFrom' to be non visible
+	for(i=0; i<pc->m_nFrom; i++)
+	{
+		pc->GetPageInfoVector()[i].SetPosition(wxPoint(-1, -1));
+		pc->GetPageInfoVector()[i].GetRegion().Clear();
+	}
+
+	// Draw the visible tabs, in VC8 style, we draw them from right to left
+	std::vector<wxRect> vTabsInfo;
+	NumberTabsCanFit(pc, vTabsInfo);
+	int activeTabPosx(0);
+	int activeTabWidth(0);
+	int	activeTabHeight(0);
+
+	for(cur=(int)vTabsInfo.size() - 1; cur>=0; cur--)
+	{
+		/// 'i' points to the index of the currently drawn tab
+		/// in pc->GetPageInfoVector() vector
+		i = pc->m_nFrom + cur;
+		dc.SetPen(borderPen);
+		dc.SetBrush((i==pc->GetSelection()) ? selBrush : noselBrush);
+
+		// Now set the font to the correct font
+		dc.SetFont((i==pc->GetSelection()) ? boldFont : normalFont);
+
+		// Add the padding to the tab width
+		// Tab width:
+		// +-----------------------------------------------------------+
+		// | PADDING | IMG | IMG_PADDING | TEXT | PADDING | x |PADDING |
+		// +-----------------------------------------------------------+
+
+		int tabWidth = CalcTabWidth( pageContainer, i, tabHeight );
+		posx = vTabsInfo[cur].x;
+
+		// By default we clean the tab region
+		// incase we use the VC8 style which requires
+		// the region, it will be filled by the function
+		// drawVc8Tab
+		pc->GetPageInfoVector()[i].GetRegion().Clear();
+
+		// Clean the 'x' buttn on the tab
+		// 'Clean' rectanlge is a rectangle with width or height
+		// with values lower than or equal to 0
+		pc->GetPageInfoVector()[i].GetXRect().SetSize(wxSize(-1, -1));
+
+		// Draw the tab
+		// Incase we are drawing the active tab
+		// we need to redraw so it will appear on top
+		// of all other tabs
+
+		// when using the vc8 style, we keep the position of the active tab so we will draw it again later
+		if( i == pc->GetSelection() && pc->HasFlag( wxFNB_VC8 ) )
+		{
+			activeTabPosx = posx;
+			activeTabWidth = tabWidth;
+			activeTabHeight = tabHeight;
+		}
+		else
+		{
+			DrawTab(pc, dc, posx, i, tabWidth, tabHeight, pc->m_nTabXButtonStatus);
+		}
+
+		// Restore the text forground
+		dc.SetTextForeground(pc->m_activeTextColor);
+
+		// Update the tab position & size
+		pc->GetPageInfoVector()[i].SetPosition(wxPoint(posx, VERTICAL_BORDER_PADDING));
+		pc->GetPageInfoVector()[i].SetSize(wxSize(tabWidth, tabHeight));
+	}
+
+	// Incase we are in VC8 style, redraw the active tab (incase it is visible)
+	if(pc->GetSelection() >= pc->m_nFrom && pc->GetSelection()< pc->m_nFrom + (int)vTabsInfo.size() )
+	{
+		DrawTab(pc, dc, activeTabPosx, pc->GetSelection(), activeTabWidth, activeTabHeight, pc->m_nTabXButtonStatus);
+	}
+
+	// Update all tabs that can not fit into the screen as non-visible
+	int xx;
+	for(xx = pc->m_nFrom + (int)vTabsInfo.size(); xx<(int)pc->GetPageInfoVector().size(); xx++)
+	{
+		pc->GetPageInfoVector()[xx].SetPosition(wxPoint(-1, -1));
+		pc->GetPageInfoVector()[xx].GetRegion().Clear();
+	}
+
+	// Draw the left/right/close buttons
+	// Left arrow
+	DrawLeftArrow(pc, dc);
+	DrawRightArrow(pc, dc);
+	DrawX(pc, dc);
+	DrawDropDownArrow(pc, dc);
+}
+
+void wxFNBRendererVC8::DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus)
+{
+	wxUnusedVar( btnStatus );
+
+	// Fancy tabs - like with VC71 but with the following differences:
+	// - The Selected tab is colored with gradient color
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	wxPen borderPen = wxPen( pc->GetBorderColour() );
+	wxPoint tabPoints[8];
+
+	// If we draw the first tab or the active tab,
+	// we draw a full tab, else we draw a truncated tab
+	//
+	//             X(2)                  X(3)
+	//        X(1)                            X(4)
+	//
+	//                                           X(5)
+	//
+	// X(0),(7)                                  X(6)
+	//
+	//
+
+	tabPoints[0].x = pc->HasFlag( wxFNB_BOTTOM ) ? posx : posx + m_factor;
+	tabPoints[0].y = pc->HasFlag( wxFNB_BOTTOM ) ? 2 : tabHeight - 3;
+
+	tabPoints[1].x = tabPoints[0].x + tabHeight - VERTICAL_BORDER_PADDING - 3 - m_factor;
+	tabPoints[1].y = pc->HasFlag( wxFNB_BOTTOM ) ? tabHeight  - (VERTICAL_BORDER_PADDING+2) : (VERTICAL_BORDER_PADDING+2);
+
+	tabPoints[2].x = tabPoints[1].x + 4;
+	tabPoints[2].y = pc->HasFlag( wxFNB_BOTTOM ) ? tabHeight  - VERTICAL_BORDER_PADDING : VERTICAL_BORDER_PADDING;
+
+	tabPoints[3].x = tabPoints[2].x + tabWidth - 2;
+	tabPoints[3].y = pc->HasFlag( wxFNB_BOTTOM ) ? tabHeight  - VERTICAL_BORDER_PADDING : VERTICAL_BORDER_PADDING;
+
+	tabPoints[4].x = tabPoints[3].x + 1;
+	tabPoints[4].y = pc->HasFlag( wxFNB_BOTTOM ) ? tabPoints[3].y - 1 : tabPoints[3].y + 1;
+
+	tabPoints[5].x = tabPoints[4].x + 1;
+	tabPoints[5].y = pc->HasFlag( wxFNB_BOTTOM ) ? (tabPoints[4].y - 1 ): tabPoints[4].y + 1;
+
+	tabPoints[6].x = tabPoints[2].x + tabWidth;
+	tabPoints[6].y = tabPoints[0].y;
+
+	tabPoints[7].x = tabPoints[0].x;
+	tabPoints[7].y = tabPoints[0].y;
+
+	pc->GetPageInfoVector()[tabIdx].SetRegion(8, tabPoints);
+
+	// Draw the polygon
+	wxBrush br = dc.GetBrush();
+	dc.SetBrush(wxBrush(tabIdx == pc->GetSelection() ? pc->GetActiveTabColour() : pc->GetGradientColourTo() ));
+	dc.SetPen(wxPen(tabIdx == pc->GetSelection() ? wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW) : pc->GetBorderColour()));
+	dc.DrawPolygon(8, tabPoints);
+
+	// Restore the brush
+	dc.SetBrush(br);
+
+	wxRect rect = pc->GetClientRect();
+
+	if(tabIdx != pc->GetSelection() && !pc->HasFlag( wxFNB_BOTTOM ))
+	{
+		// Top default tabs
+		dc.SetPen(wxPen( pc->GetBorderColour() ));
+		int lineY = rect.height;
+		wxPen curPen = dc.GetPen();
+		curPen.SetWidth(1);
+		dc.SetPen(curPen);
+		dc.DrawLine(posx, lineY, posx+rect.width, lineY);
+	}
+
+	// Incase we are drawing the selected tab, we draw the border of it as well
+	// but without the bottom (upper line incase of wxBOTTOM)
+	if(tabIdx == pc->GetSelection())
+	{
+		wxPen borderPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
+		wxBrush brush(*wxTRANSPARENT_BRUSH);
+		dc.SetPen(borderPen);
+		dc.SetBrush(brush);
+		dc.DrawPolygon(8, tabPoints);
+
+		// Delete the bottom line (or the upper one, incase we use wxBOTTOM)
+		dc.SetPen(wxPen(wxT("WHITE")));
+		dc.DrawLine(tabPoints[0], tabPoints[6]);
+	}
+
+
+	FillVC8GradientColor(pc, dc, tabPoints, tabIdx == pc->GetSelection(), tabIdx);
+
+	// Draw a thin line to the right of the non-selected tab
+	if(tabIdx != pc->GetSelection())
+	{
+		dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)));
+		dc.DrawLine(tabPoints[4].x-1, tabPoints[4].y, tabPoints[5].x-1, tabPoints[5].y);
+		dc.DrawLine(tabPoints[5].x-1, tabPoints[5].y, tabPoints[6].x-1, tabPoints[6].y);
+	}
+
+	// Text drawing offset from the left border of the
+	// rectangle
+	int textOffset;
+
+	// The width of the images are 16 pixels
+	int vc8ShapeLen = tabHeight - VERTICAL_BORDER_PADDING - 2;
+	if( pc->TabHasImage( tabIdx ) )
+		textOffset = ((wxFlatNotebook *)pc->m_pParent)->GetPadding() * 2 + 16 + vc8ShapeLen;
+	else
+		textOffset = ((wxFlatNotebook *)pc->m_pParent)->GetPadding() + vc8ShapeLen;
+
+	// Draw the image for the tab if any
+	int imageYCoord = pc->HasFlag(wxFNB_BOTTOM) ? 6 : 8;
+
+	if( pc->TabHasImage( tabIdx ) )
+	{
+		int imageXOffset = textOffset - 16 - ((wxFlatNotebook *)pc->m_pParent)->GetPadding();
+		dc.DrawBitmap((*pc->GetImageList())[pc->GetPageInfoVector()[tabIdx].GetImageIndex()],
+			posx + imageXOffset, imageYCoord, true);
+	}
+
+	wxFont boldFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+
+	// if selected tab, draw text in bold
+	if( tabIdx == pc->GetSelection() )
+	{
+		boldFont.SetWeight(wxFONTWEIGHT_BOLD);
+	}
+
+	dc.SetFont( boldFont );
+	dc.DrawText(pc->GetPageText(tabIdx), posx + textOffset, imageYCoord);
+}
+
+void wxFNBRendererVC8::FillVC8GradientColor(wxWindow* pageContainer, wxDC &dc, const wxPoint tabPoints[], const bool bSelectedTab, const int tabIdx)
+{
+	// calculate gradient coefficients
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+
+	if( m_first )
+	{
+		m_first = false;
+		pc->m_colorTo   = LightColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 0);
+		pc->m_colorFrom = LightColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 60);
+	}
+	wxColour col2 = pc->HasFlag( wxFNB_BOTTOM ) ? pc->GetGradientColourTo() : pc->GetGradientColourFrom();
+	wxColour col1 = pc->HasFlag( wxFNB_BOTTOM ) ? pc->GetGradientColourFrom() : pc->GetGradientColourTo();
+
+	// If colorful tabs style is set, override the tab color
+	if(pc->HasFlag(wxFNB_COLORFUL_TABS))
+	{
+		if( !pc->GetPageInfoVector()[tabIdx].GetColor().Ok() )
+		{
+			// First time, generate color, and keep it in the vector
+			wxColor tabColor(RandomColor());
+			pc->GetPageInfoVector()[tabIdx].SetColor(tabColor);
+		}
+
+		if( pc->HasFlag(wxFNB_BOTTOM) )
+		{
+			col2 = LightColour( pc->GetPageInfoVector()[tabIdx].GetColor() , 50 );
+			col1 = LightColour( pc->GetPageInfoVector()[tabIdx].GetColor() , 80 );
+		}
+		else
+		{
+			col1 = LightColour( pc->GetPageInfoVector()[tabIdx].GetColor() , 50 );
+			col2 = LightColour( pc->GetPageInfoVector()[tabIdx].GetColor() , 80 );
+		}
+	}
+
+	int size = abs(tabPoints[2].y - tabPoints[0].y) - 1;
+
+	double rstep = double((col2.Red() -   col1.Red())) / double(size), rf = 0,
+		gstep = double((col2.Green() - col1.Green())) / double(size), gf = 0,
+		bstep = double((col2.Blue() -  col1.Blue())) / double(size), bf = 0;
+
+	wxColour currCol;
+	int y = tabPoints[0].y;
+
+	// If we are drawing the selected tab, we need also to draw a line
+	// from 0->tabPoints[0].x and tabPoints[6].x -> end, we achieve this
+	// by drawing the rectangle with transparent brush
+	// the line under the selected tab will be deleted by the drwaing loop
+	if( bSelectedTab )
+		DrawTabsLine(pc, dc);
+
+	while( true )
+	{
+		if(pc->HasFlag( wxFNB_BOTTOM ))
+		{
+			if(y > tabPoints[0].y + size)
+				break;
+		}
+		else
+		{
+			if(y < tabPoints[0].y - size)
+				break;
+		}
+
+		currCol.Set(
+			(unsigned char)(col1.Red() + rf),
+			(unsigned char)(col1.Green() + gf),
+			(unsigned char)(col1.Blue() + bf)
+			);
+
+		dc.SetPen(bSelectedTab ? wxPen(pc->m_activeTabColor) : wxPen(currCol));
+		int startX = GetStartX(tabPoints, y, pc->GetParent()->GetWindowStyleFlag()) ;
+		int endX   = GetEndX(tabPoints, y, pc->GetParent()->GetWindowStyleFlag());
+		dc.DrawLine(startX, y, endX, y);
+
+		// Draw the border using the 'edge' point
+		dc.SetPen(wxPen(bSelectedTab ? wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW) : pc->m_colorBorder));
+
+		dc.DrawPoint(startX, y);
+		dc.DrawPoint(endX, y);
+
+		// Progress the color
+		rf += rstep; gf += gstep; bf += bstep;
+
+		pc->HasFlag( wxFNB_BOTTOM ) ? y++ : y--;
+	}
+}
+
+int wxFNBRendererVC8::GetStartX(const wxPoint tabPoints[], const int &y, long style)
+{
+	double x1 = 0, x2 = 0, y1 = 0, y2 = 0;
+
+	// We check the 3 points to the left
+	bool bBottomStyle = style & wxFNB_BOTTOM ? true : false;
+	bool match = false;
+
+	if(bBottomStyle)
+	{
+		for(int i=0; i<3; i++)
+		{
+			if(y >= tabPoints[i].y && y < tabPoints[i+1].y)
+			{
+				x1 = tabPoints[i].x;
+				x2 = tabPoints[i+1].x;
+				y1 = tabPoints[i].y;
+				y2 = tabPoints[i+1].y;
+				match = true;
+				break;
+			}
+		}
+	}
+	else
+	{
+		for(int i=0; i<3; i++)
+		{
+			if(y <= tabPoints[i].y && y > tabPoints[i+1].y)
+			{
+				x1 = tabPoints[i].x;
+				x2 = tabPoints[i+1].x;
+				y1 = tabPoints[i].y;
+				y2 = tabPoints[i+1].y;
+				match = true;
+				break;
+			}
+		}
+	}
+
+	if(!match)
+		return tabPoints[2].x;
+
+	// According to the equation y = ax + b => x = (y-b)/a
+	// We know the first 2 points
+
+	double a;
+	if(x2 == x1)
+		return static_cast<int>( x2 );
+	else
+		a = (y2 - y1) / (x2 - x1);
+
+	double b = y1 - ((y2 - y1) / (x2 - x1)) * x1;
+
+	if(a == 0)
+		return static_cast<int>( x1 );
+
+	double x = (y - b) / a;
+	return static_cast<int>( x );
+}
+
+int wxFNBRendererVC8::GetEndX(const wxPoint tabPoints[], const int &y, long style)
+{
+	double x1 = 0, x2 = 0, y1 = 0, y2 = 0;
+
+	// We check the 3 points to the left
+	bool bBottomStyle = style & wxFNB_BOTTOM ? true : false;
+	bool match = false;
+
+	if(bBottomStyle)
+	{
+		for(int i=7; i>3; i--)
+		{
+			if(y >= tabPoints[i].y && y < tabPoints[i-1].y)
+			{
+				x1 = tabPoints[i].x;
+				x2 = tabPoints[i-1].x;
+				y1 = tabPoints[i].y;
+				y2 = tabPoints[i-1].y;
+				match = true;
+				break;
+			}
+		}
+	}
+	else
+	{
+		for(int i=7; i>3; i--)
+		{
+			if(y <= tabPoints[i].y && y > tabPoints[i-1].y)
+			{
+				x1 = tabPoints[i].x;
+				x2 = tabPoints[i-1].x;
+				y1 = tabPoints[i].y;
+				y2 = tabPoints[i-1].y;
+				match = true;
+				break;
+			}
+		}
+	}
+
+	if(!match)
+		return tabPoints[3].x;
+
+	// According to the equation y = ax + b => x = (y-b)/a
+	// We know the first 2 points
+	double a = (y2 - y1) / (x2 - x1);
+	double b = y1 - ((y2 - y1) / (x2 - x1)) * x1;
+
+	if(a == 0)
+		return (int)x1;
+
+	// Vertical line
+	if(x1 == x2)
+		return (int)x1;
+
+	double x = (y - b) / a;
+	return (int)x;
+}
+
+void wxFNBRendererVC8::NumberTabsCanFit(wxWindow *pageContainer, std::vector<wxRect> &vTabInfo, int from)
+{
+	wxPageContainer *pc = static_cast<wxPageContainer*>( pageContainer );
+	int tabHeight, clientWidth;
+
+	wxRect rect = pc->GetClientRect();
+	clientWidth = rect.width;
+
+	/// Empty results
+	vTabInfo.clear();
+
+	tabHeight = CalcTabHeight( pageContainer );
+
+	// The drawing starts from posx
+	int posx = ((wxFlatNotebook *)pc->m_pParent)->GetPadding();
+
+	if( from < 0 )
+		from = pc->m_nFrom;
+
+	for(int i = from; i<(int)pc->GetPageInfoVector().GetCount(); i++)
+	{
+		int vc8glitch = tabHeight + wxFNB_HEIGHT_SPACER;
+		int tabWidth = CalcTabWidth( pageContainer, i, tabHeight );
+		if(posx + tabWidth + vc8glitch + GetButtonsAreaLength( pc ) >= clientWidth)
+			break;
+
+		/// Add a result to the returned vector
+		wxRect tabRect(posx, VERTICAL_BORDER_PADDING, tabWidth , tabHeight);
+		vTabInfo.push_back(tabRect);
+
+		/// Advance posx
+		posx += tabWidth + wxFNB_HEIGHT_SPACER;
+	}
+}
+
+
+void wxFNBRendererVC8::DrawTabX(wxWindow *pageContainer, wxDC &dc, const wxRect& rect, const int& tabIdx, const int btnStatus)
+{
+	wxUnusedVar( pageContainer );
+	wxUnusedVar( dc );
+	wxUnusedVar( rect );
+	wxUnusedVar( tabIdx );
+	wxUnusedVar( btnStatus );
+}
+
Index: src/sdk/wxFlatNotebook/renderer.h
===================================================================
--- src/sdk/wxFlatNotebook/renderer.h	(revision 0)
+++ src/sdk/wxFlatNotebook/renderer.h	(revision 0)
@@ -0,0 +1,206 @@
+#ifndef RENDERE_H
+#define RENDERE_H
+
+#include <wx/dc.h>
+#include <wx/string.h>
+#include "singleton.h"
+#include "smart_ptr.h"
+#include <map>
+#include <vector>
+
+class wxFNBRenderer
+{
+protected:
+	// A bitmap that holds the background of the
+	// x button which is drawn on a tab
+	wxBitmap m_tabXBgBmp, m_xBgBmp, m_leftBgBmp, m_rightBgBmp;
+
+public:
+	wxFNBRenderer();
+	virtual ~wxFNBRenderer();
+
+	/**
+	 * Generic function that draws the tabs and updates values in the page container
+	 * \param pageContainer window that contains the tabs drawing
+	 * \param dc device context
+	 */
+	virtual void DrawTabs(wxWindow* pageContainer, wxDC &dc);
+
+	/**
+	 * Draw a small 'x' button on top of the tab
+	 * \param pageContainer parent window on which to draw
+	 * \param dc device context to use
+	 * \param rect button rectangle
+	 * \param tabIdx tab index
+	 * \param btnStatus button status, can be one of
+	 *   - wxFNB_BTN_PRESSED
+	 *   - wxFNB_BTN_HOVER
+	 *   - wxFNB_BTN_NONE
+	 * \param tabXBgBmp [output] background bitmap of the area of the button (just before it is painted)
+	 */
+	virtual void DrawTabX(wxWindow* pageContainer, wxDC& dc, const wxRect& rect, const int& tabIdx, const int btnStatus);
+
+	/**
+	 * Draw tab
+	 * \param pageContainer parent window on which to draw
+	 * \param dc device context to use
+	 * \param posx tab x coordinate
+	 * \param tabIdx tab index
+	 * \param tabWidth tab width
+	 * \param tabHeight tab height
+	 * \param btnStatus btnStatus the little 'x' button (on top of the active tab) status, can be one of
+	 *   - wxFNB_BTN_PRESSED
+	 *   - wxFNB_BTN_HOVER
+	 *   - wxFNB_BTN_NONE
+	 */
+	virtual void DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus) = 0;
+
+	/**
+	 * Calculate tab width , based on its index (for image, x button on tab)
+	 * \param pageContainer pageContainer parent window on which to draw
+	 * \param tabIdx tab index
+	 * \param tabHeight the tab height (used for tan() function calculations)
+	 * \return tab bouding rectangle size
+	 */
+	virtual int CalcTabWidth (wxWindow* pageContainer, int tabIdx, int tabHeight);
+
+	/**
+	 * Calculate tab height
+	 * \param pageContainer pageContainer parent window on which to draw
+	 * \return tab bouding rectangle size
+	 */
+	virtual int CalcTabHeight(wxWindow* pageContainer);
+
+	/**
+	 * Get a bitmap from device context, with rect size
+	 * \param dc device context
+	 * \param rect bitmap rectangle
+	 * \param bmp [output] bitmap
+	 */
+	virtual void GetBitmap(wxDC& dc, const wxRect &rect, wxBitmap &bmp);
+
+	/**
+	 * Draw a bottom line for the tabs area
+	 */
+	void DrawTabsLine(wxWindow *pageContainer, wxDC& dc);
+
+	/**
+	 * Brighten a given colour with amount
+	 * \param color starting colour
+	 * \param percent percent, 0 - no change, 100 - white
+	 * \return brighten colour
+	 */
+	static wxColor LightColour(const wxColour& color, int percent);
+
+	/**
+	 * Paint rectangle with gradient colouring
+	 * \param dc device context
+	 * \param rect rectangle
+	 * \param startColor gradient colour 1
+	 * \param endColor gradient colour 2
+	 * \param vertical use vertical gradient or horizontal
+	 */
+	static void PaintStraightGradientBox(wxDC& dc, const wxRect& rect, const wxColour& startColor, const wxColour& endColor, bool  vertical = true);
+
+	// Navigation buttons position
+	int GetLeftButtonPos(wxWindow *pageContainer);
+	int GetRightButtonPos(wxWindow *pageContainer);
+	int GetXPos(wxWindow *pageContainer);
+	int GetButtonsAreaLength(wxWindow *pageContainer);
+	int GetDropArrowButtonPos(wxWindow *pageContainer);
+
+	/// Draw right arrow button to the right area of the tabs
+	virtual void DrawRightArrow(wxWindow *pageContainer, wxDC &dc);
+
+	/// Draw left arrow button to the right area of the tabs
+	virtual void DrawLeftArrow (wxWindow *pageContainer, wxDC &dc);
+
+	/// Draw 'x' button to the right area of the tabs
+	virtual void DrawX         (wxWindow *pageContainer, wxDC &dc);
+
+	/**
+	 * Draw drop down arrow on the right corner
+	 * \param pageContainer window tabs container
+	 * \param dc device context
+	 */
+	void DrawDropDownArrow(wxWindow* pageContainer, wxDC& dc);
+
+protected:
+	/**
+	 * Generate random colour
+	 * \return random colour
+	 */
+	wxColour RandomColor();
+
+
+};
+
+typedef SmartPtr<wxFNBRenderer> wxFNBRendererPtr;
+
+class wxFNBRendererDefault : public wxFNBRenderer
+{
+public:
+	wxFNBRendererDefault(){}
+	virtual ~wxFNBRendererDefault(){}
+	virtual void DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus);
+};
+
+class wxFNBRendererVC71 : public wxFNBRenderer
+{
+public:
+	wxFNBRendererVC71(){}
+	virtual ~wxFNBRendererVC71(){}
+	virtual void DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus);
+};
+
+class wxFNBRendererFancy : public wxFNBRenderer
+{
+public:
+	wxFNBRendererFancy(){}
+	virtual ~wxFNBRendererFancy(){}
+	virtual void DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus);
+};
+
+class wxFNBRendererVC8 : public wxFNBRenderer
+{
+	int m_factor;
+	bool m_first;
+
+public:
+	wxFNBRendererVC8() : m_factor(1), m_first(true) {}
+	virtual ~wxFNBRendererVC8(){}
+	virtual void DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus);
+	virtual void DrawTabs(wxWindow *pageContainer, wxDC &dc);
+	virtual void DrawTabX(wxWindow *pageContainer, wxDC &dc, const wxRect&, const int& tabIdx, const int btnStatus);
+	void NumberTabsCanFit(wxWindow *pageContainer, std::vector<wxRect> &vTabInfo, int from = -1);
+
+private:
+	void FillVC8GradientColor(wxWindow* pageContainer, wxDC &dc, const wxPoint tabPoints[], const bool bSelectedTab, const int tabIdx);
+	int GetEndX(const wxPoint tabPoints[], const int &y, long style);
+	int GetStartX(const wxPoint tabPoints[], const int &y, long style);
+
+};
+
+//-----------------------------------
+// Renderer manager class
+//-----------------------------------
+
+class wxFNBRendererMgr
+{
+	friend class Singleton<wxFNBRendererMgr>;
+	std::map<int, wxFNBRendererPtr> m_renderers;
+public:
+	/**
+	 * Return the renderer according to the style flag, the returned pointer should not be
+	 * deleted by caller, it is owned by this class
+	 * \param style window style flag
+	 * \return wxFNBRenderer
+	 */
+	wxFNBRendererPtr GetRenderer(long style);
+
+private:
+	wxFNBRendererMgr();
+	virtual ~wxFNBRendererMgr();
+};
+typedef Singleton<wxFNBRendererMgr> wxFNBRendererMgrST;
+#endif // RENDERE_H
Index: src/sdk/wxFlatNotebook/singleton.h
===================================================================
--- src/sdk/wxFlatNotebook/singleton.h	(revision 0)
+++ src/sdk/wxFlatNotebook/singleton.h	(revision 0)
@@ -0,0 +1,68 @@
+#ifndef CODELITE_SINGLETON_H
+#define CODELITE_SINGLETON_H
+
+/**
+ * A template class that implements the Singleton pattern.
+ *
+ * \date 08-23-2006
+ * \author eran
+ */
+template <typename T>
+class Singleton
+{
+	static T* ms_instance;
+public:
+	/**
+	 * Static method to access the only pointer of this instance.
+	 * \return a pointer to the only instance of this
+	 */
+	static T* Get();
+
+	/**
+	 * Release resources.
+	 */
+	static void Free();
+
+protected:
+	/**
+	 * Default constructor.
+	 */
+	Singleton();
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~Singleton();
+};
+template <typename T>
+T* Singleton<T>::ms_instance = 0;
+
+template <typename T>
+Singleton<T>::Singleton()
+{
+}
+
+template <typename T>
+Singleton<T>::~Singleton()
+{
+}
+
+template <typename T>
+T* Singleton<T>::Get()
+{
+	if(!ms_instance)
+		ms_instance = new T();
+	return ms_instance;
+}
+
+template <typename T>
+void Singleton<T>::Free()
+{
+	if( ms_instance )
+	{
+		delete ms_instance;
+		ms_instance = 0;
+	}
+}
+
+#endif // CODELITE_SINGLETON_H
Index: src/sdk/wxFlatNotebook/smart_ptr.h
===================================================================
--- src/sdk/wxFlatNotebook/smart_ptr.h	(revision 0)
+++ src/sdk/wxFlatNotebook/smart_ptr.h	(revision 0)
@@ -0,0 +1,215 @@
+#ifndef CODELITE_SMART_PTR_H
+#define CODELITE_SMART_PTR_H
+
+
+/**
+ * A smart pointer class that provides a reference counting and auto delete memory.
+ *
+ * This class is similar to std::auto_ptr, with 2 exceptions:
+ * - This class uses reference counting
+ * - We dont provide a release() function (because of the reference counting)
+ * It is recommended to use this class instead of using raw pointer wherever possible.
+ *
+ * \note smart pointer to NULL is valid.
+ *
+ * \ingroup CodeLite
+ * \version 1.0
+ * first version
+ * \date 09-17-2006
+ * \author Eran
+ */
+template <typename T>
+class SmartPtr
+{
+	typedef T* type_ptr;
+
+	/**
+     * The reference counting class
+     *
+	 * \ingroup CodeLite
+	 * \version 1.0
+	 * first version
+	 *
+	 * \date 09-17-2006
+	 * \author Eran
+	 */
+	class SmartPtrRef
+	{
+		type_ptr m_data;
+		int m_refCount;
+
+	public:
+		/**
+		 * Construct a reference counting class for row pointer data
+		 * \param data pointer
+		 */
+		SmartPtrRef(type_ptr data)
+			: m_data( data )
+			, m_refCount( 1 )
+		{
+		}
+
+		/**
+		 * Destructor
+		 */
+		virtual ~SmartPtrRef()
+		{
+			delete m_data;
+		}
+
+		/**
+		 * \return Pointer to the row data
+		 */
+		type_ptr GetData() { return m_data; }
+
+		/**
+		 * Increase reference counting by 1
+		 */
+		void IncRef() { m_refCount ++ ; }
+
+
+		/**
+		 * Decrease reference counting by 1
+		 */
+		void DecRef() { m_refCount -- ; }
+		/**
+		 * Return the current reference counting
+		 * \return current reference counting
+		 */
+		int  GetRefCount() { return m_refCount; }
+	};
+
+	SmartPtrRef *m_ref;
+
+public:
+	/**
+	 * Construct smart pointer from ptr
+	 * \param ptr pointer
+	 */
+	SmartPtr(type_ptr ptr)
+	{
+		// create a fresh copy
+		CreateFresh( ptr );
+	}
+
+	/**
+	 * Default constructor
+	 */
+	SmartPtr()
+		: m_ref(NULL)
+	{
+	}
+
+	/**
+	 * Copy constructor
+	 * \param rhs right hand side
+	 */
+	SmartPtr(const SmartPtr& rhs)
+		: m_ref(NULL)
+	{
+		*this = rhs;
+	}
+
+	/**
+	 * Assignment operator
+	 * \param rhs right hand side
+	 * \return reference to this
+	 */
+	SmartPtr& operator=(const SmartPtr& rhs)
+	{
+		// increase the reference count
+		if( m_ref == rhs.m_ref )
+			return *this;
+
+		// Delete previous reference
+		DeleteRefCount();
+
+		if( !rhs.m_ref )
+			return *this;
+
+		m_ref = rhs.m_ref;
+		m_ref->IncRef();
+		return *this;
+	}
+
+	/**
+	 * Destructor
+	 */
+	virtual ~SmartPtr()
+	{
+		DeleteRefCount();
+	}
+
+	/**
+	 * Replace the current pointer with ptr
+	 * if the current ptr is not NULL, it will be freed (reference counting free) before assingning the new ptr
+	 * \param ptr new pointer
+	 */
+	void Reset(type_ptr ptr)
+	{
+		DeleteRefCount();
+		CreateFresh( ptr );
+	}
+
+	/**
+	 * Return pointer the row data pointer
+	 * \return pointer to the row data pointer
+	 */
+	type_ptr Get()
+	{
+		return m_ref->GetData();
+	}
+
+	/**
+	 * Overload the '->' operator
+	 * \return pointer to the row data pointer
+	 */
+	type_ptr operator->() const
+	{
+		return m_ref->GetData();
+	}
+
+	/**
+	 * Dereference operator
+	 * \return dereference the row data
+	 */
+	T& operator*() const
+	{
+		return *(m_ref->GetData());
+	}
+
+	/**
+	 * Test for NULL operator
+	 * \return true if the internal row data or the reference counting class are NULL false otherwise
+	 */
+	bool operator!() const
+	{
+		if( !m_ref )
+			return true;
+
+		return m_ref->GetData() == NULL;
+	}
+
+private:
+	void DeleteRefCount()
+	{
+		// decrease the ref count (or delete pointer if it is 1)
+		if( m_ref )
+		{
+			if( m_ref->GetRefCount() == 1 )
+			{
+				delete m_ref;
+				m_ref = NULL;
+			}
+			else
+				m_ref->DecRef();
+		}
+	};
+
+	void CreateFresh(type_ptr ptr)
+	{
+		m_ref = new SmartPtrRef( ptr );
+	}
+};
+
+#endif // CODELITE_SMART_PTR_H
Index: src/sdk/wxFlatNotebook/wxFlatNotebook.cpp
===================================================================
--- src/sdk/wxFlatNotebook/wxFlatNotebook.cpp	(revision 3049)
+++ src/sdk/wxFlatNotebook/wxFlatNotebook.cpp	(working copy)
@@ -9,447 +9,14 @@
 // Licence:     wxWindows license <http://www.wxwidgets.org/licence3.txt>
 ///////////////////////////////////////////////////////////////////////////////

-namespace FNB
-{
-	////////////////////////////////////////////////////////////
-	// Images used by the control
-	////////////////////////////////////////////////////////////
-	/* XPM */
-	const char *left_arrow_disabled_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #555555",
-			"# c #000000",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"````````.```````",
-			"```````..```````",
-			"``````.`.```````",
-			"`````.``.```````",
-			"````.```.```````",
-			"`````.``.```````",
-			"``````.`.```````",
-			"```````..```````",
-			"````````.```````",
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"````````````````"
-	};

-	/* XPM */
-	const char *x_button_pressed_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #4766e0",
-			"# c #9e9ede",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"`..............`",
-			"`.############.`",
-			"`.############.`",
-			"`.############.`",
-			"`.###aa####aa#.`",
-			"`.####aa##aa##.`",
-			"`.#####aaaa###.`",
-			"`.######aa####.`",
-			"`.#####aaaa###.`",
-			"`.####aa##aa##.`",
-			"`.###aa####aa#.`",
-			"`.############.`",
-			"`..............`",
-			"````````````````",
-			"````````````````"
-	};
-
-
-	/* XPM */
-	const char *left_arrow_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #555555",
-			"# c #000000",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"````````.```````",
-			"```````..```````",
-			"``````...```````",
-			"`````....```````",
-			"````.....```````",
-			"`````....```````",
-			"``````...```````",
-			"```````..```````",
-			"````````.```````",
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"````````````````"
-	};
-
-	/* XPM */
-	const char *x_button_hilite_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #4766e0",
-			"# c #c9dafb",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"`..............`",
-			"`.############.`",
-			"`.############.`",
-			"`.##aa####aa##.`",
-			"`.###aa##aa###.`",
-			"`.####aaaa####.`",
-			"`.#####aa#####.`",
-			"`.####aaaa####.`",
-			"`.###aa##aa###.`",
-			"`.##aa####aa##.`",
-			"`.############.`",
-			"`.############.`",
-			"`..............`",
-			"````````````````",
-			"````````````````"
-	};
-
-	/* XPM */
-	const char *x_button_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #555555",
-			"# c #000000",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"````..````..````",
-			"`````..``..`````",
-			"``````....``````",
-			"```````..```````",
-			"``````....``````",
-			"`````..``..`````",
-			"````..````..````",
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"````````````````"
-	};
-
-	/* XPM */
-	const char *left_arrow_pressed_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #4766e0",
-			"# c #9e9ede",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"`..............`",
-			"`.############.`",
-			"`.############.`",
-			"`.#######a####.`",
-			"`.######aa####.`",
-			"`.#####aaa####.`",
-			"`.####aaaa####.`",
-			"`.###aaaaa####.`",
-			"`.####aaaa####.`",
-			"`.#####aaa####.`",
-			"`.######aa####.`",
-			"`.#######a####.`",
-			"`..............`",
-			"````````````````",
-			"````````````````"
-	};
-
-	/* XPM */
-	const char *left_arrow_hilite_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #4766e0",
-			"# c #c9dafb",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"`..............`",
-			"`.############.`",
-			"`.######a#####.`",
-			"`.#####aa#####.`",
-			"`.####aaa#####.`",
-			"`.###aaaa#####.`",
-			"`.##aaaaa#####.`",
-			"`.###aaaa#####.`",
-			"`.####aaa#####.`",
-			"`.#####aa#####.`",
-			"`.######a#####.`",
-			"`.############.`",
-			"`..............`",
-			"````````````````",
-			"````````````````"
-	};
-
-	/* XPM */
-	const char *right_arrow_disabled_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #555555",
-			"# c #000000",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"```````.````````",
-			"```````..```````",
-			"```````.`.``````",
-			"```````.``.`````",
-			"```````.```.````",
-			"```````.``.`````",
-			"```````.`.``````",
-			"```````..```````",
-			"```````.````````",
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"````````````````"
-	};
-
-	/* XPM */
-	const char *right_arrow_hilite_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #4766e0",
-			"# c #c9dafb",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"`..............`",
-			"`.############.`",
-			"`.####a#######.`",
-			"`.####aa######.`",
-			"`.####aaa#####.`",
-			"`.####aaaa####.`",
-			"`.####aaaaa###.`",
-			"`.####aaaa####.`",
-			"`.####aaa#####.`",
-			"`.####aa######.`",
-			"`.####a#######.`",
-			"`.############.`",
-			"`..............`",
-			"````````````````",
-			"````````````````"
-	};
-
-	/* XPM */
-	const char *right_arrow_pressed_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #4766e0",
-			"# c #9e9ede",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"`..............`",
-			"`.############.`",
-			"`.############.`",
-			"`.#####a######.`",
-			"`.#####aa#####.`",
-			"`.#####aaa####.`",
-			"`.#####aaaa###.`",
-			"`.#####aaaaa##.`",
-			"`.#####aaaa###.`",
-			"`.#####aaa####.`",
-			"`.#####aa#####.`",
-			"`.#####a######.`",
-			"`..............`",
-			"````````````````",
-			"````````````````"
-	};
-
-
-	/* XPM */
-	const char *right_arrow_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"    16    16        8            1",
-			/* colors */
-			"` c #008080",
-			". c #555555",
-			"# c #000000",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"```````.````````",
-			"```````..```````",
-			"```````...``````",
-			"```````....`````",
-			"```````.....````",
-			"```````....`````",
-			"```````...``````",
-			"```````..```````",
-			"```````.````````",
-			"````````````````",
-			"````````````````",
-			"````````````````",
-			"````````````````"
-	};
-
-	const int tab_x_size = 9;
-
-	/* XPM */
-	const char *tab_x_button_pressed_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"     9     9        8            1",
-			/* colors */
-			"` c #4766e0",
-			". c #9e9ede",
-			"# c #555555",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"`````````",
-			"`.......`",
-			"`.......`",
-			"`..#...#`",
-			"`...#.#.`",
-			"`....#..`",
-			"`...#.#.`",
-			"`..#...#`",
-			"`````````"
-	};
-
-	/* XPM */
-	const char *tab_x_button_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"     9     9        8            1",
-			/* colors */
-			"` c #555555",
-			". c #FFFFFF",
-			"# c #000000",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"`````````",
-			"`.......`",
-			"`.`...`.`",
-			"`..`.`..`",
-			"`...`...`",
-			"`..`.`..`",
-			"`.`...`.`",
-			"`.......`",
-			"`````````"
-	};
-
-	/* XPM */
-	const char *tab_x_button_hilite_xpm[] = {
-		/* width height num_colors chars_per_pixel */
-		"     9     9        8            1",
-			/* colors */
-			"` c #4766e0",
-			". c #c9dafb",
-			"# c #000000",
-			"a c #000000",
-			"b c #000000",
-			"c c #000000",
-			"d c #000000",
-			"e c #000000",
-			/* pixels */
-			"`````````",
-			"`.......`",
-			"`.#...#.`",
-			"`..#.#..`",
-			"`...#...`",
-			"`..#.#..`",
-			"`.#...#.`",
-			"`.......`",
-			"`````````"
-	};
-}
-
 #include "wxFlatNotebook.h"
+#include "renderer.h"
+#include "popup_dlg.h"
 #include <algorithm>
 #include <wx/tooltip.h>
 #include <wx/tipwin.h>
+#include <wx/arrimpl.cpp>

 IMPLEMENT_DYNAMIC_CLASS(wxFlatNotebookEvent, wxNotifyEvent)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGED)
@@ -458,13 +25,18 @@
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_FLATNOTEBOOK_CONTEXT_MENU)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSED)

-IMPLEMENT_DYNAMIC_CLASS(wxFlatNotebookBase, wxPanel)
+IMPLEMENT_DYNAMIC_CLASS(wxFlatNotebook, wxPanel)

-BEGIN_EVENT_TABLE(wxFlatNotebookBase, wxPanel)
-EVT_NAVIGATION_KEY(wxFlatNotebookBase::OnNavigationKey)
+WX_DEFINE_OBJARRAY(wxFlatNotebookImageList);
+WX_DEFINE_OBJARRAY(wxPageInfoArray)
+WX_DEFINE_OBJARRAY(wxWindowPtrArray)
+
+BEGIN_EVENT_TABLE(wxFlatNotebook, wxPanel)
+EVT_NAVIGATION_KEY(wxFlatNotebook::OnNavigationKey)
 END_EVENT_TABLE()

-wxFlatNotebookBase::wxFlatNotebookBase(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
+wxFlatNotebook::wxFlatNotebook(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
+: m_popupWin(NULL)
 {
 	m_bForceSelection = false;
 	m_nPadding = 6;
@@ -473,56 +45,73 @@
 	m_pages = NULL;
 	wxPanel::Create(parent, id, pos, size, style, name);

-	m_pages = new wxPageContainerBase(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style);
+	m_pages = new wxPageContainer(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style);
+	Init();
 }

-wxFlatNotebookBase::~wxFlatNotebookBase(void)
+wxFlatNotebook::~wxFlatNotebook(void)
 {
 }

-void wxFlatNotebookBase::Init()
+void wxFlatNotebook::Init()
 {
-	long style = GetWindowStyleFlag();
-	m_pages->m_colorBorder = style & wxFNB_FANCY_TABS ? m_pages->m_colorTo : wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+	m_pages->m_colorBorder = wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));

 	m_mainSizer = new wxBoxSizer(wxVERTICAL);
 	SetSizer(m_mainSizer);

 	SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));

-	// Add the tab container to the sizer
-	m_mainSizer->Insert(0, m_pages, 0, wxEXPAND);
-
 	// Set default page height
-	wxClientDC dc(this);
+	wxMemoryDC memDc;
 	int width, height;
+
+
+#ifdef __WXGTK__
+	// For GTK it seems that we must do this steps in order
+	// for the tabs will get the proper height on initialization
+	// on MSW, preforming these steps yields wierd results
+	wxFont normalFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+	wxFont boldFont = normalFont;
+	boldFont.SetWeight(wxFONTWEIGHT_BOLD);
+	memDc.SetFont( boldFont );
+#endif
+
 	wxString stam = wxT("Tp");	// Temp data to get the text height;
-	dc.GetTextExtent(stam, &width, &height);
+	memDc.GetTextExtent(stam, &width, &height);

-	int tabHeight = height + 8; // We use 8 pixels as padding
+	int tabHeight = height + wxFNB_HEIGHT_SPACER; // We use 8 pixels as padding
+#ifdef __WXGTK__
+	// On GTK the tabs are should be larger
+	tabHeight += 6;
+#endif
 	m_pages->SetSizeHints(wxSize(-1, tabHeight));

+	// Add the tab container to the sizer
+	m_mainSizer->Insert(0, m_pages, 0, wxEXPAND);
+	m_mainSizer->Layout();
+
 	m_pages->m_nFrom = m_nFrom;
-	m_pDropTarget = new wxFNBDropTarget<wxFlatNotebookBase>(this, &wxFlatNotebookBase::OnDropTarget);
+	m_pDropTarget = new wxFNBDropTarget<wxFlatNotebook>(this, &wxFlatNotebook::OnDropTarget);
 	SetDropTarget(m_pDropTarget);
 }

-wxPageContainerBase* wxFlatNotebookBase::CreatePageContainer()
+void wxFlatNotebook::SetActiveTabTextColour(const wxColour& textColour)
 {
-	return new wxPageContainerBase(this, wxID_ANY);
+	m_pages->m_activeTextColor = textColour;
 }

-void wxFlatNotebookBase::SetActiveTabTextColour(const wxColour& textColour)
+wxDragResult wxFlatNotebook::OnDropTarget(wxCoord x, wxCoord y, int nTabPage, wxWindow * wnd_oldContainer)
 {
-	m_pages->m_activeTextColor = textColour;
+	return m_pages->OnDropTarget(x, y, nTabPage, wnd_oldContainer);
 }

-wxDragResult wxFlatNotebookBase::OnDropTarget(wxCoord x, wxCoord y, int nTabPage, wxWindow * wnd_oldContainer)
+int wxFlatNotebook::GetPreviousSelection() const
 {
-	return m_pages->OnDropTarget(x, y, nTabPage, wnd_oldContainer);
+	return m_pages->m_iPreviousActivePage;
 }

-void wxFlatNotebookBase::AddPage(wxWindow* window, const wxString& caption, const bool selected, const int imgindex)
+void wxFlatNotebook::AddPage(wxWindow* window, const wxString& caption, const bool selected, const int imgindex)
 {
 	// sanity check
 	if (!window)
@@ -539,7 +128,7 @@
 		m_pages->Show();

 	m_pages->AddPage(caption, bSelected, imgindex);
-	m_windows.push_back(window);
+	m_windows.Add(window);

 	Freeze();

@@ -573,17 +162,17 @@

 }

-void wxFlatNotebookBase::SetImageList(wxFlatNotebookImageList * imglist)
+void wxFlatNotebook::SetImageList(wxFlatNotebookImageList * imglist)
 {
 	m_pages->SetImageList(imglist);
 }

-wxFlatNotebookImageList * wxFlatNotebookBase::GetImageList()
+wxFlatNotebookImageList * wxFlatNotebook::GetImageList()
 {
 	return m_pages->GetImageList();
 }

-bool wxFlatNotebookBase::InsertPage(size_t index, wxWindow* page, const wxString& text, bool select, const int imgindex)
+bool wxFlatNotebook::InsertPage(size_t index, wxWindow* page, const wxString& text, bool select, const int imgindex)
 {
 	// sanity check
 	if (!page)
@@ -597,20 +186,19 @@
 		AddPage(page, text, select, imgindex);
 		return true;
 	}
-	index = std::min((unsigned int)index, (unsigned int)m_windows.size());
+	index = FNB_MIN((unsigned int)index, (unsigned int)m_windows.GetCount());
 	// Insert tab
 	bool bSelected = select || m_windows.empty();
 	int curSel = m_pages->GetSelection();

-	if(index <= m_windows.size())
+	if(index <= m_windows.GetCount())
 	{
-		std::vector<wxWindow*>::iterator iter = m_windows.begin() + index;
-		m_windows.insert(iter, page);
+		m_windows.Insert(page, index);
 		wxLogTrace(wxTraceMask(), _("New page inserted. Index = %i"), index);
 	}
 	else
 	{
-		m_windows.push_back(page);
+		m_windows.Add(page);
 		wxLogTrace(wxTraceMask(), _("New page appended. Index = %i"), index);
 	}
 	m_pages->InsertPage(index, page, text, bSelected, imgindex);
@@ -641,13 +229,13 @@
 	return true;
 }

-void wxFlatNotebookBase::SetSelection(size_t page)
+void wxFlatNotebook::SetSelection(size_t page)
 {
-	if(page >= m_windows.size())
+	if(page >= m_windows.GetCount())
 		return;

 	// Support for disabed tabs
-	if(!m_pages->GetEnabled(page) && m_windows.size() > 1 && !m_bForceSelection)
+	if(!m_pages->GetEnabled(page) && m_windows.GetCount() > 1 && !m_bForceSelection)
 		return;

 	int curSel = m_pages->GetSelection();
@@ -675,27 +263,29 @@
 	Thaw();

 	m_mainSizer->Layout();
+
+	if( page != (size_t)m_pages->m_iActivePage )
+		//there is a real poge changing
+		m_pages->m_iPreviousActivePage = m_pages->m_iActivePage;
+
 	m_pages->m_iActivePage = (int)page;
 	m_pages->DoSetSelection(page);
 }

-void wxFlatNotebookBase::DeletePage(size_t page, bool notify)
+void wxFlatNotebook::DeletePage(size_t page)
 {
-	if(page >= m_windows.size())
+	if(page >= m_windows.GetCount())
 		return;

-	if (notify)
-	{
-		// Fire a closing event
-		wxFlatNotebookEvent event(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, GetId());
-		event.SetSelection((int)page);
-		event.SetEventObject(this);
-		GetEventHandler()->ProcessEvent(event);
+	// Fire a closing event
+	wxFlatNotebookEvent event(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, GetId());
+	event.SetSelection((int)page);
+	event.SetEventObject(this);
+	GetEventHandler()->ProcessEvent(event);

-		// The event handler allows it?
-		if (!event.IsAllowed())
-			return;
-	}
+	// The event handler allows it?
+	if (!event.IsAllowed())
+		return;

 	Freeze();

@@ -710,9 +300,7 @@
 	}

 	// Remove it from the array as well
-	std::vector<wxWindow*>::iterator iter = std::find(m_windows.begin(), m_windows.end(), pageRemoved);
-	if(iter != m_windows.end())
-		m_windows.erase(iter);
+	m_windows.RemoveAt(page);

 	// Now we can destroy it; in wxWidgets use Destroy instead of delete
 	pageRemoved->Destroy();
@@ -729,20 +317,19 @@
 	GetEventHandler()->ProcessEvent(closedEvent);
 }

-bool wxFlatNotebookBase::DeleteAllPages()
+bool wxFlatNotebook::DeleteAllPages()
 {
 	if(m_windows.empty())
 		return false;

 	Freeze();
-	std::vector<wxWindow*>::iterator iter = m_windows.begin();
-	for(; iter != m_windows.end(); iter++)
+	int i = 0;
+	for(; i<(int)m_windows.GetCount(); i++)
 	{
-		delete (*iter);
+		delete m_windows[i];
 	}

-	m_windows.clear();
-
+	m_windows.Clear();
 	Thaw();

 	// Clear the container of the tabs as well
@@ -750,7 +337,7 @@
 	return true;
 }

-wxWindow* wxFlatNotebookBase::GetCurrentPage() const
+wxWindow* wxFlatNotebook::GetCurrentPage() const
 {
 	int sel = m_pages->GetSelection();
 	if(sel < 0)
@@ -759,17 +346,17 @@
 	return m_windows[sel];
 }

-wxWindow* wxFlatNotebookBase::GetPage(size_t page) const
+wxWindow* wxFlatNotebook::GetPage(size_t page) const
 {
-	if(page >= m_windows.size())
+	if(page >= m_windows.GetCount())
 		return NULL;

 	return m_windows[page];
 }

-int wxFlatNotebookBase::GetPageIndex(wxWindow* win) const
+int wxFlatNotebook::GetPageIndex(wxWindow* win) const
 {
-	for (size_t i = 0; i < m_windows.size(); ++i)
+	for (size_t i = 0; i < m_windows.GetCount(); ++i)
 	{
 		if (m_windows[i] == win)
 			return (int)i;
@@ -777,27 +364,46 @@
 	return -1;
 }

-int wxFlatNotebookBase::GetSelection() const
+int wxFlatNotebook::GetSelection() const
 {
 	return m_pages->GetSelection();
 }

-void wxFlatNotebookBase::AdvanceSelection(bool bForward)
+void wxFlatNotebook::AdvanceSelection(bool bForward)
 {
 	m_pages->AdvanceSelection(bForward);
 }

-int wxFlatNotebookBase::GetPageCount() const
+int wxFlatNotebook::GetPageCount() const
 {
 	return (int)m_pages->GetPageCount();
 }

-void wxFlatNotebookBase::OnNavigationKey(wxNavigationKeyEvent& event)
+void wxFlatNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
 {
 	if ( event.IsWindowChange() )
 	{
-		// change pages
-		AdvanceSelection(event.GetDirection());
+		if( HasFlag(wxFNB_SMART_TABS) )
+		{
+			if( !m_popupWin )
+			{
+				m_popupWin = new wxTabNavigatorWindow( this );
+				m_popupWin->ShowModal();
+				m_popupWin->Destroy();
+				m_popupWin = NULL;
+			}
+			else
+			{
+				// a dialog is already opened
+				m_popupWin->OnNavigationKey( event );
+				return;
+			}
+		}
+		else
+		{
+			// change pages
+			AdvanceSelection(event.GetDirection());
+		}
 	}
 	else
 	{
@@ -810,49 +416,49 @@
 	}
 }

-bool wxFlatNotebookBase::GetPageShapeAngle(int page_index, unsigned int * result)
+bool wxFlatNotebook::GetPageShapeAngle(int page_index, unsigned int * result)
 {
-	if(page_index < 0 || page_index >= (int)m_pages->m_pagesInfoVec.size()) return false;
+	if(page_index < 0 || page_index >= (int)m_pages->m_pagesInfoVec.GetCount()) return false;
 	*result = m_pages->m_pagesInfoVec[page_index].GetTabAngle();
 	return true;
 }

-void wxFlatNotebookBase::SetPageShapeAngle(int page_index, unsigned int angle)
+void wxFlatNotebook::SetPageShapeAngle(int page_index, unsigned int angle)
 {
-	if(page_index < 0 || page_index >= (int)m_pages->m_pagesInfoVec.size()) return;
+	if(page_index < 0 || page_index >= (int)m_pages->m_pagesInfoVec.GetCount()) return;
 	if(angle > 15) return;

 	m_pages->m_pagesInfoVec[page_index].SetTabAngle(angle);
 }

-void wxFlatNotebookBase::SetAllPagesShapeAngle(unsigned int angle)
+void wxFlatNotebook::SetAllPagesShapeAngle(unsigned int angle)
 {
 	if(angle > 15) return;
-	for(unsigned int i = 0; i < m_pages->m_pagesInfoVec.size(); i++)
+	for(unsigned int i = 0; i < m_pages->m_pagesInfoVec.GetCount(); i++)
 	{
 		m_pages->m_pagesInfoVec[i].SetTabAngle(angle);
 	}
 	Refresh();
 }

-wxSize wxFlatNotebookBase::GetPageBestSize()
+wxSize wxFlatNotebook::GetPageBestSize()
 {
 	return m_pages->GetClientSize();
 }

-bool wxFlatNotebookBase::SetPageText(size_t page, const wxString& text)
+bool wxFlatNotebook::SetPageText(size_t page, const wxString& text)
 {
 	bool bVal = m_pages->SetPageText(page, text);
 	m_pages->Refresh();
 	return bVal;
 }

-void wxFlatNotebookBase::SetPadding(const wxSize& padding)
+void wxFlatNotebook::SetPadding(const wxSize& padding)
 {
 	m_nPadding = padding.GetWidth();
 }

-void wxFlatNotebookBase::SetWindowStyleFlag(long style)
+void wxFlatNotebook::SetWindowStyleFlag(long style)
 {
 	wxPanel::SetWindowStyleFlag(style);

@@ -860,28 +466,24 @@
 	{
 		// For changing the tab position (i.e. placing them top/bottom)
 		// refreshing the tab container is not enough
-		m_pages->m_colorBorder = style & wxFNB_FANCY_TABS ? m_pages->m_colorTo : wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
 		SetSelection(m_pages->m_iActivePage);
 	}
 }

-bool wxFlatNotebookBase::RemovePage(size_t page, bool notify)
+bool wxFlatNotebook::RemovePage(size_t page)
 {
-	if(page >= m_windows.size())
+	if(page >= m_windows.GetCount())
 		return false;

-	if (notify)
-	{
-		// Fire a closing event
-		wxFlatNotebookEvent event(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, GetId());
-		event.SetSelection((int)page);
-		event.SetEventObject(this);
-		GetEventHandler()->ProcessEvent(event);
+	// Fire a closing event
+	wxFlatNotebookEvent event(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, GetId());
+	event.SetSelection((int)page);
+	event.SetEventObject(this);
+	GetEventHandler()->ProcessEvent(event);

-		// The event handler allows it?
-		if (!event.IsAllowed())
-			return false;
-	}
+	// The event handler allows it?
+	if (!event.IsAllowed())
+		return false;

 	Freeze();

@@ -896,10 +498,7 @@
 	}

 	// Remove it from the array as well
-	std::vector<wxWindow*>::iterator iter = std::find(m_windows.begin(), m_windows.end(), pageRemoved);
-	if(iter != m_windows.end())
-		m_windows.erase(iter);
-
+	m_windows.RemoveAt(page);
 	Thaw();

 	m_pages->DoDeletePage(page);
@@ -907,143 +506,146 @@
 	return true;
 }

-void wxFlatNotebookBase::SetRightClickMenu(wxMenu* menu)
+void wxFlatNotebook::SetRightClickMenu(wxMenu* menu)
 {
 	m_pages->m_pRightClickMenu = menu;
 }

-wxString wxFlatNotebookBase::GetPageText(size_t page)
+wxString wxFlatNotebook::GetPageText(size_t page)
 {
 	return m_pages->GetPageText(page);
 }

-void wxFlatNotebookBase::SetGradientColors(const wxColour& from, const wxColour& to, const wxColour& border)
+void wxFlatNotebook::SetGradientColors(const wxColour& from, const wxColour& to, const wxColour& border)
 {
 	m_pages->m_colorFrom = from;
 	m_pages->m_colorTo   = to;
 	m_pages->m_colorBorder = border;
 }

-void wxFlatNotebookBase::SetGradientColorFrom(const wxColour& from)
+void wxFlatNotebook::SetGradientColorFrom(const wxColour& from)
 {
 	m_pages->m_colorFrom = from;
 }

-void wxFlatNotebookBase::SetGradientColorTo(const wxColour& to)
+void wxFlatNotebook::SetGradientColorTo(const wxColour& to)
 {
 	m_pages->m_colorTo   = to;
 }

-void wxFlatNotebookBase::SetGradientColorBorder(const wxColour& border)
+void wxFlatNotebook::SetGradientColorBorder(const wxColour& border)
 {
 	m_pages->m_colorBorder = border;
 }

 /// Gets first gradient colour
-const wxColour& wxFlatNotebookBase::GetGradientColorFrom()
+const wxColour& wxFlatNotebook::GetGradientColorFrom()
 {
 	return m_pages->m_colorFrom;
 }

 /// Gets second gradient colour
-const wxColour& wxFlatNotebookBase::GetGradientColorTo()
+const wxColour& wxFlatNotebook::GetGradientColorTo()
 {
 	return m_pages->m_colorTo;
 }

 /// Gets the tab border colour
-const wxColour& wxFlatNotebookBase::SetGradientColorBorder()
+const wxColour& wxFlatNotebook::SetGradientColorBorder()
 {
 	return m_pages->m_colorBorder;
 }

 /// Get the active tab text
-const wxColour& wxFlatNotebookBase::GetActiveTabTextColour()
+const wxColour& wxFlatNotebook::GetActiveTabTextColour()
 {
 	return m_pages->m_activeTextColor;
 }

-void wxFlatNotebookBase::SetPageImageIndex(size_t page, int imgindex)
+void wxFlatNotebook::SetPageImageIndex(size_t page, int imgindex)
 {
 	m_pages->SetPageImageIndex(page, imgindex);
 }

-int wxFlatNotebookBase::GetPageImageIndex(size_t page)
+int wxFlatNotebook::GetPageImageIndex(size_t page)
 {
 	return m_pages->GetPageImageIndex(page);
 }

-bool wxFlatNotebookBase::GetEnabled(size_t page)
+bool wxFlatNotebook::GetEnabled(size_t page)
 {
 	return m_pages->GetEnabled(page);
 }

-void wxFlatNotebookBase::Enable(size_t page, bool enabled)
+void wxFlatNotebook::Enable(size_t page, bool enabled)
 {
-	if(page >= m_windows.size())
+	if(page >= m_windows.GetCount())
 		return;

 	m_windows[page]->Enable(enabled);
 	m_pages->Enable(page, enabled);
 }

-const wxColour& wxFlatNotebookBase::GetNonActiveTabTextColour()
+const wxColour& wxFlatNotebook::GetNonActiveTabTextColour()
 {
 	return m_pages->m_nonActiveTextColor;
 }

-void wxFlatNotebookBase::SetNonActiveTabTextColour(const wxColour& color)
+void wxFlatNotebook::SetNonActiveTabTextColour(const wxColour& color)
 {
 	m_pages->m_nonActiveTextColor = color;
 }

-void wxFlatNotebookBase::SetTabAreaColour(const wxColour& color)
+void wxFlatNotebook::SetTabAreaColour(const wxColour& color)
 {
 	m_pages->m_tabAreaColor = color;
 }

-const wxColour& wxFlatNotebookBase::GetTabAreaColour()
+const wxColour& wxFlatNotebook::GetTabAreaColour()
 {
 	return m_pages->m_tabAreaColor;
 }

-void wxFlatNotebookBase::SetActiveTabColour(const wxColour& color)
+void wxFlatNotebook::SetActiveTabColour(const wxColour& color)
 {
 	m_pages->m_activeTabColor = color;
 }

-const wxColour& wxFlatNotebookBase::GetActiveTabColour()
+const wxColour& wxFlatNotebook::GetActiveTabColour()
 {
 	return m_pages->m_activeTabColor;
 }

 ///////////////////////////////////////////////////////////////////////////////////////////
 //
-//	wxPageContainerBase
+//	wxPageContainer
 //
 ///////////////////////////////////////////////////////////////////////////////////////////

-BEGIN_EVENT_TABLE(wxPageContainerBase, wxControl)
-EVT_PAINT(wxPageContainerBase::OnPaint)
-EVT_SIZE(wxPageContainerBase::OnSize)
-EVT_LEFT_DOWN(wxPageContainerBase::OnLeftDown)
-EVT_LEFT_UP(wxPageContainerBase::OnLeftUp)
-EVT_RIGHT_DOWN(wxPageContainerBase::OnRightDown)
-EVT_MIDDLE_DOWN(wxPageContainerBase::OnMiddleDown)
-EVT_MOTION(wxPageContainerBase::OnMouseMove)
-EVT_ERASE_BACKGROUND(wxPageContainerBase::OnEraseBackground)
-EVT_LEAVE_WINDOW(wxPageContainerBase::OnMouseLeave)
-EVT_ENTER_WINDOW(wxPageContainerBase::OnMouseEnterWindow)
+BEGIN_EVENT_TABLE(wxPageContainer, wxPanel)
+EVT_PAINT(wxPageContainer::OnPaint)
+EVT_SIZE(wxPageContainer::OnSize)
+EVT_LEFT_DOWN(wxPageContainer::OnLeftDown)
+EVT_LEFT_UP(wxPageContainer::OnLeftUp)
+EVT_RIGHT_DOWN(wxPageContainer::OnRightDown)
+EVT_MIDDLE_DOWN(wxPageContainer::OnMiddleDown)
+EVT_MOTION(wxPageContainer::OnMouseMove)
+EVT_ERASE_BACKGROUND(wxPageContainer::OnEraseBackground)
+EVT_LEAVE_WINDOW(wxPageContainer::OnMouseLeave)
+EVT_ENTER_WINDOW(wxPageContainer::OnMouseEnterWindow)
+EVT_LEFT_DCLICK(wxPageContainer::OnLeftDClick)
 END_EVENT_TABLE()

-wxPageContainerBase::wxPageContainerBase(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
+wxPageContainer::wxPageContainer(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
 : m_ImageList(NULL)
 , m_iActivePage(-1)
 , m_pDropTarget(NULL)
 , m_nLeftClickZone(wxFNB_NOWHERE)
+, m_iPreviousActivePage(-1)
 {
 	m_pRightClickMenu = NULL;
 	m_nXButtonStatus = wxFNB_BTN_NONE;
+	m_nArrowDownButtonStatus = wxFNB_BTN_NONE;
 	m_pParent = parent;
 	m_nRightButtonStatus = wxFNB_BTN_NONE;
 	m_nLeftButtonStatus = wxFNB_BTN_NONE;
@@ -1053,31 +655,30 @@
 	m_colorFrom   = wxColor(*wxWHITE);
 	m_activeTabColor = wxColor(*wxWHITE);
 	m_activeTextColor = wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
+	m_nonActiveTextColor = wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
 	m_tabAreaColor = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);

-	wxWindow::Create(parent, id, pos, size, style | wxNO_BORDER | wxNO_FULL_REPAINT_ON_RESIZE);
+	// Set default page height, this is done according to the system font
+	wxMemoryDC memDc;
+	int width, height;

-	m_nonActiveTextColor = wxT("GREY");
-	m_pDropTarget = new wxFNBDropTarget<wxPageContainerBase>(this, &wxPageContainerBase::OnDropTarget);
-	SetDropTarget(m_pDropTarget);
-}
+#ifdef __WXGTK__
+	wxFont normalFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+	wxFont boldFont = normalFont;
+	boldFont.SetWeight(wxBOLD);
+	memDc.SetFont( boldFont );
+#endif

-int wxPageContainerBase::GetButtonAreaWidth(void)
-{
-	int btnareawidth;
-	long style = GetParent()->GetWindowStyleFlag();
-	btnareawidth = ((wxFlatNotebookBase *)m_pParent)->m_nPadding * 2;
+	memDc.GetTextExtent(wxT("Tp"), &width, &height);
+	int tabHeight = height + wxFNB_HEIGHT_SPACER; // We use 10 pixels as padding

-	if ((style & wxFNB_NO_X_BUTTON) == 0)
-		btnareawidth += BUTTON_SPACE;
+	wxWindow::Create(parent, id, pos, wxSize(size.x, tabHeight), style | wxNO_BORDER | wxNO_FULL_REPAINT_ON_RESIZE);

-	if ((style & wxFNB_NO_NAV_BUTTONS) == 0)
-		btnareawidth += BUTTON_SPACE*2;
-
-	return btnareawidth;
+	m_pDropTarget = new wxFNBDropTarget<wxPageContainer>(this, &wxPageContainer::OnDropTarget);
+	SetDropTarget(m_pDropTarget);
 }

-wxPageContainerBase::~wxPageContainerBase(void)
+wxPageContainer::~wxPageContainer(void)
 {
 	if(m_pRightClickMenu)
 	{
@@ -1086,431 +687,45 @@
 	}
 }

-void wxPageContainerBase::OnPaint(wxPaintEvent &event)
+void wxPageContainer::OnPaint(wxPaintEvent & WXUNUSED(event))
 {
 	wxBufferedPaintDC dc(this);
-	if(m_pagesInfoVec.empty() || m_nFrom >= (int)m_pagesInfoVec.size())
-	{
-		Hide();
-		event.Skip();
-		return;
-	}
-
-	// Get the text hight
-	int height, width, tabHeight;
-	long style = GetParent()->GetWindowStyleFlag();
-	wxString stam = wxT("Tp");	// Temp data to get the text height;
-	dc.GetTextExtent(stam, &width, &height);
-
-	tabHeight = height + 8; // We use 8 pixels as padding
-
-	// Calculate the number of rows required for drawing the tabs
-	wxRect rect = GetClientRect();
-	int clientWidth = rect.width;
-
-	// Set the maximum client size
-	SetSizeHints(wxSize(GetButtonsAreaLength(), tabHeight));
-
-	// Set brushes, pens and fonts
-	wxFont normalFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
-	wxFont boldFont = normalFont;
-	boldFont.SetWeight(wxFONTWEIGHT_BOLD);
-
-	wxPen borderPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
-
-	wxBrush backBrush;
-	if(style & wxFNB_VC71)
-		backBrush = wxBrush(wxColour(247, 243, 233));
-	else
-		backBrush = wxBrush(m_tabAreaColor);
-
-	wxBrush noselBrush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
-	wxBrush selBrush = wxBrush(m_activeTabColor);
-
-	wxSize size = GetSize();
-
-	// Background
-	dc.SetTextBackground(style & wxFNB_VC71 ? wxColour(247, 243, 233) : GetBackgroundColour());
-	dc.SetTextForeground(m_activeTextColor);
-	dc.SetBrush(backBrush);
-
-	// If border style is set, set the pen to be border pen
-	if(style & wxFNB_TABS_BORDER_SIMPLE)
-		dc.SetPen(borderPen);
-	else
-		dc.SetPen(*wxTRANSPARENT_PEN);
-	dc.DrawRectangle(0, 0, size.x, size.y);
-
-	// We always draw the bottom/upper line of the tabs
-	// regradless the style
-	dc.SetPen(borderPen);
-	DrawTabsLine(dc, GetClientRect());
-
-	// Restore the pen
-	dc.SetPen(borderPen);
-
-	if(style & wxFNB_VC71 && !(style & wxFNB_BOTTOM))
-	{
-		wxPen pen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
-		pen.SetWidth(4);
-		dc.SetPen(pen);
-		dc.DrawLine(0, size.y, size.x, size.y);
-
-		// Restore the pen
-		dc.SetPen(borderPen);
-	}
-
-	// Draw labels
-	int pom;
-	dc.SetFont(boldFont);
-	int posx = ((wxFlatNotebookBase *)m_pParent)->m_nPadding;
-	int i = 0;
-
-	// Update all the tabs from 0 to 'm_nFrom' to be non visible
-	for(i=0; i<m_nFrom; i++)
-	{
-		m_pagesInfoVec[i].SetPosition(wxPoint(-1, -1));
-		m_pagesInfoVec[i].GetRegion().Clear();
-	}
-
-	int shapePoints(0);
-
-	if(style & wxFNB_VC71)
-		tabHeight = (style & wxFNB_BOTTOM) ? tabHeight - 4 :  tabHeight;
-	else if(style & wxFNB_FANCY_TABS)
-		tabHeight = (style & wxFNB_BOTTOM) ? tabHeight - 2 :  tabHeight;
-
-	// Draw the visible tabs
-	for(i=m_nFrom; i<(int)m_pagesInfoVec.size(); i++)
-	{
-		if(style != wxFNB_VC71)
-			shapePoints = (int)(tabHeight*tan((double)m_pagesInfoVec[i].GetTabAngle()/180.0*M_PI));
-		else
-			shapePoints = 0;
-
-		dc.SetPen(borderPen);
-		dc.SetBrush((i==GetSelection()) ? selBrush : noselBrush);
-
-		// Calculate the text length using the bold font, so when selecting a tab
-		// its width will not change
-		dc.SetFont(boldFont);
-		dc.GetTextExtent(GetPageText(i), &width, &pom);
-
-		// Now set the font to the correct font
-		dc.SetFont((i==GetSelection()) ? boldFont : normalFont);
-
-		// Set a minimum size to a tab
-		if(width < 20)
-			width = 20;
-
-		// Add the padding to the tab width
-		// Tab width:
-		// +-----------------------------------------------------------+
-		// | PADDING | IMG | IMG_PADDING | TEXT | PADDING | x |PADDING |
-		// +-----------------------------------------------------------+
-
-		int tabWidth = ((wxFlatNotebookBase *)m_pParent)->m_nPadding * 2 + width;
-		int imageYCoord = style & wxFNB_BOTTOM ? 3 : 6;
-
-		/// Style to add a small 'x' button on the top right
-		/// of the tab
-		if(style & wxFNB_X_ON_TAB && i == GetSelection())
-		{
-			/// The xpm image that contains the 'x' button is 9 pixles
-			tabWidth += ((wxFlatNotebookBase *)m_pParent)->m_nPadding + 9;
-		}
-
-		if(!(style & wxFNB_VC71) && !(style & wxFNB_FANCY_TABS))
-			// Default style
-			tabWidth += 2 * shapePoints;
-
-		bool hasImage = (m_ImageList != NULL && m_pagesInfoVec[i].GetImageIndex() != -1);
-
-		// For VC71 style, we only add the icon size (16 pixels)
-		if(hasImage)
-		{
-			if( (style & wxFNB_VC71) || (style & wxFNB_FANCY_TABS))
-				tabWidth += (16 + ((wxFlatNotebookBase*)m_pParent)->m_nPadding);
-			else
-				// Default style
-				tabWidth += (16 + ((wxFlatNotebookBase*)m_pParent)->m_nPadding) + shapePoints / 2;
-		}
-
-		// Check if we can draw more
-		if(posx + tabWidth + GetButtonsAreaLength() >= clientWidth)
-			break;
-
-		// By default we clean the tab region
-		m_pagesInfoVec[i].GetRegion().Clear();
-
-		// Clean the 'x' buttn on the tab
-		// 'Clean' rectanlge is a rectangle with width or height
-		// with values lower than or equal to 0
-		m_pagesInfoVec[i].GetXRect().SetSize(wxSize(-1, -1));
-
-		// Draw the tab
-		if(style & wxFNB_FANCY_TABS)
-			DrawFancyTab(dc, posx, i, hasImage, tabWidth, tabHeight);
-		else if(style & wxFNB_VC71)
-			DrawVC71Tab(dc, posx, i, hasImage, tabWidth, tabHeight);
-		else
-			DrawStandardTab(dc, posx, i, hasImage, tabWidth, tabHeight);
-
-
-		// Text drawing offset from the left border of the
-		// rectangle
-		int textOffset;
-
-		// The width of the images are 16 pixels
-		if(hasImage)
-			textOffset = ((wxFlatNotebookBase *)m_pParent)->m_nPadding * 2 + 16 + shapePoints / 2 ;
-		else
-			textOffset = ((wxFlatNotebookBase *)m_pParent)->m_nPadding + shapePoints / 2 ;
-
-		if(i != GetSelection())
-		{
-			// Set the text background to be like the vertical lines
-			dc.SetTextForeground(m_nonActiveTextColor);
-		}
-
-		// Draw the image for the tab if any
-#ifdef __WXMSW__
-		imageYCoord = style & wxFNB_BOTTOM ? 3 : 6;
-#else
-		imageYCoord = style & wxFNB_BOTTOM ? 3 : 10;
-#endif
-
-		if(hasImage)
-		{
-			int imageXOffset = textOffset - 16 - ((wxFlatNotebookBase *)m_pParent)->m_nPadding;
-			dc.DrawBitmap((*m_ImageList)[m_pagesInfoVec[i].GetImageIndex()],
-				posx + imageXOffset, imageYCoord, true);
-		}
-
-		dc.DrawText(GetPageText(i), posx + textOffset, imageYCoord);
-
-		int textWidth, textHeight;
-		dc.GetTextExtent(GetPageText(i), &textWidth, &textHeight);
-
-		int tabCloseButtonXCoord = posx + textOffset + textWidth + ((wxFlatNotebookBase *)m_pParent)->m_nPadding;
-		/// From version 1.2 - a style to add 'x' button
-		/// on a tab
-		if(style & wxFNB_X_ON_TAB)
-		{
-			int tabCloseButtonYCoord = imageYCoord + 3;
-			wxRect x_rect(tabCloseButtonXCoord, tabCloseButtonYCoord, FNB::tab_x_size, FNB::tab_x_size);
-			DrawTabX(dc, x_rect, i);
-		}
-
-		// Restore the text forground
-		dc.SetTextForeground(m_activeTextColor);
-
-		// Update the tab position & size
-		m_pagesInfoVec[i].SetPosition(wxPoint(posx, VERTICAL_BORDER_PADDING));
-		m_pagesInfoVec[i].SetSize(wxSize(tabWidth, tabHeight));
-
-		posx += tabWidth;
-	}
-
-	// Update all tabs that can not fit into the screen as non-visible
-	for(; i<(int)m_pagesInfoVec.size(); i++)
-	{
-		m_pagesInfoVec[i].SetPosition(wxPoint(-1, -1));
-		m_pagesInfoVec[i].GetRegion().Clear();
-	}
-
-	// Draw the left/right/close buttons
-	// Left arrow
-	DrawLeftArrow(dc);
-	DrawRightArrow(dc);
-	DrawX(dc);
+	wxFNBRendererPtr render = wxFNBRendererMgrST::Get()->GetRenderer( GetParent()->GetWindowStyleFlag() );
+	render->DrawTabs(this, dc);
 }

-// Tabs drawings
-void wxPageContainerBase::DrawFancyTab(wxBufferedPaintDC& dc,
-								   const int& posx,
-								   const int &tabIdx,
-								   const bool &hasImage,
-								   const int &tabWidth,
-								   const int &tabHeight)
+void wxPageContainer::AddPage(const wxString& caption, const bool selected, const int imgindex)
 {
-	// Fancy tabs - like with VC71 but with the following differences:
-	// - The Selected tab is colored with gradient color
-	wxPen borderPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
-	wxPen pen = (tabIdx==GetSelection()) ? wxPen(m_colorBorder) : wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
-	long style = GetParent()->GetWindowStyleFlag();
-	dc.SetPen(pen);
-	dc.SetBrush((tabIdx==GetSelection()) ? wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)) : wxBrush(wxColour(247, 243, 233)));
-	if(tabIdx == GetSelection())
-	{
-		int posy = (style & wxFNB_BOTTOM) ? 0 : VERTICAL_BORDER_PADDING;
-
-		wxRect rect(posx, posy, tabWidth, tabHeight);
-		FillGradientColor(dc, rect);
-		dc.SetBrush(*wxTRANSPARENT_BRUSH);
-		pen.SetWidth(1);
-		dc.SetPen(pen);
-
-		dc.DrawRectangle(rect);
-		pen.SetWidth(1);
-		dc.SetPen(pen);
-	}
-	else
-	{
-		// We dont draw a rectangle for non selected tabs, but only
-		// vertical line on the left
-		dc.SetPen(borderPen);
-		dc.DrawLine(posx + tabWidth, VERTICAL_BORDER_PADDING + 3, posx + tabWidth, tabHeight - 4);
-	}
-}
-
-void wxPageContainerBase::DrawVC71Tab(wxBufferedPaintDC& dc,
-								  const int& posx,
-								  const int &tabIdx,
-								  const bool &hasImage,
-								  const int &tabWidth,
-								  const int &tabHeight)
-{
-	// Visual studio 7.1 style
-	wxPen borderPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
-	long style = GetParent()->GetWindowStyleFlag();
-
-	dc.SetPen((tabIdx==GetSelection()) ? wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)) : borderPen);
-	dc.SetBrush((tabIdx==GetSelection()) ? wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)) : wxBrush(wxColour(247, 243, 233)));
-
-	if(tabIdx == GetSelection())
-	{
-		int posy = (style & wxFNB_BOTTOM) ? 0 : VERTICAL_BORDER_PADDING;
-		dc.DrawRectangle(posx, posy, tabWidth, tabHeight);
-
-		// Draw a black line on the left side of the
-		// rectangle
-		wxPen pen = wxPen(*wxBLACK);
-		dc.SetPen(pen);
-
-		int blackLineHeight = (style & wxFNB_BOTTOM) ? VERTICAL_BORDER_PADDING + tabHeight - 3 : VERTICAL_BORDER_PADDING + tabHeight - 5;
-		dc.DrawLine(posx + tabWidth, (style & wxFNB_BOTTOM) ? 0 : VERTICAL_BORDER_PADDING,
-			posx + tabWidth, blackLineHeight - 1);
-
-		// To give the tab more 3D look we do the following
-		// Incase the tab is on top,
-		// Draw a thik white line on topof the rectangle
-		// Otherwise, draw a thin (1 pixel) black line at the bottom
-
-		pen = wxPen((style & wxFNB_BOTTOM) ? *wxBLACK : *wxWHITE);
-		pen.SetWidth((style & wxFNB_BOTTOM) ? 1 : 2);
-		dc.SetPen(pen);
-		int whiteLinePosY = (style & wxFNB_BOTTOM) ? blackLineHeight - 1: VERTICAL_BORDER_PADDING ;
-		dc.DrawLine(posx , whiteLinePosY, posx + tabWidth, whiteLinePosY);
-	}
-	else
-	{
-		// We dont draw a rectangle for non selected tabs, but only
-		// vertical line on the left
-		int blackLineHeight = (style & wxFNB_BOTTOM) ? tabHeight - 5 : VERTICAL_BORDER_PADDING + tabHeight - 8;
-		dc.DrawLine(posx + tabWidth, (style & wxFNB_BOTTOM) ? 3 : VERTICAL_BORDER_PADDING + 1, posx + tabWidth, blackLineHeight + 1);
-	}
-}
-
-
-void wxPageContainerBase::DrawStandardTab(wxBufferedPaintDC& dc,
-									  const int& posx,
-									  const int &tabIdx,
-									  const bool &hasImage,
-									  const int &tabWidth,
-									  const int &tabHeight)
-{
-	// Default style
-	wxPen borderPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
-	long style = GetParent()->GetWindowStyleFlag();
-
-	wxPoint tabPoints[7];
-	tabPoints[0].x = posx;
-	tabPoints[0].y = (style & wxFNB_BOTTOM) ? 0 : tabHeight;
-
-	tabPoints[1].x = (int)(posx+(tabHeight-2)*tan((double)m_pagesInfoVec[tabIdx].GetTabAngle()/180.0*M_PI));
-	tabPoints[1].y = (style & wxFNB_BOTTOM) ? tabHeight - (VERTICAL_BORDER_PADDING+2) : (VERTICAL_BORDER_PADDING+2);
-
-	tabPoints[2].x = tabPoints[1].x+2;
-	tabPoints[2].y = (style & wxFNB_BOTTOM) ? tabHeight - VERTICAL_BORDER_PADDING : VERTICAL_BORDER_PADDING;
-
-	tabPoints[3].x = (int)(posx+tabWidth-(tabHeight-2)*tan((double)m_pagesInfoVec[tabIdx].GetTabAngle()/180.0*M_PI))-2;
-	tabPoints[3].y = (style & wxFNB_BOTTOM) ? tabHeight - VERTICAL_BORDER_PADDING : VERTICAL_BORDER_PADDING;
-
-	tabPoints[4].x = tabPoints[3].x+2;
-	tabPoints[4].y = (style & wxFNB_BOTTOM) ? tabHeight - (VERTICAL_BORDER_PADDING+2) : (VERTICAL_BORDER_PADDING+2);
-
-	tabPoints[5].x = posx+tabWidth;
-	tabPoints[5].y = (style & wxFNB_BOTTOM) ? 0 : tabHeight;
-
-	tabPoints[6].x = tabPoints[0].x;
-	tabPoints[6].y = tabPoints[0].y;
-
-	if(tabIdx == GetSelection())
-	{
-		// Draw the tab as rounded rectangle
-		dc.DrawPolygon(7, tabPoints);
-	}
-	else
-	{
-		if(tabIdx != GetSelection() - 1)
-		{
-			// Draw a vertical line to the right of the text
-			int pt1x, pt1y, pt2x, pt2y;
-			pt1x = tabPoints[5].x;
-			pt1y = (style & wxFNB_BOTTOM) ? 4 : tabHeight - 4;
-			pt2x = tabPoints[5].x;
-			pt2y = (style & wxFNB_BOTTOM) ? tabHeight - 4 : 4 ;
-			dc.DrawLine(pt1x, pt1y, pt2x, pt2y);
-		}
-	}
-
-	if(style & wxFNB_BOTTOM && tabIdx == GetSelection())
-	{
-		wxPen savePen = dc.GetPen();
-		wxPen whitePen = wxPen(*wxWHITE);
-		whitePen.SetWidth(1);
-		dc.SetPen(whitePen);
-
-		dc.DrawLine(tabPoints[0], tabPoints[5]);
-
-		// Restore the pen
-		dc.SetPen(savePen);
-	}
-}
-
-void wxPageContainerBase::AddPage(const wxString& caption, const bool selected, const int imgindex)
-{
 	if(selected)
 	{
-		m_iActivePage = (int)m_pagesInfoVec.size();
+		m_iPreviousActivePage = m_iActivePage;
+		m_iActivePage = (int)m_pagesInfoVec.GetCount();
 	}
-	wxPageInfo pg(caption, imgindex);
-	pg.SetPosition(wxPoint(1,1));
-	m_pagesInfoVec.push_back(pg);
+
+	/// Create page info and add it to the vector
+	wxPageInfo pageInfo(caption, imgindex);
+	m_pagesInfoVec.Add(pageInfo);
 	Refresh();
 }

-bool wxPageContainerBase::InsertPage(size_t index, wxWindow* /*page*/, const wxString& text, bool select, const int imgindex)
+bool wxPageContainer::InsertPage(size_t index, wxWindow* /*page*/, const wxString& text, bool select, const int imgindex)
 {
 	if(select)
 	{
-		m_iActivePage = (int)m_pagesInfoVec.size();
+		m_iPreviousActivePage = m_iActivePage;
+		m_iActivePage = (int)m_pagesInfoVec.GetCount();
 	}
-	wxPageInfo pg(text, imgindex);
-	pg.SetPosition(wxPoint(1,1));
-	std::vector<wxPageInfo>::iterator iter = m_pagesInfoVec.begin() + index;
-	m_pagesInfoVec.insert(iter, pg);
+	m_pagesInfoVec.Insert(wxPageInfo(text, imgindex), index);
 	Refresh();
 	return true;
 }

-void wxPageContainerBase::OnSize(wxSizeEvent& WXUNUSED(event))
+void wxPageContainer::OnSize(wxSizeEvent& WXUNUSED(event))
 {
 	Refresh(); // Call on paint
 }

-void wxPageContainerBase::OnMiddleDown(wxMouseEvent& event)
+void wxPageContainer::OnMiddleDown(wxMouseEvent& event)
 {
 	// Test if this style is enabled
 	long style = GetParent()->GetWindowStyleFlag();
@@ -1524,16 +739,7 @@
 	{
 	case wxFNB_TAB:
 		{
-			wxFlatNotebookEvent event(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, GetParent()->GetId());
-			event.SetSelection(tabIdx);
-			event.SetEventObject(GetParent());
-			GetParent()->GetEventHandler()->ProcessEvent(event);
-			if (event.IsAllowed())
-			{
-				// Set the current tab to be active
-				SetSelection((size_t)tabIdx);
-				DeletePage((size_t)tabIdx, false);
-			}
+			DeletePage((size_t)tabIdx);
 			break;
 		}
 	default:
@@ -1542,44 +748,47 @@
 	event.Skip();
 }

-void wxPageContainerBase::OnRightDown(wxMouseEvent& event)
+void wxPageContainer::OnRightDown(wxMouseEvent& event)
 {
-	wxPageInfo pgInfo;
-	int tabIdx;
-	int where = HitTest(event.GetPosition(), pgInfo, tabIdx);
-	switch(where)
+	if(m_pRightClickMenu)
 	{
-	case wxFNB_TAB:
-	case wxFNB_TAB_X:
+		wxPageInfo pgInfo;
+		int tabIdx;
+		int where = HitTest(event.GetPosition(), pgInfo, tabIdx);
+		switch(where)
 		{
-			if(!m_pagesInfoVec[tabIdx].GetEnabled())
-				break;
+		case wxFNB_TAB:
+		case wxFNB_TAB_X:
+			{
+				if(!m_pagesInfoVec[tabIdx].GetEnabled())
+					break;

-			// Set the current tab to be active
-			SetSelection((size_t)tabIdx);
+				// Set the current tab to be active
+				SetSelection((size_t)tabIdx);

-			// If the owner has defined a context menu for the tabs,
-			// popup the right click menu
-			if (m_pRightClickMenu)
-				PopupMenu(m_pRightClickMenu);
-			else
-			{
-				// send a message to popup a custom menu
-				wxFlatNotebookEvent event(wxEVT_COMMAND_FLATNOTEBOOK_CONTEXT_MENU, GetParent()->GetId());
-				event.SetSelection((int)tabIdx);
-				event.SetOldSelection((int)m_iActivePage);
-				event.SetEventObject(GetParent());
-				GetParent()->GetEventHandler()->ProcessEvent(event);
+				// If the owner has defined a context menu for the tabs,
+				// popup the right click menu
+				if (m_pRightClickMenu)
+					PopupMenu(m_pRightClickMenu);
+				else
+				{
+					// send a message to popup a custom menu
+					wxFlatNotebookEvent event(wxEVT_COMMAND_FLATNOTEBOOK_CONTEXT_MENU, GetParent()->GetId());
+					event.SetSelection((int)tabIdx);
+					event.SetOldSelection((int)m_iActivePage);
+					event.SetEventObject(GetParent());
+					GetParent()->GetEventHandler()->ProcessEvent(event);
+				}
 			}
+			break;
+		default:
+			break;
 		}
-		break;
-	default:
-		break;
 	}
 	event.Skip();
 }

-void wxPageContainerBase::OnLeftDown(wxMouseEvent& event)
+void wxPageContainer::OnLeftDown(wxMouseEvent& event)
 {
 	wxPageInfo pgInfo;
 	int tabIdx;
@@ -1589,10 +798,15 @@
 	m_nLeftButtonStatus  = wxFNB_BTN_NONE;
 	m_nRightButtonStatus = wxFNB_BTN_NONE;
 	m_nTabXButtonStatus  = wxFNB_BTN_NONE;
+	m_nArrowDownButtonStatus = wxFNB_BTN_NONE;

 	m_nLeftClickZone = HitTest(event.GetPosition(), pgInfo, tabIdx);
 	switch(m_nLeftClickZone)
 	{
+	case wxFNB_DROP_DOWN_ARROW:
+		m_nArrowDownButtonStatus = wxFNB_BTN_PRESSED;
+		Refresh();
+		break;
 	case wxFNB_LEFT_ARROW:
 		m_nLeftButtonStatus = wxFNB_BTN_PRESSED;
 		Refresh();
@@ -1638,7 +852,7 @@
 	}
 }

-void wxPageContainerBase::OnLeftUp(wxMouseEvent& event)
+void wxPageContainer::OnLeftUp(wxMouseEvent& event)
 {
 	wxPageInfo pgInfo;
 	int tabIdx;
@@ -1672,7 +886,7 @@
 		}
 	case wxFNB_RIGHT_ARROW:
 		{
-			if(m_nFrom >= (int)m_pagesInfoVec.size() - 1)
+			if(m_nFrom >= (int)m_pagesInfoVec.GetCount() - 1)
 				break;

 			// Make sure that the button was pressed before
@@ -1683,7 +897,7 @@

 			// Check if the right most tab is visible, if it is
 			// don't rotate right anymore
-			if(m_pagesInfoVec[m_pagesInfoVec.size()-1].GetPosition() != wxPoint(-1, -1))
+			if(m_pagesInfoVec[m_pagesInfoVec.GetCount()-1].GetPosition() != wxPoint(-1, -1))
 				break;

 			int lastVisibleTab = GetLastVisibleTab();
@@ -1720,35 +934,62 @@
 			DeletePage((size_t)m_iActivePage);
 			break;
 		}
+	case wxFNB_DROP_DOWN_ARROW:
+		{
+			// Make sure that the button was pressed before
+			if(m_nArrowDownButtonStatus != wxFNB_BTN_PRESSED)
+				break;

+			m_nArrowDownButtonStatus = wxFNB_BTN_NONE;
+
+			// Refresh the button status
+			wxFNBRendererPtr render = wxFNBRendererMgrST::Get()->GetRenderer( GetParent()->GetWindowStyleFlag() );
+			wxClientDC dc(this);
+			render->DrawDropDownArrow(this, dc);
+
+			PopupTabsMenu();
+			break;
+		}
 	}
 }

-int wxPageContainerBase::HitTest(const wxPoint& pt, wxPageInfo& pageInfo, int &tabIdx)
+int wxPageContainer::HitTest(const wxPoint& pt, wxPageInfo& pageInfo, int &tabIdx)
 {
+	wxFNBRendererPtr render = wxFNBRendererMgrST::Get()->GetRenderer( GetParent()->GetWindowStyleFlag() );
+
 	wxRect rect = GetClientRect();
-	int btnLeftPos = GetLeftButtonPos();
-	int btnRightPos = GetRightButtonPos();
-	int btnXPos = GetXPos();
+	int btnLeftPos = render->GetLeftButtonPos(this);
+	int btnRightPos = render->GetRightButtonPos(this);
+	int btnXPos =render->GetXPos(this);
 	long style = GetParent()->GetWindowStyleFlag();
+
 	tabIdx = -1;
-	if(m_pagesInfoVec.empty())
+	if(m_pagesInfoVec.IsEmpty())
 	{
 		return wxFNB_NOWHERE;
 	}

-	rect = wxRect(btnXPos, 5, 12, 12);
+	rect = wxRect(btnXPos, 8, 16, 16);
 	if(rect.Inside(pt))
 	{
 		return (style & wxFNB_NO_X_BUTTON) ? wxFNB_NOWHERE : wxFNB_X;
 	}

-	rect = wxRect(btnRightPos, 5, 12, 12);
+	rect = wxRect(btnRightPos, 8, 16, 16);
+	if( style & wxFNB_DROPDOWN_TABS_LIST )
+	{
+		rect = wxRect(render->GetDropArrowButtonPos( this ), 8, 16, 16);
+		if( rect.Inside(pt) )
+			return wxFNB_DROP_DOWN_ARROW;
+	}
+
 	if(rect.Inside(pt))
 	{
 		return (style & wxFNB_NO_NAV_BUTTONS) ? wxFNB_NOWHERE : wxFNB_RIGHT_ARROW;
 	}
-	rect = wxRect(btnLeftPos, 5, 12, 12);
+
+
+	rect = wxRect(btnLeftPos, 8, 16, 16);
 	if(rect.Inside(pt))
 	{
 		return (style & wxFNB_NO_NAV_BUTTONS) ? wxFNB_NOWHERE : wxFNB_LEFT_ARROW;
@@ -1756,31 +997,49 @@

 	// Test whether a left click was made on a tab
 	bool bFoundMatch = false;
-	for(size_t cur=m_nFrom; cur<m_pagesInfoVec.size(); cur++)
+	for(size_t cur=m_nFrom; cur<m_pagesInfoVec.GetCount(); cur++)
 	{
 		wxPageInfo pgInfo = m_pagesInfoVec[cur];
 		if(pgInfo.GetPosition() == wxPoint(-1, -1))
 			continue;
-		if(style & wxFNB_X_ON_TAB && (int)cur == GetSelection())
+		if(style & wxFNB_VC8)
 		{
-			// 'x' button exists on a tab
-			if(m_pagesInfoVec[cur].GetXRect().Inside(pt))
+			if(m_pagesInfoVec[cur].GetRegion().Contains(pt) == wxInRegion)
 			{
+				if(bFoundMatch || (int)cur == GetSelection())
+				{
+					pageInfo = pgInfo;
+					tabIdx = (int)cur;
+					return wxFNB_TAB;
+				}
 				pageInfo = pgInfo;
 				tabIdx = (int)cur;
-				return wxFNB_TAB_X;
+				bFoundMatch = true;
 			}
 		}
-
-		wxRect tabRect = wxRect(pgInfo.GetPosition().x, pgInfo.GetPosition().y,
-			pgInfo.GetSize().x, pgInfo.GetSize().y);
-		if(tabRect.Inside(pt))
+		else
 		{
-			// We have a match
-			// wxMessageBox(pgInfo.m_strCaption);
-			pageInfo = pgInfo;
-			tabIdx = (int)cur;
-			return wxFNB_TAB;
+			if(style & wxFNB_X_ON_TAB && (int)cur == GetSelection())
+			{
+				// 'x' button exists on a tab
+				if(m_pagesInfoVec[cur].GetXRect().Inside(pt))
+				{
+					pageInfo = pgInfo;
+					tabIdx = (int)cur;
+					return wxFNB_TAB_X;
+				}
+			}
+
+			wxRect tabRect = wxRect(pgInfo.GetPosition().x, pgInfo.GetPosition().y,
+				pgInfo.GetSize().x, pgInfo.GetSize().y);
+			if(tabRect.Inside(pt))
+			{
+				// We have a match
+				// wxMessageBox(pgInfo.m_strCaption);
+				pageInfo = pgInfo;
+				tabIdx = (int)cur;
+				return wxFNB_TAB;
+			}
 		}
 	}

@@ -1791,17 +1050,17 @@
 	return wxFNB_NOWHERE;
 }

-void wxPageContainerBase::SetSelection(size_t page)
+void wxPageContainer::SetSelection(size_t page)
 {
-	wxFlatNotebookBase* book = (wxFlatNotebookBase*)GetParent();
+	wxFlatNotebook* book = (wxFlatNotebook*)GetParent();
 	book->SetSelection(page);
 	DoSetSelection(page);
 }

-void wxPageContainerBase::DoSetSelection(size_t page)
+void wxPageContainer::DoSetSelection(size_t page)
 {
 	// Make sure that the selection is visible
-	long style = GetParent()->GetWindowStyleFlag();
+	/*long style = GetParent()->GetWindowStyleFlag();
 	if(style & wxFNB_NO_NAV_BUTTONS)
 	{
 		// Incase that we dont have navigation buttons,
@@ -1809,19 +1068,19 @@
 		// Just do the refresh
 		Refresh();
 		return;
-	}
+	}*/

-	if(page < m_pagesInfoVec.size())
+	if(page < m_pagesInfoVec.GetCount())
 	{
 		//! fix for tabfocus
-		wxWindow* da_page = ((wxFlatNotebookBase *)m_pParent)->GetPage(page);
+		wxWindow* da_page = ((wxFlatNotebook *)m_pParent)->GetPage(page);
 		if ( da_page!=NULL )
 			da_page->SetFocus();
 	}

 	if(!IsTabVisible(page))
 	{
-		if(page == m_pagesInfoVec.size() - 1)
+		if(page == m_pagesInfoVec.GetCount() - 1)
 		{
 			// Incase the added tab is last,
 			// the function IsTabVisible() will always return false
@@ -1843,14 +1102,14 @@
 	}
 }

-void wxPageContainerBase::DeletePage(size_t page, bool notify)
+void wxPageContainer::DeletePage(size_t page)
 {
-	wxFlatNotebookBase* book = (wxFlatNotebookBase*)GetParent();
-	book->DeletePage(page, notify);
+	wxFlatNotebook* book = (wxFlatNotebook*)GetParent();
+	book->DeletePage(page);
 	book->Refresh();
 }

-bool wxPageContainerBase::IsTabVisible(size_t page)
+bool wxPageContainer::IsTabVisible(size_t page)
 {
 	int iPage = (int)page;
 	int iLastVisiblePage = GetLastVisibleTab();
@@ -1858,24 +1117,27 @@
 	return iPage <= iLastVisiblePage && iPage >= m_nFrom;
 }

-void wxPageContainerBase::DoDeletePage(size_t page)
+void wxPageContainer::DoDeletePage(size_t page)
 {
 	// Remove the page from the vector
-	wxFlatNotebookBase* book = (wxFlatNotebookBase*)GetParent();
-	std::vector<wxPageInfo>::iterator iter = m_pagesInfoVec.begin();
-	std::vector<wxPageInfo>::iterator endIter = m_pagesInfoVec.end();
+	wxFlatNotebook* book = (wxFlatNotebook*)GetParent();
+	m_pagesInfoVec.RemoveAt(page);

-	m_pagesInfoVec.erase(iter + page);
-
-	// Thanks to Yiannis AKA Mandrav
+	// Thanks to Yiaanis AKA Mandrav
 	if (m_iActivePage >= (int)page)
+	{
 		m_iActivePage--;
+		m_iPreviousActivePage = -1;
+	}

 	// The delete page was the last first on the array,
 	// but the book still has more pages, so we set the
 	// active page to be the first one (0)
 	if(m_iActivePage < 0 && !m_pagesInfoVec.empty())
+	{
+		m_iPreviousActivePage = -1;
 		m_iActivePage = 0;
+	}

 	// Refresh the tabs
 	if(m_iActivePage >= 0)
@@ -1893,216 +1155,35 @@
 	}
 }

-void wxPageContainerBase::DeleteAllPages()
+void wxPageContainer::DeleteAllPages()
 {
 	m_iActivePage = -1;
+	m_iPreviousActivePage = -1;
 	m_nFrom = 0;
-	m_pagesInfoVec.clear();
+	m_pagesInfoVec.Clear();

 	// Erase the page container drawings
 	wxClientDC dc(this);
 	dc.Clear();
 }

-void wxPageContainerBase::DrawTabX(wxDC& dc, const wxRect& rect, const int& tabIdx)
+void wxPageContainer::OnMouseMove(wxMouseEvent& event)
 {
-	long style = GetParent()->GetWindowStyleFlag();
-	if(!(style & wxFNB_X_ON_TAB) || !CanDrawXOnTab())
-		return;
-
-	/// We draw the 'x' on the active tab only
-	if(tabIdx != GetSelection() || tabIdx < 0)
-		return;
-
-	// Set the bitmap according to the button status
-	wxBitmap xBmp;
-	switch(m_nTabXButtonStatus)
-	{
-	case wxFNB_BTN_HOVER:
-		xBmp = wxBitmap(FNB::tab_x_button_hilite_xpm);
-		break;
-	case wxFNB_BTN_PRESSED:
-		xBmp = wxBitmap(FNB::tab_x_button_pressed_xpm);
-		break;
-	case wxFNB_BTN_NONE:
-	default:
-		xBmp = wxBitmap(FNB::tab_x_button_xpm);
-		break;
-	}
-
-	/// Set the masking
-	xBmp.SetMask(new wxMask(xBmp, MASK_COLOR));
-
-	// Draw the new bitmap
-	dc.DrawBitmap(xBmp, rect.x, rect.y, true);
-
-	// Update the vectpr
-	m_pagesInfoVec[tabIdx].SetXRect(rect);
-}
-
-void wxPageContainerBase::DrawLeftArrow(wxDC& dc)
-{
-	long style = GetParent()->GetWindowStyleFlag();
-	if(style & wxFNB_NO_NAV_BUTTONS)
-		return;
-
-	// Make sure that there are pages in the container
-	if(m_pagesInfoVec.empty())
-		return;
-
-	wxRect rect = GetClientRect();
-	int btnLeftPos = GetLeftButtonPos();
-	rect = wxRect(btnLeftPos, 5, 16, 16);
-
-	// Set the bitmap according to the button status
-	wxBitmap arrowBmp;
-	switch(m_nLeftButtonStatus)
-	{
-	case wxFNB_BTN_HOVER:
-		arrowBmp = wxBitmap(FNB::left_arrow_hilite_xpm);
-		break;
-	case wxFNB_BTN_PRESSED:
-		arrowBmp = wxBitmap(FNB::left_arrow_pressed_xpm);
-		break;
-	case wxFNB_BTN_NONE:
-	default:
-		arrowBmp = wxBitmap(FNB::left_arrow_xpm);
-		break;
-	}
-
-	if(m_nFrom == 0)
-	{
-		// Handle disabled arrow
-		arrowBmp = wxBitmap(FNB::left_arrow_disabled_xpm);
-	}
-
-	arrowBmp.SetMask(new wxMask(arrowBmp, MASK_COLOR));
-
-	// Erase old bitmap
-	wxPen pen = wxPen(style & wxFNB_VC71 ? wxColour(247, 243, 233) : m_tabAreaColor);
-	wxBrush brush = wxBrush(style & wxFNB_VC71 ? wxColour(247, 243, 233) :m_tabAreaColor);
-	pen.SetWidth(1);
-	dc.SetPen(pen);
-	dc.SetBrush(brush);
-
-	dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
-
-	// Draw the new bitmap
-	dc.DrawBitmap(arrowBmp, btnLeftPos, 5, true);
-}
-
-void wxPageContainerBase::DrawRightArrow(wxDC& dc)
-{
-	long style = GetParent()->GetWindowStyleFlag();
-	if(style & wxFNB_NO_NAV_BUTTONS)
-		return;
-
-	// Make sure that there are pages in the container
-	if(m_pagesInfoVec.empty())
-		return;
-
-	wxRect rect = GetClientRect();
-	int btnLeftPos = GetRightButtonPos();
-	rect = wxRect(btnLeftPos, 5, 16, 16);
-
-	// Set the bitmap according to the button status
-	wxBitmap arrowBmp;
-	switch(m_nRightButtonStatus)
-	{
-	case wxFNB_BTN_HOVER:
-		arrowBmp = wxBitmap(FNB::right_arrow_hilite_xpm);
-		break;
-	case wxFNB_BTN_PRESSED:
-		arrowBmp = wxBitmap(FNB::right_arrow_pressed_xpm);
-		break;
-	case wxFNB_BTN_NONE:
-	default:
-		arrowBmp = wxBitmap(FNB::right_arrow_xpm);
-		break;
-	}
-
-
-	// Check if the right most tab is visible, if it is
-	// don't rotate right anymore
-	if(m_pagesInfoVec[m_pagesInfoVec.size()-1].GetPosition() != wxPoint(-1, -1))
-	{
-		arrowBmp = wxBitmap(FNB::right_arrow_disabled_xpm);
-	}
-
-	arrowBmp.SetMask(new wxMask(arrowBmp, MASK_COLOR));
-
-	// Erase old bitmap
-	wxPen pen = wxPen(style & wxFNB_VC71 ? wxColour(247, 243, 233) : m_tabAreaColor);
-	wxBrush brush = wxBrush(style & wxFNB_VC71 ? wxColour(247, 243, 233) :m_tabAreaColor);
-	pen.SetWidth(1);
-	dc.SetPen(pen);
-	dc.SetBrush(brush);
-
-	dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
-
-	// Draw the new bitmap
-	dc.DrawBitmap(arrowBmp, btnLeftPos, 5, true);
-}
-
-void wxPageContainerBase::DrawX(wxDC& dc)
-{
-	// Check if this style is enabled
-	long style = GetParent()->GetWindowStyleFlag();
-	if(style & wxFNB_NO_X_BUTTON)
-		return;
-
-	// Make sure that there are pages in the container
-	if(m_pagesInfoVec.empty())
-		return;
-
-	wxRect rect = GetClientRect();
-	int btnLeftPos = GetXPos();
-	rect = wxRect(btnLeftPos, 5, 16, 16);
-
-	// Set the bitmap according to the button status
-	wxBitmap xbmp;
-	switch(m_nXButtonStatus)
-	{
-	case wxFNB_BTN_HOVER:
-		xbmp = wxBitmap(FNB::x_button_hilite_xpm);
-		break;
-	case wxFNB_BTN_PRESSED:
-		xbmp = wxBitmap(FNB::x_button_pressed_xpm);
-		break;
-	case wxFNB_BTN_NONE:
-	default:
-		xbmp = wxBitmap(FNB::x_button_xpm);
-		break;
-	}
-
-	xbmp.SetMask(new wxMask(xbmp, MASK_COLOR));
-
-	// Erase old bitmap
-	wxPen pen = wxPen(style & wxFNB_VC71 ? wxColour(247, 243, 233) : m_tabAreaColor);
-	wxBrush brush = wxBrush(style & wxFNB_VC71 ? wxColour(247, 243, 233) : m_tabAreaColor);
-	pen.SetWidth(1);
-	dc.SetPen(pen);
-	dc.SetBrush(brush);
-	dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
-
-	// Draw the new bitmap
-	dc.DrawBitmap(xbmp, btnLeftPos, 5, true);
-}
-
-void wxPageContainerBase::OnMouseMove(wxMouseEvent& event)
-{
 	if (!m_pagesInfoVec.empty() && IsShown())
 	{
 		const int xButtonStatus = m_nXButtonStatus;
 		const int xTabButtonStatus = m_nTabXButtonStatus;
 		const int rightButtonStatus = m_nRightButtonStatus;
 		const int leftButtonStatus = m_nLeftButtonStatus;
+		const int dropDownButtonStatus = m_nArrowDownButtonStatus;
+
 		long style = GetParent()->GetWindowStyleFlag();

 		m_nXButtonStatus = wxFNB_BTN_NONE;
 		m_nRightButtonStatus = wxFNB_BTN_NONE;
 		m_nLeftButtonStatus = wxFNB_BTN_NONE;
 		m_nTabXButtonStatus = wxFNB_BTN_NONE;
+		m_nArrowDownButtonStatus = wxFNB_BTN_NONE;

 		wxPageInfo pgInfo;
 		int tabIdx;
@@ -2119,6 +1200,16 @@
 				m_nXButtonStatus = wxFNB_BTN_HOVER;
 			}
 			break;
+		case wxFNB_DROP_DOWN_ARROW:
+			if (event.LeftIsDown())
+			{
+				m_nArrowDownButtonStatus = (m_nLeftClickZone == wxFNB_DROP_DOWN_ARROW) ? wxFNB_BTN_PRESSED : wxFNB_BTN_NONE;
+			}
+			else
+			{
+				m_nArrowDownButtonStatus = wxFNB_BTN_HOVER;
+			}
+			break;
 		case wxFNB_TAB_X:
 			if (event.LeftIsDown())
 			{
@@ -2159,10 +1250,12 @@
 				// Set the cursor to be 'No-entry'
 				::wxSetCursor(wxCURSOR_NO_ENTRY);
 			}
+
+			// Support for drag and drop
 			if(event.LeftIsDown() && !(style & wxFNB_NODRAG))
 			{
 				wxFNBDragInfo draginfo(this, tabIdx);
-				wxCustomDataObject dataobject(wxDataFormat(wxT("wxFNB")));
+				wxFNBDragInfoDataObject dataobject(wxDataFormat(wxT("wxFNB")));
 				dataobject.SetData(sizeof(wxFNBDragInfo), &draginfo);
 				wxDropSource dragSource(this);
 				dragSource.SetData(dataobject);
@@ -2172,38 +1265,45 @@
 		}

 		const bool bRedrawX = m_nXButtonStatus != xButtonStatus;
+		const bool bRedrawDropArrow = m_nArrowDownButtonStatus != dropDownButtonStatus;
 		const bool bRedrawRight = m_nRightButtonStatus != rightButtonStatus;
 		const bool bRedrawLeft = m_nLeftButtonStatus != leftButtonStatus;
 		const bool bRedrawTabX = m_nTabXButtonStatus != xTabButtonStatus;

-		if (bRedrawX || bRedrawRight || bRedrawLeft || bRedrawTabX)
+		wxFNBRendererPtr render = wxFNBRendererMgrST::Get()->GetRenderer( GetParent()->GetWindowStyleFlag() );
+
+		if (bRedrawX || bRedrawRight || bRedrawLeft || bRedrawTabX || bRedrawDropArrow)
 		{
 			wxClientDC dc(this);
 			if (bRedrawX)
 			{
-				DrawX(dc);
+				render->DrawX(this, dc);
 			}
 			if (bRedrawLeft)
 			{
-				DrawLeftArrow(dc);
+				render->DrawLeftArrow(this, dc);
 			}
 			if (bRedrawRight)
 			{
-				DrawRightArrow(dc);
+				render->DrawRightArrow(this, dc);
 			}
-			if(bRedrawTabX)
+			if (bRedrawTabX)
 			{
-				DrawTabX(dc, pgInfo.GetXRect(), tabIdx);
+				render->DrawTabX(this, dc, pgInfo.GetXRect(), tabIdx, m_nTabXButtonStatus);
 			}
+			if (bRedrawDropArrow)
+			{
+				render->DrawDropDownArrow(this, dc);
+			}
 		}
 	}
 	event.Skip();
 }

-int wxPageContainerBase::GetLastVisibleTab()
+int wxPageContainer::GetLastVisibleTab()
 {
 	int i;
-	for(i=m_nFrom; i<(int)m_pagesInfoVec.size(); i++)
+	for(i=m_nFrom; i<(int)m_pagesInfoVec.GetCount(); i++)
 	{
 		if(m_pagesInfoVec[i].GetPosition() == wxPoint(-1, -1))
 			break;
@@ -2211,14 +1311,14 @@
 	return (i-1);
 }

-int wxPageContainerBase::GetNumTabsCanScrollLeft()
+int wxPageContainer::GetNumTabsCanScrollLeft()
 {
 	int i;

 	// Reserved area for the buttons (<>x)
 	wxRect rect = GetClientRect();
 	int clientWidth = rect.width;
-	int posx = ((wxFlatNotebookBase *)m_pParent)->m_nPadding, numTabs = 0, pom = 0, width, shapePoints,
+	int posx = ((wxFlatNotebook *)m_pParent)->m_nPadding, numTabs = 0, pom = 0, width, shapePoints,
 		height, tabHeight, tabWidth;

 	wxClientDC dc(this);
@@ -2228,6 +1328,8 @@
 		return 0;

 	long style = GetParent()->GetWindowStyleFlag();
+
+	wxFNBRendererPtr render = wxFNBRendererMgrST::Get()->GetRenderer(style);
 	for(i=m_nFrom; i>=0; i--)
 	{
 		wxFont boldFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
@@ -2237,7 +1339,7 @@
 		wxString stam = wxT("Tp");	// Temp data to get the text height;
 		dc.GetTextExtent(stam, &width, &height);

-		tabHeight = height + 8; // We use 6 pixels as padding
+		tabHeight = height + wxFNB_HEIGHT_SPACER; // We use 6 pixels as padding
 		if(style & wxFNB_VC71)
 			tabHeight = (style & wxFNB_BOTTOM) ? tabHeight - 4 :  tabHeight;
 		else if(style & wxFNB_FANCY_TABS)
@@ -2249,7 +1351,7 @@
 		else
 			shapePoints = 0;

-		tabWidth = ((wxFlatNotebookBase *)m_pParent)->m_nPadding * 2 + width;
+		tabWidth = ((wxFlatNotebook *)m_pParent)->m_nPadding * 2 + width;
 		if(!(style & wxFNB_VC71))
 			// Default style
 			tabWidth += 2 * shapePoints;
@@ -2260,13 +1362,13 @@
 		if(hasImage)
 		{
 			if( !IsDefaultTabs() )
-				tabWidth += (16 + ((wxFlatNotebookBase*)m_pParent)->m_nPadding);
+				tabWidth += (16 + ((wxFlatNotebook*)m_pParent)->m_nPadding);
 			else
 				// Default style
-				tabWidth += (16 + ((wxFlatNotebookBase*)m_pParent)->m_nPadding) + shapePoints / 2;
+				tabWidth += (16 + ((wxFlatNotebook*)m_pParent)->m_nPadding) + shapePoints / 2;
 		}

-		if(posx + tabWidth + GetButtonsAreaLength() >= clientWidth)
+		if(posx + tabWidth + render->GetButtonsAreaLength(this) >= clientWidth)
 			break;

 		numTabs++;
@@ -2275,14 +1377,14 @@
 	return numTabs;
 }

-bool wxPageContainerBase::IsDefaultTabs()
+bool wxPageContainer::IsDefaultTabs()
 {
 	long style = GetParent()->GetWindowStyleFlag();
-	bool res = (style & wxFNB_VC71) || (style & wxFNB_FANCY_TABS);
+	bool res = (style & wxFNB_VC71) || (style & wxFNB_FANCY_TABS) || (style & wxFNB_VC8);
 	return !res;
 }

-void wxPageContainerBase::AdvanceSelection(bool bForward)
+void wxPageContainer::AdvanceSelection(bool bForward)
 {
 	int nSel = GetSelection();

@@ -2297,107 +1399,83 @@
 }


-void wxPageContainerBase::OnMouseLeave(wxMouseEvent& event)
+void wxPageContainer::OnMouseLeave(wxMouseEvent& event)
 {
 	m_nLeftButtonStatus = wxFNB_BTN_NONE;
 	m_nXButtonStatus = wxFNB_BTN_NONE;
 	m_nRightButtonStatus = wxFNB_BTN_NONE;
 	m_nTabXButtonStatus = wxFNB_BTN_NONE;
+	m_nArrowDownButtonStatus = wxFNB_BTN_NONE;

+	long style = GetParent()->GetWindowStyleFlag();
+	wxFNBRendererPtr render = wxFNBRendererMgrST::Get()->GetRenderer(style);
+
 	wxClientDC dc(this);
-	dc.BeginDrawing();
+	render->DrawX(this, dc);
+	render->DrawLeftArrow(this, dc);
+	render->DrawRightArrow(this, dc);
+	if(GetSelection() != -1)
+	{
+		render->DrawTabX(this, dc, m_pagesInfoVec[GetSelection()].GetXRect(), GetSelection(), m_nTabXButtonStatus);
+	}

-	DrawX(dc);
-	DrawLeftArrow(dc);
-	DrawRightArrow(dc);
-	DrawTabX(dc, m_pagesInfoVec[GetSelection()].GetXRect(), GetSelection());
-	dc.EndDrawing();
 	event.Skip();
 }

-void wxPageContainerBase::OnMouseEnterWindow(wxMouseEvent& event)
+void wxPageContainer::OnMouseEnterWindow(wxMouseEvent& event)
 {
 	m_nLeftButtonStatus = wxFNB_BTN_NONE;
 	m_nXButtonStatus = wxFNB_BTN_NONE;
 	m_nRightButtonStatus = wxFNB_BTN_NONE;
 	m_nLeftClickZone = wxFNB_BTN_NONE;
+	m_nArrowDownButtonStatus = wxFNB_BTN_NONE;

 	event.Skip();
 }

-void wxPageContainerBase::ShowTabTooltip(int tabIdx)
+void wxPageContainer::ShowTabTooltip(int tabIdx)
 {
-	wxWindow *pWindow = ((wxFlatNotebookBase *)m_pParent)->GetPage(tabIdx);
-	wxToolTip *pToolTip = pWindow->GetToolTip();
-	if(pToolTip && pToolTip->GetWindow() == pWindow)
-		SetToolTip(pToolTip->GetTip());
-}
-
-void wxPageContainerBase::FillGradientColor(wxBufferedDC& dc, const wxRect& rect)
-{
-	// gradient fill from colour 1 to colour 2 with top to bottom
-
-	if(rect.height < 1 || rect.width < 1)
-		return;
-
-	int size = rect.height;
-
-	// calculate gradient coefficients
-	long style = GetParent()->GetWindowStyleFlag();
-	wxColour col2 = (style & wxFNB_BOTTOM) ? m_colorTo : m_colorFrom;
-	wxColour col1 = (style & wxFNB_BOTTOM) ? m_colorFrom : m_colorTo;
-
-	double rstep = double((col2.Red() -   col1.Red())) / double(size), rf = 0,
-		gstep = double((col2.Green() - col1.Green())) / double(size), gf = 0,
-		bstep = double((col2.Blue() -  col1.Blue())) / double(size), bf = 0;
-
-	wxColour currCol;
-	for(int y = rect.y; y < rect.y + size; y++)
+	wxWindow *pWindow = ((wxFlatNotebook *)m_pParent)->GetPage(tabIdx);
+	if( pWindow )
 	{
-		currCol.Set(
-			(unsigned char)(col1.Red() + rf),
-			(unsigned char)(col1.Green() + gf),
-			(unsigned char)(col1.Blue() + bf)
-			);
-		dc.SetBrush( wxBrush( currCol, wxSOLID ) );
-		dc.SetPen(wxPen(currCol));
-		dc.DrawLine(rect.x, y, rect.x + rect.width, y);
-		rf += rstep; gf += gstep; bf += bstep;
+		wxToolTip *pToolTip = pWindow->GetToolTip();
+		if(pToolTip && pToolTip->GetWindow() == pWindow)
+			SetToolTip(pToolTip->GetTip());
 	}
 }

-void wxPageContainerBase::SetPageImageIndex(size_t page, int imgindex)
+void wxPageContainer::SetPageImageIndex(size_t page, int imgindex)
 {
-	if(page < m_pagesInfoVec.size())
+	if(page < m_pagesInfoVec.GetCount())
 	{
 		m_pagesInfoVec[page].SetImageIndex(imgindex);
 		Refresh();
 	}
 }

-int wxPageContainerBase::GetPageImageIndex(size_t page)
+int wxPageContainer::GetPageImageIndex(size_t page)
 {
-	if(page < m_pagesInfoVec.size())
+	if(page < m_pagesInfoVec.GetCount())
 	{
 		return m_pagesInfoVec[page].GetImageIndex();
 	}
 	return -1;
 }

-wxDragResult wxPageContainerBase::OnDropTarget(wxCoord x, wxCoord y, int nTabPage, wxWindow * wnd_oldContainer)
+wxDragResult wxPageContainer::OnDropTarget(wxCoord x, wxCoord y, int nTabPage, wxWindow * wnd_oldContainer)
 {
 	// Disable drag'n'drop for disabled tab
-	if(!((wxPageContainerBase *)wnd_oldContainer)->m_pagesInfoVec[nTabPage].GetEnabled())
+	if(!((wxPageContainer *)wnd_oldContainer)->m_pagesInfoVec[nTabPage].GetEnabled())
 		return wxDragCancel;

 	wxLogTrace(wxTraceMask(), _("Old Page Index = %i"), nTabPage);
-	wxPageContainerBase * oldContainer = (wxPageContainerBase *)wnd_oldContainer;
+	wxPageContainer * oldContainer = (wxPageContainer *)wnd_oldContainer;
 	int nIndex = -1;
 	wxPageInfo pgInfo;
 	int where = HitTest(wxPoint(x, y), pgInfo, nIndex);
 	wxLogTrace(wxTraceMask(), _("OnDropTarget: index by HitTest = %i"), nIndex);
-	wxFlatNotebookBase * oldNotebook = (wxFlatNotebookBase *)oldContainer->GetParent();
-	wxFlatNotebookBase * newNotebook = (wxFlatNotebookBase *)GetParent();
+	wxFlatNotebook * oldNotebook = (wxFlatNotebook *)oldContainer->GetParent();
+	wxFlatNotebook * newNotebook = (wxFlatNotebook *)GetParent();

 	if(oldNotebook == newNotebook)
 	{
@@ -2409,14 +1487,16 @@
 				MoveTabPage(nTabPage, nIndex);
 				break;
 			case wxFNB_NOWHERE:
-				MoveTabPage(nTabPage, GetLastVisibleTab()+1);
+				{
+
+				}
 				break;
 			default:
 				break;
 			}
 		}
 	}
-	else if (GetParent()->GetWindowStyleFlag() & wxFNB_ALLOW_FOREIGN_DND)
+	else
 	{
 #if defined(__WXMSW__) || defined(__WXGTK__)
 		if(nTabPage >= 0)
@@ -2437,28 +1517,31 @@
 	return wxDragMove;
 }

-void wxPageContainerBase::MoveTabPage(int nMove, int nMoveTo)
+void wxPageContainer::MoveTabPage(int nMove, int nMoveTo)
 {
 	if(nMove == nMoveTo)
 		return;
-	else if(nMoveTo < nMove)
+
+	else if(nMoveTo < (int)((wxFlatNotebook *)m_pParent)->m_windows.GetCount())
 		nMoveTo++;

+	m_pParent->Freeze();
 	// Remove the window from the main sizer
-	int nCurSel = ((wxFlatNotebookBase *)m_pParent)->m_pages->GetSelection();
-	((wxFlatNotebookBase *)m_pParent)->m_mainSizer->Detach(((wxFlatNotebookBase *)m_pParent)->m_windows[nCurSel]);
-	((wxFlatNotebookBase *)m_pParent)->m_windows[nCurSel]->Hide();
+	int nCurSel = ((wxFlatNotebook *)m_pParent)->m_pages->GetSelection();
+	((wxFlatNotebook *)m_pParent)->m_mainSizer->Detach(((wxFlatNotebook *)m_pParent)->m_windows[nCurSel]);
+	((wxFlatNotebook *)m_pParent)->m_windows[nCurSel]->Hide();

-	wxWindow *pWindow = ((wxFlatNotebookBase *)m_pParent)->m_windows[nMove];
-	((wxFlatNotebookBase *)m_pParent)->m_windows.erase(((wxFlatNotebookBase *)m_pParent)->m_windows.begin() + nMove);
-	((wxFlatNotebookBase *)m_pParent)->m_windows.insert(((wxFlatNotebookBase *)m_pParent)->m_windows.begin() + nMoveTo - 1, pWindow);
+	wxWindow *pWindow = ((wxFlatNotebook *)m_pParent)->m_windows[nMove];
+	((wxFlatNotebook *)m_pParent)->m_windows.RemoveAt(nMove);
+	((wxFlatNotebook *)m_pParent)->m_windows.Insert(pWindow, nMoveTo-1);

 	wxPageInfo pgInfo = m_pagesInfoVec[nMove];
-	m_pagesInfoVec.erase(m_pagesInfoVec.begin() + nMove);
-	m_pagesInfoVec.insert(m_pagesInfoVec.begin() + nMoveTo - 1, pgInfo);

+	m_pagesInfoVec.RemoveAt( nMove );
+	m_pagesInfoVec.Insert(pgInfo, nMoveTo - 1);
+
 	// Add the page according to the style
-	wxBoxSizer* pSizer = ((wxFlatNotebookBase *)m_pParent)->m_mainSizer;
+	wxBoxSizer* pSizer = ((wxFlatNotebook *)m_pParent)->m_mainSizer;
 	long style = GetParent()->GetWindowStyleFlag();


@@ -2475,11 +1558,13 @@

 	pSizer->Layout();
 	m_iActivePage = nMoveTo-1;
+	m_iPreviousActivePage = -1;
 	DoSetSelection(m_iActivePage);
 	Refresh();
+	m_pParent->Thaw();
 }

-bool wxPageContainerBase::CanFitToScreen(size_t page)
+bool wxPageContainer::CanFitToScreen(size_t page)
 {
 	// Incase the from is greater than page,
 	// we need to reset the m_nFrom, so in order
@@ -2487,69 +1572,52 @@
 	if(m_nFrom > (int)page)
 		return false;

-	// Calculate the tab width including borders and image if any
-	wxClientDC dc(this);
-
-	int width, pom, shapePoints, height, tabHeight;
 	long style = GetParent()->GetWindowStyleFlag();
+	wxFNBRendererPtr render = wxFNBRendererMgrST::Get()->GetRenderer(style);

-	wxString stam = wxT("Tp");	// Temp data to get the text height;
-	dc.GetTextExtent(stam, &width, &height);
-	dc.GetTextExtent(GetPageText(page), &width, &pom);
+	if( !HasFlag( wxFNB_VC8 ) )
+	{

-	tabHeight = height + 8; // We use 6 pixels as padding
+		wxRect rect = GetClientRect();
+		int clientWidth = rect.width;
+		int tabHeight = render->CalcTabHeight( this );
+		int tabWidth = render->CalcTabWidth( this, static_cast<int>(page), tabHeight );

-	if(style & wxFNB_VC71)
-		tabHeight = (style & wxFNB_BOTTOM) ? tabHeight - 4 :  tabHeight;
-	else if(style & wxFNB_FANCY_TABS)
-		tabHeight = (style & wxFNB_BOTTOM) ? tabHeight - 2 :  tabHeight;
+		int posx = ((wxFlatNotebook *)m_pParent)->m_nPadding;
+		if(m_nFrom >= 0)
+		{
+			for(int i=m_nFrom; i<(int)m_pagesInfoVec.GetCount(); i++)
+			{
+				if(m_pagesInfoVec[i].GetPosition() == wxPoint(-1, -1))
+					break;
+				posx += m_pagesInfoVec[i].GetSize().x;
+			}
+		}

-	int tabWidth = ((wxFlatNotebookBase *)m_pParent)->m_nPadding * 2 + width;
-	if(!(style & wxFNB_VC71))
-		shapePoints = (int)(tabHeight*tan((double)m_pagesInfoVec[page].GetTabAngle()/180.0*M_PI));
-	else
-		shapePoints = 0;
+		if(posx + tabWidth + render->GetButtonsAreaLength( this ) >= clientWidth)
+			return false;

-	if(!(style & wxFNB_VC71))
-		// Default style
-		tabWidth += 2 * shapePoints;
-
-	bool hasImage = (m_ImageList != NULL);
-	if(hasImage) hasImage &= m_pagesInfoVec[page].GetImageIndex() != -1;
-
-	// For VC71 style, we only add the icon size (16 pixels)
-	if(hasImage && ( (style & wxFNB_VC71) || (style & wxFNB_FANCY_TABS)) )
-		tabWidth += 16;
+		return true;
+	}
 	else
-		// Default style
-		tabWidth += 16 + shapePoints / 2;
-
-	// Check if we can draw more
-	int posx = ((wxFlatNotebookBase *)m_pParent)->m_nPadding;
-
-	if(m_nFrom >= 0)
 	{
-		for(int i=m_nFrom; i<(int)m_pagesInfoVec.size(); i++)
-		{
-			if(m_pagesInfoVec[i].GetPosition() == wxPoint(-1, -1))
-				break;
-			posx += m_pagesInfoVec[i].GetSize().x;
-		}
-	}
+		// TODO:: this is ugly and should be improved, we should *never* access the
+		// raw pointer directly like we do here (render.Get())
+		wxFNBRendererVC8 *vc8_render = 	static_cast<wxFNBRendererVC8*>( render.Get() );
+		std::vector<wxRect> vTabInfo;
+		vc8_render->NumberTabsCanFit( this, vTabInfo );

-	wxRect rect = GetClientRect();
-	int clientWidth = rect.width;
-
-	if(posx + tabWidth + GetButtonsAreaLength() >= clientWidth)
-		return false;
-	return true;
+		if(static_cast<int>(page) - m_nFrom >= static_cast<int>( vTabInfo.size() ))
+			return false;
+		return true;
+	}
 }

-int wxPageContainerBase::GetNumOfVisibleTabs()
+int wxPageContainer::GetNumOfVisibleTabs()
 {
 	int i=m_nFrom;
 	int counter = 0;
-	for(; i<(int)m_pagesInfoVec.size(); i++, ++counter)
+	for(; i<(int)m_pagesInfoVec.GetCount(); i++, ++counter)
 	{
 		if(m_pagesInfoVec[i].GetPosition() == wxPoint(-1, -1))
 			break;
@@ -2557,84 +1625,97 @@
 	return counter;
 }

-bool wxPageContainerBase::GetEnabled(size_t page)
+bool wxPageContainer::GetEnabled(size_t page)
 {
-	if(page >= m_pagesInfoVec.size())
+	if(page >= m_pagesInfoVec.GetCount())
 		return true;	// Seems strange, but this is the default
 	return m_pagesInfoVec[page].GetEnabled();
 }

-void wxPageContainerBase::Enable(size_t page, bool enabled)
+void wxPageContainer::Enable(size_t page, bool enabled)
 {
-	if(page >= m_pagesInfoVec.size())
+	if(page >= m_pagesInfoVec.GetCount())
 		return ;
-	return m_pagesInfoVec[page].Enable(enabled);
+    m_pagesInfoVec[page].Enable(enabled);
+    return;
 }

-int wxPageContainerBase::GetLeftButtonPos()
+wxColor wxPageContainer::GetSingleLineBorderColor()
 {
-	long style = GetParent()->GetWindowStyleFlag();
-	wxRect rect = GetClientRect();
-	int clientWidth = rect.width;
-	if(style & wxFNB_NO_X_BUTTON)
-		return clientWidth - 38;
-	else
-		return clientWidth - 54;
+	if(HasFlag(wxFNB_FANCY_TABS))
+		return m_colorFrom;
+	return *wxWHITE;
 }

-int wxPageContainerBase::GetRightButtonPos()
+bool wxPageContainer::HasFlag(int flag)
 {
 	long style = GetParent()->GetWindowStyleFlag();
-	wxRect rect = GetClientRect();
-	int clientWidth = rect.width;
-	if(style & wxFNB_NO_X_BUTTON)
-		return clientWidth - 22;
-	else
-		return clientWidth - 38;
+	bool res = style & flag ? true : false;
+	return res;
 }

-int wxPageContainerBase::GetXPos()
+void wxPageContainer::ClearFlag(int flag)
 {
 	long style = GetParent()->GetWindowStyleFlag();
-	wxRect rect = GetClientRect();
-	int clientWidth = rect.width;
-	if(style & wxFNB_NO_X_BUTTON)
-		return clientWidth;
-	else
-		return clientWidth - 22;
+	style &= ~( flag );
+	wxWindowBase::SetWindowStyleFlag(style);
 }

-int wxPageContainerBase::GetButtonsAreaLength()
+bool wxPageContainer::TabHasImage(int tabIdx)
 {
-	long style = GetParent()->GetWindowStyleFlag();
-	if(style & wxFNB_NO_NAV_BUTTONS && style & wxFNB_NO_X_BUTTON)
-		return 0;
-	else if((style & wxFNB_NO_NAV_BUTTONS) && !(style & wxFNB_NO_X_BUTTON))
-		return 53 - 16;
-	else if(!(style & wxFNB_NO_NAV_BUTTONS) && (style & wxFNB_NO_X_BUTTON))
-		return 53 - 16;
+	if(m_ImageList)
+		return m_pagesInfoVec[tabIdx].GetImageIndex() != -1;
+	return false;
+}
+
+void wxPageContainer::OnLeftDClick(wxMouseEvent& event)
+{
+	if(HasFlag(wxFNB_DCLICK_CLOSES_TABS))
+	{
+		wxPageInfo pgInfo;
+		int tabIdx;
+		int where = HitTest(event.GetPosition(), pgInfo, tabIdx);
+		switch(where)
+		{
+		case wxFNB_TAB:
+			{
+				DeletePage((size_t)tabIdx);
+				break;
+			}
+		default:
+			break;
+		}
+	}
 	else
-		// All buttons
-		return 53;
+	{
+		event.Skip();
+	}
 }

-void wxPageContainerBase::DrawTabsLine(wxDC& dc, const wxRect& rect)
+void wxPageContainer::PopupTabsMenu()
 {
-	wxRect clientRect = rect;
-	long style = GetParent()->GetWindowStyleFlag();
+	wxMenu popupMenu;

-	dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)));
-	dc.SetBrush(*wxTRANSPARENT_BRUSH);
-	dc.DrawRectangle(clientRect);
-
-	if(!(style & wxFNB_TABS_BORDER_SIMPLE))
+	for(size_t i=0; i<m_pagesInfoVec.GetCount(); i++)
 	{
-		dc.SetPen(wxPen(m_tabAreaColor));
-		dc.DrawLine(0, 0, 0, clientRect.height);
-		if(style & wxFNB_BOTTOM)
-			dc.DrawLine(0, clientRect.height - 1, clientRect.width, clientRect.height - 1);
-		else
-			dc.DrawLine(0, 0, clientRect.width, 0);
-		dc.DrawLine(clientRect.width - 1, 0, clientRect.width - 1, clientRect.height);
+		wxPageInfo pi = m_pagesInfoVec[i];
+		wxMenuItem *item = new wxMenuItem(&popupMenu, static_cast<int>(i), pi.GetCaption(), pi.GetCaption(), wxITEM_NORMAL);
+
+		// This code is commented, since there is an alignment problem with wx2.6.3 & Menus
+//		if( TabHasImage(static_cast<int>(i)) )
+//			item->SetBitmaps( (*m_ImageList)[pi.GetImageIndex()] );
+
+		popupMenu.Append( item );
 	}
+
+	// connect an event handler to our menu
+	popupMenu.Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxPageContainer::OnTabMenuSelection), NULL, this);
+	PopupMenu( &popupMenu );
 }
+
+void wxPageContainer::OnTabMenuSelection(wxCommandEvent &event)
+{
+	int selection = event.GetId();
+	static_cast<wxFlatNotebook*>(m_pParent)->SetSelection( (size_t)selection );
+}
+
Index: src/sdk/wxFlatNotebook/wxFlatNotebook.h
===================================================================
--- src/sdk/wxFlatNotebook/wxFlatNotebook.h	(revision 3049)
+++ src/sdk/wxFlatNotebook/wxFlatNotebook.h	(working copy)
@@ -13,94 +13,94 @@
 #define WXFLATNOTEBOOK_H

 #include <wx/wx.h>
+#include <wx/frame.h>
+#include <wx/dynarray.h>

-#ifdef __VISUALC__
-#pragma warning( push )
-#pragma warning(disable: 4702)
+#ifdef __WXMSW__
+#ifdef _DEBUG
+//#include <crtdbg.h>
+#define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__)
+#else
+#define DEBUG_NEW new
 #endif
+#endif // __WXMSW__

-#include <vector>
+#ifdef WXMAKINGDLL_FNB
+#    define WXDLLIMPEXP_FNB WXEXPORT
+#elif defined(WXUSINGDLL_FNB)
+#    define WXDLLIMPEXP_FNB WXIMPORT
+#else /* not making nor using FNB as DLL */
+#    define WXDLLIMPEXP_FNB
+#endif // WXMAKINGDLL_FNB

-#ifdef __VISUALC__
-#pragma warning(pop)
-#endif
-
 #include <wx/dcbuffer.h>
 #include <wx/dataobj.h>
 #include <wx/dnd.h>

 #include "wxFNBDropTarget.h"

-class wxPageContainerBase;
+class wxPageContainer;

 #ifndef M_PI
 #define M_PI 3.14159265358979
 #endif

+#ifndef wxFNB_HEIGHT_SPACER
+#define wxFNB_HEIGHT_SPACER 10
+#endif

-typedef std::vector<wxBitmap> wxFlatNotebookImageList;
+// forward declerations
+class wxFNBRenderer;
+class wxFNBRendererDefault;
+class wxFNBRendererVC71;
+class wxFNBRendererVC8;
+class wxTabNavigatorWindow;
+class wxMenu;

+// Since some compiler complains about std::min, we define our own macro
+#define FNB_MIN(a, b) ((a > b) ? b : a)

-///  wxFlatNotebookBase styles
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxBitmap, wxFlatNotebookImageList, WXDLLIMPEXP_FNB);
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxWindow*, wxWindowPtrArray, WXDLLIMPEXP_FNB);
+
+///  wxFlatNotebook styles
 #define wxFNB_DEFAULT_STYLE				wxFNB_MOUSE_MIDDLE_CLOSES_TABS
+#define wxFNB_VC71						0x00000001
+#define wxFNB_FANCY_TABS				0x00000002
+#define wxFNB_TABS_BORDER_SIMPLE		0x00000004
+#define wxFNB_NO_X_BUTTON				0x00000008
+#define wxFNB_NO_NAV_BUTTONS			0x00000010
+#define wxFNB_MOUSE_MIDDLE_CLOSES_TABS	0x00000020
+#define wxFNB_BOTTOM					0x00000040
+#define wxFNB_NODRAG					0x00000080
+#define wxFNB_VC8						0x00000100
+#define wxFNB_X_ON_TAB					0x00000200
+#define wxFNB_BACKGROUND_GRADIENT		0x00000400
+#define wxFNB_COLORFUL_TABS				0x00000800
+#define wxFNB_DCLICK_CLOSES_TABS		0x00001000
+#define wxFNB_SMART_TABS				0x00002000
+#define wxFNB_DROPDOWN_TABS_LIST		0x00004000

-/// Use Visual Studio 2003 (VC7.1) Style for tabs
-#define wxFNB_VC71						1
-
-/// Use fancy style - square tabs filled with gradient coloring
-#define wxFNB_FANCY_TABS				2
-
-/// Draw thin border around the page
-#define wxFNB_TABS_BORDER_SIMPLE		4
-
-/// Do not display the 'X' button
-#define wxFNB_NO_X_BUTTON				8
-
-/// Do not display the Right / Left arrows
-#define wxFNB_NO_NAV_BUTTONS			16
-
-/// Use the mouse middle button for cloing tabs
-#define wxFNB_MOUSE_MIDDLE_CLOSES_TABS	32
-
-/// Place tabs at bottom - the default is to place them
-/// at top
-#define wxFNB_BOTTOM					64
-
-/// Disable dragging of tabs
-#define wxFNB_NODRAG					128
-
-/// Disable dragging of tabs - Only available on the commercial version
-#define wxFNB_VC8						256
-
-/// Place 'X' on a tab
-/// Note: This style is not supported on VC8 style
-#define wxFNB_X_ON_TAB					512
-
-#define wxFNB_ALLOW_FOREIGN_DND			128
-
-#define VERTICAL_BORDER_PADDING  4
-
-// Button size is a 16x16 xpm bitmap
-#define BUTTON_SPACE			16
-
-#define VC8_SHAPE_LEN			16
-
+/// General macros
+#define VERTICAL_BORDER_PADDING			4
+#define BUTTON_SPACE					16
+#define VC8_SHAPE_LEN					16
 #define MASK_COLOR wxColor(0, 128, 128)

-class wxMenu;
 /**
-* \brief Nice cross-platform flat notebook with X-button :)
+* \brief Nice cross-platform flat notebook with X-button, navigation arrows and much more
 */

-class wxFlatNotebookBase : public wxPanel
+class WXDLLIMPEXP_FNB wxFlatNotebook : public wxPanel
 {
 private:
-	friend class wxPageContainerBase;
+	friend class wxPageContainer;

 public:

 	///Default constructor
-	wxFlatNotebookBase(){}
+	wxFlatNotebook() : m_popupWin(NULL) {}
+
 	/// Parametrized constructor
 	/**
 	\param parent - parent window
@@ -110,15 +110,11 @@
 	\param style - window style
 	\param name - window class name
 	*/
-	wxFlatNotebookBase(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxT("Flat Notebook"));
+	wxFlatNotebook(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxT("Flat Notebook"));

 	/// Destructor
-	~wxFlatNotebookBase(void);
+	virtual ~wxFlatNotebook(void);

-	/// Derived class should override this function to provide the
-	/// appropriate PageManager
-	virtual wxPageContainerBase* CreatePageContainer();
-
 	/// Advances the selection
 	/**
 	\param bForward - if set to true then selection should be advanced forward otherwise - backward
@@ -150,7 +146,7 @@
 	/**
 	\param page - index of page to be deleted
 	*/
-	void DeletePage(size_t page, bool notify = true);
+	void DeletePage(size_t page);

 	/// Deletes all notebook pages and destroys all windows associated with pages
 	bool DeleteAllPages();
@@ -166,14 +162,21 @@
 	\param page - page index
 	*/
 	wxWindow * GetPage(size_t page) const;
-        /// Returns the page index of the window object.
+	/// Returns the page index of the window object.
 	/**
-        \param win - window object
-        */
-        int GetPageIndex(wxWindow* win) const;
+	\param win - window object
+	*/
+	int GetPageIndex(wxWindow* win) const;

 	/// Returns the currently visible/selected notebook page 0 based index.
 	int GetSelection() const;
+
+	/**
+	* Return the previous selection, useful when implementing smart tabulation
+	* \return previous selection, or wxNOT_FOUND
+	*/
+	int GetPreviousSelection() const;
+
 	/// Returns tab header inclination angle of specified page
 	/**
 	\param page_index - page index
@@ -206,11 +209,11 @@
 	/**
 	\param page - page index to be removed
 	*/
-	bool RemovePage(size_t page, bool notify = true);
+	bool RemovePage(size_t page);

 	/// Sets the amount of space around each page's icon and label, in pixels.
 	/**
-	NB: The vertical padding cannot be changed in for wxFlatNotebookBase.
+	NB: The vertical padding cannot be changed in for wxFlatNotebook.
 	\param padding - new amount of space around each page's icon and label
 	*/
 	void SetPadding(const wxSize& padding);
@@ -267,11 +270,11 @@
 	/// Sets an image list associated with notebook pages
 	/**
 	\param imglist - image list object.
-	Image list assigned with this method will not be deleted by wxFlatNotebookBase's destructor, you must delete it yourself.
+	Image list assigned with this method will not be deleted by wxFlatNotebook's destructor, you must delete it yourself.
 	*/
 	void SetImageList(wxFlatNotebookImageList * imglist);

-	/// Returns an image list object associated with wxFlatNotebookBase
+	/// Returns an image list object associated with wxFlatNotebook
 	wxFlatNotebookImageList * GetImageList();

 	/**
@@ -279,7 +282,7 @@
 	* \param x X coordinate where the drop take place
 	* \param y Y coordinate where the drop take place
 	* \param nTabPage page index
-	* \param wnd_oldContainer pointer to wxPageContainerBase object that contained dragged page
+	* \param wnd_oldContainer pointer to wxPageContainer object that contained dragged page
 	* \return Drag operation identifier
 	*/
 	wxDragResult OnDropTarget(wxCoord x, wxCoord y, int nTabPage, wxWindow * wnd_oldContainer);
@@ -336,11 +339,16 @@
 	/// Set the active tab color
 	void SetActiveTabColour(const wxColour& color);

+	/**
+	* Return the padding used between the text and icons, text and borders, etc.
+	* \return padding in pixels
+	*/
 	int GetPadding() { return m_nPadding; }
+
 protected:
 	/// Initialization function, called internally
 	virtual void Init();
-	wxPageContainerBase *m_pages;
+	wxPageContainer *m_pages;

 private:
 	/// Internal flag to force selection of page,
@@ -352,12 +360,13 @@
 	wxBoxSizer* m_mainSizer;

 	/// vector of all the windows associated with the notebook pages.
-	std::vector<wxWindow*> m_windows;
-	wxFNBDropTarget<wxFlatNotebookBase> *m_pDropTarget;
+	wxWindowPtrArray m_windows;
+	wxFNBDropTarget<wxFlatNotebook> *m_pDropTarget;
 	int m_nFrom;
 	int m_nPadding;
+	wxTabNavigatorWindow *m_popupWin;

-	DECLARE_DYNAMIC_CLASS(wxFlatNotebookBase)
+	DECLARE_DYNAMIC_CLASS(wxFlatNotebook)
 	DECLARE_EVENT_TABLE()
 	void OnNavigationKey(wxNavigationKeyEvent& event);
 };
@@ -365,7 +374,7 @@
 /**
 * \brief Contains parameters of notebook page
 */
-class wxPageInfo
+class WXDLLIMPEXP_FNB wxPageInfo
 {
 private:
 	// Members
@@ -393,6 +402,9 @@
 	/// Tab 'x' button rectangle
 	wxRect m_xRect;

+	/// Tab color
+	wxColor m_color;
+
 public:

 	/// Default constructor
@@ -438,7 +450,7 @@
 	/**
 	\param value - new tab header inclination angle
 	*/
-	void SetTabAngle(unsigned int value) {m_TabAngle = std::min((unsigned int)(45), (unsigned int)(value));}
+	void SetTabAngle(unsigned int value) {m_TabAngle = FNB_MIN((unsigned int)(45), (unsigned int)(value));}

 	/// Returns an inclination of tab header borders
 	unsigned int GetTabAngle() {return m_TabAngle;}
@@ -478,8 +490,22 @@

 	/// Get the 'x' button rectangle
 	wxRect& GetXRect() { return m_xRect; }
+
+	/**
+	*
+	* \return The tab color
+	*/
+	wxColor GetColor() { return m_color; }
+
+	/**
+	*
+	* \param color Tab face color
+	*/
+	void SetColor(wxColor& color) { m_color = color; }
 };

+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxPageInfo, wxPageInfoArray, WXDLLIMPEXP_FNB);
+
 /// Button status
 enum
 {
@@ -491,22 +517,28 @@
 /// Hit Test results
 enum
 {
-	wxFNB_TAB,			/// On a tab
-	wxFNB_X,			/// On the X button
-	wxFNB_TAB_X,		/// On the 'X' button (tab's X button)
-	wxFNB_LEFT_ARROW,	/// On the rotate left arrow button
-	wxFNB_RIGHT_ARROW,	/// On the rotate right arrow button
-	wxFNB_NOWHERE		/// Anywhere else
+	wxFNB_TAB,				///< On a tab
+	wxFNB_X,				///< On the X button
+	wxFNB_TAB_X,			///< On the 'X' button (tab's X button)
+	wxFNB_LEFT_ARROW,		///< On the rotate left arrow button
+	wxFNB_RIGHT_ARROW,		///< On the rotate right arrow button
+	wxFNB_DROP_DOWN_ARROW,	///< On the drop down arrow button
+	wxFNB_NOWHERE			///< Anywhere else
 };

 /**
 * \brief Notebook page
 */
-class wxPageContainerBase : public wxPanel
+class WXDLLIMPEXP_FNB wxPageContainer : public wxPanel
 {
 protected:

-	friend class wxFlatNotebookBase;
+	friend class wxFlatNotebook;
+	friend class wxFNBRenderer;
+	friend class wxFNBRendererDefault;
+	friend class wxFNBRendererVC71;
+	friend class wxFNBRendererVC8;
+
 	wxFlatNotebookImageList * m_ImageList;

 public:
@@ -518,18 +550,18 @@
 	\param size - window size
 	\param style - window style
 	*/
-	wxPageContainerBase(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
+	wxPageContainer(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
 	/// Destructor
-	virtual ~wxPageContainerBase(void);
+	virtual ~wxPageContainer(void);

 	/// Sets an image list associated with notebook pages
 	/**
 	\param imglist - image list object.
-	Image list assigned with this method will not be deleted by wxFlatNotebookBase's destructor, you must delete it yourself.
+	Image list assigned with this method will not be deleted by wxFlatNotebook's destructor, you must delete it yourself.
 	*/
 	virtual void SetImageList(wxFlatNotebookImageList * imglist) {m_ImageList = imglist;}

-	/// Returns an image list object associated with wxFlatNotebookBase
+	/// Returns an image list object associated with wxFlatNotebook
 	virtual wxFlatNotebookImageList * GetImageList() {return m_ImageList;}

 	/// Apends new notebook page
@@ -606,6 +638,42 @@
 	*/
 	virtual bool GetEnabled(size_t page);

+	/// Style helper methods
+	bool HasFlag(int flag);
+
+	/**
+	* Return a vector containing the tabs informations (used by the redereres)
+	* \return tabs info vector
+	*/
+	wxPageInfoArray& GetPageInfoVector() { return m_pagesInfoVec; }
+
+	/**
+	* Return the first graident colour ("from")
+	* \return gradient colour 1
+	*/
+	const wxColour&  GetGradientColourFrom() const { return m_colorFrom; }
+
+	/**
+	* Return the second graident colour ("to")
+	* \return gradient colour 2
+	*/
+	const wxColour&  GetGradientColourTo() const { return m_colorTo; }
+	/**
+	* Return tab's border colour
+	* \return border colour
+	*/
+	const wxColour&  GetBorderColour() const { return m_colorBorder; }
+
+	/**
+	* Return non active tab's text colour
+	* \return non active tab's text colour
+	*/
+	const wxColour&  GetNonoActiveTextColor() const { return m_nonActiveTextColor; }
+
+	const wxColour&  GetActiveTabColour() const { return m_activeTabColor; }
+
+	int GetPreviousSelection() const { return m_iPreviousActivePage; }
+
 	DECLARE_EVENT_TABLE()
 	// Event handlers
 	virtual void OnPaint(wxPaintEvent& event);
@@ -618,21 +686,27 @@
 	virtual void OnEraseBackground(wxEraseEvent& WXUNUSED(event)) { }
 	virtual void OnMouseLeave(wxMouseEvent& event);
 	virtual void OnMouseEnterWindow(wxMouseEvent& event);
+	virtual void OnLeftDClick(wxMouseEvent &event);
+	virtual void OnTabMenuSelection(wxCommandEvent &event);

 protected:
+
+	/**
+	 * Popup a menu that contains all the tabs to be selected by user
+	 */
+	void PopupTabsMenu();
+
+	void ClearFlag(int flag);
+
+	/// return true if tabIdx has image
+	bool TabHasImage(int tabIdx);
+
 	/// Check whether the style is set to default
 	virtual bool IsDefaultTabs();

-	/// Some styles does not allow drawing X on the active tab
-	/// If you dont want to allow it, override this function
-	virtual bool CanDrawXOnTab() { return true; }
+	/// Return the color of the single line border
+	virtual wxColor GetSingleLineBorderColor();

-	/// Return the button area space
-	virtual int GetButtonAreaWidth(void);
-
-	/// File a tab with gradient color
-	virtual void FillGradientColor(wxBufferedDC& dc, const wxRect& rect);
-
 	/// Return true if page is visible
 	virtual bool IsTabVisible(size_t page);

@@ -643,7 +717,7 @@
 	virtual void ShowTabTooltip(int tabIdx);

 	/// A wrapper from calling the DoDeletePage()
-	virtual void DeletePage(size_t page, bool notify = true);
+	virtual void DeletePage(size_t page);

 	/// Remove all pages from the container (it also deletes them)
 	virtual void DeleteAllPages();
@@ -655,18 +729,6 @@
 	/// Preform the actual page selection
 	virtual void DoSetSelection(size_t page);

-	/// Draw right arrow button to the right area of the tabs
-	virtual void DrawRightArrow(wxDC &dc);
-
-	/// Draw left arrow button to the right area of the tabs
-	virtual void DrawLeftArrow (wxDC &dc);
-
-	/// Draw 'x' button to the right area of the tabs
-	virtual void DrawX         (wxDC &dc);
-
-	/// Draw 'x' button on a tab at position rect.x rect.y
-	virtual void DrawTabX(wxDC &dc, const wxRect &rect, const int& tabIdx);
-
 	/// Return the index of the last visible index
 	virtual int  GetLastVisibleTab();

@@ -682,7 +744,7 @@
 	* \param x X coordinate where the drop take place
 	* \param y Y coordinate where the drop take place
 	* \param nTabPage page index
-	* \param wnd_oldContainer pointer to wxPageContainerBase object that contained dragged page
+	* \param wnd_oldContainer pointer to wxPageContainer object that contained dragged page
 	* \return Drag operation identifier
 	*/
 	virtual wxDragResult OnDropTarget(wxCoord x, wxCoord y, int nTabPage, wxWindow * wnd_oldContainer);
@@ -701,28 +763,14 @@
 	*/
 	virtual bool CanFitToScreen(size_t page);

-	/// Draw a bottom line for the tabs area
-	virtual void DrawTabsLine(wxDC& dc, const wxRect& rect);
-
-	// Functions
-	void DrawVC71Tab(wxBufferedPaintDC& dc, const int& posx, const int &tabIdx, const bool& hasImage, const int &tabWidth, const int &tabHeight);
-	void DrawFancyTab(wxBufferedPaintDC& dc, const int& posx, const int &tabIdx, const bool& hasImage, const int &tabWidth, const int &tabHeight);
-	void DrawStandardTab(wxBufferedPaintDC& dc, const int& posx, const int &tabIdx, const bool& hasImage, const int &tabWidth, const int &tabHeight);
-
-	// Navigation buttons position
-	int GetLeftButtonPos();
-	int GetRightButtonPos();
-	int GetXPos();
-	int GetButtonsAreaLength();
-
 protected:

-	std::vector<wxPageInfo> m_pagesInfoVec;
+	wxPageInfoArray m_pagesInfoVec;
 	int m_iActivePage;
 	int m_nFrom;

 	/// Drop target for enabling drag'n'drop of tabs
-	wxFNBDropTarget<wxPageContainerBase> *m_pDropTarget;
+	wxFNBDropTarget<wxPageContainer> *m_pDropTarget;

 	/// Pointer to the parent window
 	wxWindow *m_pParent;
@@ -740,13 +788,16 @@
 	int m_nXButtonStatus, m_nLeftButtonStatus, m_nRightButtonStatus, m_nTabXButtonStatus;

 	/// holds the button id in case a left click is done on one of them
-    int m_nLeftClickZone;
+	int m_nLeftClickZone;
+
+	int m_iPreviousActivePage;
+	int m_nArrowDownButtonStatus;
 };

 /**
-* \brief Holds information about events associated with wxFlatNotebookBase objects
+* \brief Holds information about events associated with wxFlatNotebook objects
 */
-class wxFlatNotebookEvent : public wxNotifyEvent
+class WXDLLIMPEXP_FNB wxFlatNotebookEvent : public wxNotifyEvent
 {
 	DECLARE_DYNAMIC_CLASS(wxFlatNotebookEvent)
 	size_t sel, oldsel;
@@ -778,45 +829,12 @@
 	int  GetOldSelection() { return (int)oldsel; }
 };

-//////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Default implementation of the wxFlatNotebook
-//
-//////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class wxFlatNotebook : public wxFlatNotebookBase
-{
-public:
-	/**
-	 *
-	 * \param parent parent window
-	 * \param id window ID
-	 * \param pos window position
-	 * \param size window size
-	 * \param style window style
-	 * \param name window class name
-	 * \return
-	 */
-	wxFlatNotebook(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxT("FlatNotebook")) :
-	  wxFlatNotebookBase(parent, id, pos, size, style, name)
-	  {
-		  m_pages = CreatePageContainer();
-		  Init();
-	  }
-
-	/// Destructor
-	 ~wxFlatNotebook(void)
-	  {}
-};
-
-#define wxFN_IMPEXP
-
 BEGIN_DECLARE_EVENT_TYPES()
-    DECLARE_EXPORTED_EVENT_TYPE(wxFN_IMPEXP, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGED, 50000)
-    DECLARE_EXPORTED_EVENT_TYPE(wxFN_IMPEXP, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGING, 50001)
-    DECLARE_EXPORTED_EVENT_TYPE(wxFN_IMPEXP, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, 50002)
-    DECLARE_EXPORTED_EVENT_TYPE(wxFN_IMPEXP, wxEVT_COMMAND_FLATNOTEBOOK_CONTEXT_MENU, 50003)
-	DECLARE_EXPORTED_EVENT_TYPE(wxFN_IMPEXP, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSED, 50004)
+DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_FNB, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGED, 50000)
+DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_FNB, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGING, 50001)
+DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_FNB, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, 50002)
+DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_FNB, wxEVT_COMMAND_FLATNOTEBOOK_CONTEXT_MENU, 50003)
+DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_FNB, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSED, 50004)
 END_DECLARE_EVENT_TYPES()

 typedef void (wxEvtHandler::*wxFlatNotebookEventFunction)(wxFlatNotebookEvent&);
@@ -834,7 +852,7 @@
 	wx__DECLARE_EVT1(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, winid, wxFlatNotebookEventHandler(fn))

 #define EVT_FLATNOTEBOOK_CONTEXT_MENU(winid, fn) \
-        wx__DECLARE_EVT1(wxEVT_COMMAND_FLATNOTEBOOK_CONTEXT_MENU, winid, wxFlatNotebookEventHandler(fn))
+	wx__DECLARE_EVT1(wxEVT_COMMAND_FLATNOTEBOOK_CONTEXT_MENU, winid, wxFlatNotebookEventHandler(fn))

 #define EVT_FLATNOTEBOOK_PAGE_CLOSED(winid, fn) \
 	wx__DECLARE_EVT1(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSED, winid, wxFlatNotebookEventHandler(fn))
@@ -852,37 +870,463 @@
 	////////////////////////////////////////////////////////////
 	// Images used by the control
 	////////////////////////////////////////////////////////////
-	extern const char *left_arrow_disabled_xpm[];
+	/* XPM */
+	static char *left_arrow_disabled_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #555555",
+			"# c #000000",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````.```````",
+			"```````..```````",
+			"``````.`.```````",
+			"`````.``.```````",
+			"````.```.```````",
+			"`````.``.```````",
+			"``````.`.```````",
+			"```````..```````",
+			"````````.```````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *x_button_pressed_xpm[];
+	/* XPM */
+	static char *x_button_pressed_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #4766e0",
+			"# c #9e9ede",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"`..............`",
+			"`.############.`",
+			"`.############.`",
+			"`.############.`",
+			"`.###aa####aa#.`",
+			"`.####aa##aa##.`",
+			"`.#####aaaa###.`",
+			"`.######aa####.`",
+			"`.#####aaaa###.`",
+			"`.####aa##aa##.`",
+			"`.###aa####aa#.`",
+			"`.############.`",
+			"`..............`",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *left_arrow_xpm[];

-	extern const char *x_button_hilite_xpm[];
+	/* XPM */
+	static char *left_arrow_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #555555",
+			"# c #000000",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````.```````",
+			"```````..```````",
+			"``````...```````",
+			"`````....```````",
+			"````.....```````",
+			"`````....```````",
+			"``````...```````",
+			"```````..```````",
+			"````````.```````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *x_button_xpm[];
+	/* XPM */
+	static char *x_button_hilite_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #4766e0",
+			"# c #c9dafb",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"`..............`",
+			"`.############.`",
+			"`.############.`",
+			"`.##aa####aa##.`",
+			"`.###aa##aa###.`",
+			"`.####aaaa####.`",
+			"`.#####aa#####.`",
+			"`.####aaaa####.`",
+			"`.###aa##aa###.`",
+			"`.##aa####aa##.`",
+			"`.############.`",
+			"`.############.`",
+			"`..............`",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *left_arrow_pressed_xpm[];
+	/* XPM */
+	static char *x_button_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #555555",
+			"# c #000000",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````..````..````",
+			"`````..``..`````",
+			"``````....``````",
+			"```````..```````",
+			"``````....``````",
+			"`````..``..`````",
+			"````..````..````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *left_arrow_hilite_xpm[];
+	/* XPM */
+	static char *left_arrow_pressed_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #4766e0",
+			"# c #9e9ede",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"`..............`",
+			"`.############.`",
+			"`.############.`",
+			"`.#######a####.`",
+			"`.######aa####.`",
+			"`.#####aaa####.`",
+			"`.####aaaa####.`",
+			"`.###aaaaa####.`",
+			"`.####aaaa####.`",
+			"`.#####aaa####.`",
+			"`.######aa####.`",
+			"`.#######a####.`",
+			"`..............`",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *right_arrow_disabled_xpm[];
+	/* XPM */
+	static char *left_arrow_hilite_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #4766e0",
+			"# c #c9dafb",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"`..............`",
+			"`.############.`",
+			"`.######a#####.`",
+			"`.#####aa#####.`",
+			"`.####aaa#####.`",
+			"`.###aaaa#####.`",
+			"`.##aaaaa#####.`",
+			"`.###aaaa#####.`",
+			"`.####aaa#####.`",
+			"`.#####aa#####.`",
+			"`.######a#####.`",
+			"`.############.`",
+			"`..............`",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *right_arrow_hilite_xpm[];
+	/* XPM */
+	static char *right_arrow_disabled_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #555555",
+			"# c #000000",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"```````.````````",
+			"```````..```````",
+			"```````.`.``````",
+			"```````.``.`````",
+			"```````.```.````",
+			"```````.``.`````",
+			"```````.`.``````",
+			"```````..```````",
+			"```````.````````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *right_arrow_pressed_xpm[];
+	/* XPM */
+	static char *right_arrow_hilite_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #4766e0",
+			"# c #c9dafb",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"`..............`",
+			"`.############.`",
+			"`.####a#######.`",
+			"`.####aa######.`",
+			"`.####aaa#####.`",
+			"`.####aaaa####.`",
+			"`.####aaaaa###.`",
+			"`.####aaaa####.`",
+			"`.####aaa#####.`",
+			"`.####aa######.`",
+			"`.####a#######.`",
+			"`.############.`",
+			"`..............`",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *right_arrow_xpm[];
+	/* XPM */
+	static char *right_arrow_pressed_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #4766e0",
+			"# c #9e9ede",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"`..............`",
+			"`.############.`",
+			"`.############.`",
+			"`.#####a######.`",
+			"`.#####aa#####.`",
+			"`.#####aaa####.`",
+			"`.#####aaaa###.`",
+			"`.#####aaaaa##.`",
+			"`.#####aaaa###.`",
+			"`.#####aaa####.`",
+			"`.#####aa#####.`",
+			"`.#####a######.`",
+			"`..............`",
+			"````````````````",
+			"````````````````"
+	};

-	extern const int tab_x_size;

-	extern const char *tab_x_button_pressed_xpm[];
+	/* XPM */
+	static char *right_arrow_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #555555",
+			"# c #000000",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"```````.````````",
+			"```````..```````",
+			"```````...``````",
+			"```````....`````",
+			"```````.....````",
+			"```````....`````",
+			"```````...``````",
+			"```````..```````",
+			"```````.````````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *tab_x_button_xpm[];
+	// Arrow down bitmaps
+	/* XPM */
+	static char *down_arrow_hilite_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #4766e0",
+			"# c #c9dafb",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"``.............`",
+			"``.###########.`",
+			"``.###########.`",
+			"``.###########.`",
+			"``.#aaaaaaaaa#.`",
+			"``.##aaaaaaa##.`",
+			"``.###aaaaa###.`",
+			"``.####aaa####.`",
+			"``.#####a#####.`",
+			"``.###########.`",
+			"``.###########.`",
+			"``.###########.`",
+			"``.............`",
+			"````````````````",
+			"````````````````"
+	};

-	extern const char *tab_x_button_hilite_xpm[];
-};
+	/* XPM */
+	static char *down_arrow_pressed_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #4766e0",
+			"# c #9e9ede",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"``.............`",
+			"``.###########.`",
+			"``.###########.`",
+			"``.###########.`",
+			"``.###########.`",
+			"``.###########.`",
+			"``.#aaaaaaaaa#.`",
+			"``.##aaaaaaa##.`",
+			"``.###aaaaa###.`",
+			"``.####aaa####.`",
+			"``.#####a#####.`",
+			"``.###########.`",
+			"``.............`",
+			"````````````````",
+			"````````````````"
+	};

+
+	/* XPM */
+	static char *down_arrow_xpm[] = {
+		/* width height num_colors chars_per_pixel */
+		"    16    16        8            1",
+			/* colors */
+			"` c #008080",
+			". c #000000",
+			"# c #000000",
+			"a c #000000",
+			"b c #000000",
+			"c c #000000",
+			"d c #000000",
+			"e c #000000",
+			/* pixels */
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````.........```",
+			"`````.......````",
+			"``````.....`````",
+			"```````...``````",
+			"````````.```````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````",
+			"````````````````"
+	};
+
+	// Arrow down bitmaps
+
+	const int tab_x_size = 9;
+}
+
 //////////////////////////////////////////////////////////////////////////////////////////////////
 //
 // End of XPM Images
Index: src/sdk/wxFlatNotebook/wxFNBDropTarget.h
===================================================================
--- src/sdk/wxFlatNotebook/wxFNBDropTarget.h	(revision 3049)
+++ src/sdk/wxFlatNotebook/wxFNBDropTarget.h	(working copy)
@@ -1,4 +1,4 @@
-#ifndef _WX_FNB_DROP_TARGET_H
+#ifndef _WX_FNB_DROP_TARGET_H
 #define _WX_FNB_DROP_TARGET_H

 #include <wx/wx.h>
@@ -18,16 +18,56 @@
 	\param pageindex - index of dragged page
 	*/
 	wxFNBDragInfo(wxWindow * container, int pageindex) : m_Container(container), m_PageIndex(pageindex){}
+
 	/**
+	 * \brief default constructor
+	 */
+	wxFNBDragInfo() : m_Container(0), m_PageIndex(0){}
+
+	/**
 	Returns wxPageContainer object which contains dragged page
 	*/
 	wxWindow * GetContainer() {return m_Container;}
+
 	/**
 	Returns the index of dragged page
 	*/
 	int GetPageIndex() {return m_PageIndex;}
 };

+class wxFNBDragInfoDataObject : public wxDataObjectSimple
+{
+public:
+    wxFNBDragInfoDataObject(const wxDataFormat& format):wxDataObjectSimple(format)
+    {}
+
+    wxFNBDragInfo DragInfo;
+
+    wxFNBDragInfo *GetData()
+    {
+        return &DragInfo;
+    }
+
+    // get the size of our data
+    virtual size_t GetDataSize() const
+    { return sizeof(wxFNBDragInfo); }
+
+    // copy our data to the buffer
+    virtual bool GetDataHere(void *buf) const
+    {
+        memcpy(buf, &DragInfo, sizeof(wxFNBDragInfo));
+        return true;
+    }
+
+    // copy data from buffer to our data
+    virtual bool SetData(size_t WXUNUSED(len), const void *buf)
+    {
+        // don't check the len. Under Win98 the value of 'len' == 0
+        memcpy(&DragInfo, buf, sizeof(wxFNBDragInfo));
+        return true;
+    }
+};
+
 /**
 \brief Used for processing drag-n-drop opeartions
 */
@@ -38,7 +78,7 @@
 	typedef wxDragResult (T::*pt2Func)(wxCoord, wxCoord, int, wxWindow *);
 	T* m_pParent;
 	pt2Func m_pt2CallbackFunc;
-	wxCustomDataObject * m_DataObject;
+	wxFNBDragInfoDataObject * m_DataObject;
 public:
 	/**
 	\brief Constructor
@@ -50,7 +90,7 @@
 		, m_pt2CallbackFunc(pt2CallbackFunc)
 		, m_DataObject(NULL)
 	{
-		m_DataObject = new wxCustomDataObject(wxDataFormat(wxT("wxFNB")));
+		m_DataObject = new wxFNBDragInfoDataObject(wxDataFormat(wxT("wxFNB")));
 		SetDataObject(m_DataObject);
 	}
 	/**
@@ -63,7 +103,7 @@
 	\param y - Y-coordinate
 	\param def - Result of drag-n-drop operation
 	*/
-    virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
+    virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult WXUNUSED(def))
 	{
 		GetData();
 		wxFNBDragInfo * draginfo = (wxFNBDragInfo *)m_DataObject->GetData();
Index: src/src/environmentsettingsdlg.cpp
===================================================================
--- src/src/environmentsettingsdlg.cpp	(revision 3049)
+++ src/src/environmentsettingsdlg.cpp	(working copy)
@@ -159,6 +159,7 @@

     // tab "Notebook"
     XRCCTRL(*this, "cmbEditorTabs", wxComboBox)->SetSelection(cfg->ReadInt(_T("/environment/tabs_style"), 0));
+    XRCCTRL(*this, "chkSmartTabs", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/tabs_smart"), 0));
     XRCCTRL(*this, "btnFNBorder", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/gradient_border"), wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW))));
     XRCCTRL(*this, "btnFNFrom", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/gradient_from"), wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE))));
     XRCCTRL(*this, "btnFNTo", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/gradient_to"), *wxWHITE));
@@ -386,6 +387,7 @@

         // tab "Appearence"
         cfg->Write(_T("/environment/tabs_style"),           (int)XRCCTRL(*this, "cmbEditorTabs", wxComboBox)->GetSelection());
+        cfg->Write(_T("/environment/tabs_smart"),           (bool)XRCCTRL(*this, "chkSmartTabs", wxCheckBox)->GetValue());
         cfg->Write(_T("/environment/gradient_border"),      XRCCTRL(*this, "btnFNBorder", wxButton)->GetBackgroundColour());
         cfg->Write(_T("/environment/gradient_from"),        XRCCTRL(*this, "btnFNFrom", wxButton)->GetBackgroundColour());
         cfg->Write(_T("/environment/gradient_to"),          XRCCTRL(*this, "btnFNTo", wxButton)->GetBackgroundColour());
Index: src/src/main.cpp
===================================================================
--- src/src/main.cpp	(revision 3049)
+++ src/src/main.cpp	(working copy)
@@ -1373,6 +1373,9 @@
     if (cfg->ReadBool(_T("/environment/") + prefix + _T("_tabs_bottom")))
         nbstyle |= wxFNB_BOTTOM;

+    if (cfg->ReadBool(_T("/environment/tabs_smart")))
+        nbstyle |= wxFNB_SMART_TABS;
+
     target->SetWindowStyleFlag(nbstyle);
     target->SetGradientColorBorder(cfg->ReadColour(_T("/environment/gradient_border"), wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW))));
     target->SetGradientColorFrom(cfg->ReadColour(_T("/environment/gradient_from"), wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE))));
Index: src/src/resources/env_settings.xrc
===================================================================
--- src/src/resources/env_settings.xrc	(revision 3049)
+++ src/src/resources/env_settings.xrc	(working copy)
@@ -1,692 +1,697 @@
-<?xml version="1.0" encoding="utf-8"?>
 <resource>
-  <object class="wxDialog" name="dlgEnvironmentSettings">
-    <title>Environment settings</title>
-    <centered>1</centered>
-    <object class="wxBoxSizer">
-      <orient>wxVERTICAL</orient>
-      <object class="sizeritem">
-        <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-        <object class="wxStaticText" name="lblBigTitle">
-          <label>General settings</label>
-          <style>wxALIGN_CENTRE|wxST_NO_AUTORESIZE</style>
-          <fg>#FFFFFF</fg>
-          <bg>#004080</bg>
-          <font>
-            <size>14</size>
-            <weight>bold</weight>
-            <family>swiss</family>
-          </font>
-        </object>
-      </object>
-      <object class="sizeritem">
-        <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-        <object class="wxStaticLine" name="ID_STATICLINE1"/>
-      </object>
-      <object class="sizeritem">
-        <border>8</border>
-        <flag>wxALL|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-        <object class="wxListbook" name="nbMain">
-          <object class="listbookpage">
-            <label>General settings</label>
-            <object class="wxPanel" name="tabGeneral">
-              <object class="wxBoxSizer">
-                <orient>wxVERTICAL</orient>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxCheckBox" name="chkShowSplash">
-                    <label>Show splash screen on start-up</label>
-                    <checked>1</checked>
-                  </object>
+    <object class="wxDialog" name="dlgEnvironmentSettings">
+        <title>Environment settings</title>
+        <centered>1</centered>
+        <object class="wxBoxSizer">
+            <orient>wxVERTICAL</orient>
+            <object class="sizeritem">
+                <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                <object class="wxStaticText" name="lblBigTitle">
+                    <label>General settings</label>
+                    <style>wxALIGN_CENTRE|wxST_NO_AUTORESIZE</style>
+                    <fg>#FFFFFF</fg>
+                    <bg>#004080</bg>
+                    <font>
+                        <size>14</size>
+                        <weight>bold</weight>
+                        <family>swiss</family>
+                        <face>Arial</face>
+                    </font>
                 </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxCheckBox" name="chkSingleInstance">
-                    <label>Allow only one running instance (needs application restart to take effect)</label>
-                    <checked>1</checked>
-                  </object>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxBoxSizer">
-                    <orient>wxHORIZONTAL</orient>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                      <object class="wxCheckBox" name="chkAssociations">
-                        <label>Check &amp;&amp; set file associations (Windows only)</label>
-                        <checked>1</checked>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <border>8</border>
-                      <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxButton" name="btnSetAssocs">
-                        <label>Set now</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <border>8</border>
-                      <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxButton" name="btnManageAssocs">
-                        <label>Manage...</label>
-                      </object>
-                    </object>
-                  </object>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxCheckBox" name="chkModifiedFiles">
-                    <label>Check for externally modified files</label>
-                    <checked>1</checked>
-                  </object>
-                </object>
-                <object class="spacer">
-                  <size>0,16</size>
-                  <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxTOP|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP</flag>
-                  <object class="wxFlexGridSizer">
-                    <rows>0</rows>
-                    <cols>2</cols>
-                    <vgap>8</vgap>
-                    <hgap>8</hgap>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                      <object class="wxRadioBox" name="rbAppStart">
-                        <label>On application start-up</label>
-                        <selection>1</selection>
-                        <content>
-                          <item>Open default workspace</item>
-                          <item>Open blank workspace</item>
-                        </content>
-                        <style>wxRA_SPECIFY_COLS</style>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                      <object class="wxRadioBox" name="rbProjectOpen">
-                        <label>On project load</label>
-                        <selection>1</selection>
-                        <content>
-                          <item>Open all project files</item>
-                          <item>Open last open files</item>
-                          <item>Do not open any files</item>
-                        </content>
-                        <style>wxRA_SPECIFY_COLS</style>
-                      </object>
-                    </object>
-                  </object>
-                </object>
-                <object class="spacer">
-                  <size>0,16</size>
-                  <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                </object>
-                <object class="sizeritem">
-                  <object class="wxFlexGridSizer">
-                    <cols>2</cols>
-                    <rows>2</rows>
-                    <vgap>8</vgap>
-                    <hgap>8</hgap>
-                    <growablecols>1</growablecols>
-                    <object class="sizeritem">
-                      <object class="wxStaticText">
-                        <label>Shell to run commands in:</label>
-                      </object>
-                      <flag>wxALIGN_CENTRE_VERTICAL</flag>
-                    </object>
-                    <object class="sizeritem">
-                      <object class="wxTextCtrl" name="txtConsoleShell"/>
-                      <option>1</option>
-                      <flag>wxGROW</flag>
-                    </object>
-                    <object class="sizeritem">
-                      <object class="wxStaticText">
-                        <label>Terminal to launch console programs:</label>
-                      </object>
-                      <flag>wxALIGN_CENTRE_VERTICAL</flag>
-                    </object>
-                    <object class="sizeritem">
-                      <object class="wxTextCtrl" name="txtConsoleTerm"/>
-                      <option>1</option>
-                      <flag>wxGROW</flag>
-                    </object>
-                  </object>
-                  <flag>wxLEFT|wxTOP|wxGROW</flag>
-                  <border>8</border>
-                </object>
-              </object>
             </object>
-          </object>
-          <object class="listbookpage">
-            <label>View</label>
-            <object class="wxPanel" name="tabView">
-              <object class="wxBoxSizer">
-                <orient>wxVERTICAL</orient>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxCheckBox" name="chkShowStartPage">
-                    <label>Show &quot;Start here&quot; page (shown only when there are no open projects)</label>
-                    <checked>1</checked>
-                  </object>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
-                  <object class="wxBoxSizer">
-                    <orient>wxHORIZONTAL</orient>
-                    <object class="sizeritem">
-                      <border>8</border>
-                      <flag>wxLEFT|wxRIGHT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxCheckBox" name="chkI18N">
-                        <label>Internationalization  (needs restart)</label>
-                        <style>wxCHK_2STATE</style>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <option>1</option>
-                      <border>5</border>
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND</flag>
-                      <object class="wxComboBox" name="cbxLanguage">
-                        <selection>0</selection>
-                        <content>
-                          <item>Available Languages</item>
-                        </content>
-                        <size>135,-1</size>
-                        <style>wxCB_SIMPLE|wxCB_READONLY</style>
-                      </object>
-                    </object>
-                  </object>
-                </object>
-                <object class="spacer">
-                  <size>0,16</size>
-                  <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                </object>
-                <object class="spacer">
-                  <size>0,16</size>
-                  <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                  <object class="wxCheckBox" name="chkDoPlace">
-                    <label>Enhanced multi-monitor dialog placement</label>
-                  </object>
-                </object>
-                <object class="sizeritem">
-                  <border>25</border>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                  <object class="wxCheckBox" name="chkPlaceHead">
-                    <label>Move to &quot;head up&quot; position</label>
-                  </object>
-                </object>
-                <object class="spacer">
-                  <size>0,8</size>
-                  <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxTOP|wxBOTTOM|wxLEFT|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
-                  <object class="wxCheckBox" name="chkAutoHideMessages">
-                    <label>Auto-hide message pane</label>
-                    <checked>1</checked>
-                  </object>
-                </object>
-                <object class="sizeritem">
-                  <object class="wxBoxSizer">
-                    <orient>wxVERTICAL</orient>
-                    <object class="sizeritem">
-                      <object class="wxCheckBox" name="chkAutoShowMessagesOnSearch">
-                        <label>Auto-show on search-in-files</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <border>4</border>
-                      <flag>wxTOP</flag>
-                      <object class="wxCheckBox" name="chkAutoShowMessagesOnWarn">
-                        <label>Auto-show on build warnings</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <border>4</border>
-                      <flag>wxTOP</flag>
-                      <object class="wxCheckBox" name="chkAutoShowMessagesOnErr">
-                        <label>Auto-show on build errors</label>
-                      </object>
-                    </object>
-                  </object>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                  <border>25</border>
-                </object>
-                <object class="spacer">
-                  <size>0,16</size>
-                  <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxALL|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxBoxSizer">
-                    <orient>wxHORIZONTAL</orient>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_CENTRE</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT22">
-                        <label>Message logs' font size:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <border>5</border>
-                      <flag>wxALIGN_CENTER</flag>
-                      <object class="wxSpinCtrl" name="spnLogFontSize">
-                        <value>8</value>
-                        <min>6</min>
-                        <max>32</max>
-                      </object>
-                    </object>
-                  </object>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxTOP|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP</flag>
-                  <object class="wxFlexGridSizer">
-                    <rows>0</rows>
-                    <cols>2</cols>
-                    <vgap>8</vgap>
-                    <hgap>8</hgap>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                      <object class="wxRadioBox" name="rbToolbarSize">
-                        <label>Toolbar icons size</label>
-                        <selection>0</selection>
-                        <content>
-                          <item>22 x 22 - Normal</item>
-                          <item>16 x 16 - Small</item>
-                        </content>
-                        <style>wxRA_SPECIFY_COLS</style>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                      <object class="wxRadioBox" name="rbSettingsIconsSize">
-                        <label>Settings icons size</label>
-                        <selection>0</selection>
-                        <content>
-                          <item>80 x 80 - Large</item>
-                          <item>No icons, just text</item>
-                        </content>
-                        <style>wxRA_SPECIFY_COLS</style>
-                      </object>
-                    </object>
-                  </object>
-                </object>
-              </object>
+            <object class="sizeritem">
+                <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                <object class="wxStaticLine" name="ID_STATICLINE1" />
             </object>
-          </object>
-          <object class="listbookpage">
-            <label>Notebooks appearence</label>
-            <object class="wxPanel" name="pblNotebooks">
-              <object class="wxBoxSizer">
-                <orient>wxVERTICAL</orient>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxFlexGridSizer">
-                    <rows>0</rows>
-                    <cols>2</cols>
-                    <vgap>4</vgap>
-                    <hgap>4</hgap>
-                    <growablecols>1</growablecols>
-                    <object class="sizeritem">
-                      <border>4</border>
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT1">
-                        <label>Tabs style:</label>
-                      </object>
+            <object class="sizeritem">
+                <border>8</border>
+                <flag>wxALL|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                <object class="wxListbook" name="nbMain">
+                    <object class="listbookpage">
+                        <label>General settings</label>
+                        <object class="wxPanel" name="tabGeneral">
+                            <object class="wxBoxSizer">
+                                <orient>wxVERTICAL</orient>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxCheckBox" name="chkShowSplash">
+                                        <label>Show splash screen on start-up</label>
+                                        <checked>1</checked>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxCheckBox" name="chkSingleInstance">
+                                        <label>Allow only one running instance (needs application restart to take effect)</label>
+                                        <checked>1</checked>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxBoxSizer">
+                                        <orient>wxHORIZONTAL</orient>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                            <object class="wxCheckBox" name="chkAssociations">
+                                                <label>Check &amp;&amp; set file associations (Windows only)</label>
+                                                <checked>1</checked>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <border>8</border>
+                                            <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxButton" name="btnSetAssocs">
+                                                <label>Set now</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <border>8</border>
+                                            <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxButton" name="btnManageAssocs">
+                                                <label>Manage...</label>
+                                            </object>
+                                        </object>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxCheckBox" name="chkModifiedFiles">
+                                        <label>Check for externally modified files</label>
+                                        <checked>1</checked>
+                                    </object>
+                                </object>
+                                <object class="spacer">
+                                    <size>0,16</size>
+                                    <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxTOP|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP</flag>
+                                    <object class="wxFlexGridSizer">
+                                        <rows>0</rows>
+                                        <cols>2</cols>
+                                        <vgap>8</vgap>
+                                        <hgap>8</hgap>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                            <object class="wxRadioBox" name="rbAppStart">
+                                                <label>On application start-up</label>
+                                                <selection>1</selection>
+                                                <content>
+                                                    <item>Open default workspace</item>
+                                                    <item>Open blank workspace</item>
+                                                </content>
+                                                <style>wxRA_SPECIFY_COLS</style>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                            <object class="wxRadioBox" name="rbProjectOpen">
+                                                <label>On project load</label>
+                                                <selection>1</selection>
+                                                <content>
+                                                    <item>Open all project files</item>
+                                                    <item>Open last open files</item>
+                                                    <item>Do not open any files</item>
+                                                </content>
+                                                <style>wxRA_SPECIFY_COLS</style>
+                                            </object>
+                                        </object>
+                                    </object>
+                                </object>
+                                <object class="spacer">
+                                    <size>0,16</size>
+                                    <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxFlexGridSizer">
+                                        <rows>2</rows>
+                                        <cols>2</cols>
+                                        <vgap>8</vgap>
+                                        <hgap>8</hgap>
+                                        <growablecols>1</growablecols>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT23">
+                                                <label>Shell to run commands in:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <option>1</option>
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                            <object class="wxTextCtrl" name="txtConsoleShell">
+                                                <value></value>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT24">
+                                                <label>Terminal to launch console programs:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <option>1</option>
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                            <object class="wxTextCtrl" name="txtConsoleTerm">
+                                                <value></value>
+                                            </object>
+                                        </object>
+                                    </object>
+                                </object>
+                            </object>
+                        </object>
                     </object>
-                    <object class="sizeritem">
-                      <option>1</option>
-                      <border>4</border>
-                      <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                      <object class="wxComboBox" name="cmbEditorTabs">
-                        <selection>0</selection>
-                        <content>
-                          <item>Default</item>
-                          <item>Fancy gradient</item>
-                          <item>Microsoft (tm) VisualStudio</item>
-                        </content>
-                        <style>wxCB_READONLY</style>
-                      </object>
+                    <object class="listbookpage">
+                        <label>View</label>
+                        <object class="wxPanel" name="tabView">
+                            <object class="wxBoxSizer">
+                                <orient>wxVERTICAL</orient>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxCheckBox" name="chkShowStartPage">
+                                        <label>Show &quot;Start here&quot; page (shown only when there are no open projects)</label>
+                                        <checked>1</checked>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxBoxSizer">
+                                        <orient>wxHORIZONTAL</orient>
+                                        <object class="sizeritem">
+                                            <border>8</border>
+                                            <flag>wxLEFT|wxRIGHT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxCheckBox" name="chkI18N">
+                                                <label>Internationalization (needs restart)</label>
+                                                <style>wxCHK_2STATE</style>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <option>1</option>
+                                            <border>5</border>
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND</flag>
+                                            <object class="wxComboBox" name="cbxLanguage">
+                                                <selection>0</selection>
+                                                <content>
+                                                    <item>Available Languages</item>
+                                                </content>
+                                                <size>135,-1</size>
+                                                <style>wxCB_SIMPLE|wxCB_READONLY</style>
+                                            </object>
+                                        </object>
+                                    </object>
+                                </object>
+                                <object class="spacer">
+                                    <size>0,16</size>
+                                    <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                </object>
+                                <object class="spacer">
+                                    <size>0,16</size>
+                                    <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                    <object class="wxCheckBox" name="chkDoPlace">
+                                        <label>Enhanced multi-monitor dialog placement</label>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>25</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                    <object class="wxCheckBox" name="chkPlaceHead">
+                                        <label>Move to &quot;head up&quot; position</label>
+                                    </object>
+                                </object>
+                                <object class="spacer">
+                                    <size>0,8</size>
+                                    <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxTOP|wxBOTTOM|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxCheckBox" name="chkAutoHideMessages">
+                                        <label>Auto-hide message pane</label>
+                                        <checked>1</checked>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>25</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                    <object class="wxBoxSizer">
+                                        <orient>wxVERTICAL</orient>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxCheckBox" name="chkAutoShowMessagesOnSearch">
+                                                <label>Auto-show on search-in-files</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <border>4</border>
+                                            <flag>wxTOP|wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxCheckBox" name="chkAutoShowMessagesOnWarn">
+                                                <label>Auto-show on build warnings</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <border>4</border>
+                                            <flag>wxTOP|wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxCheckBox" name="chkAutoShowMessagesOnErr">
+                                                <label>Auto-show on build errors</label>
+                                            </object>
+                                        </object>
+                                    </object>
+                                </object>
+                                <object class="spacer">
+                                    <size>0,16</size>
+                                    <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxALL|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxBoxSizer">
+                                        <orient>wxHORIZONTAL</orient>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_CENTER</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT22">
+                                                <label>Message logs&apos; font size:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <border>5</border>
+                                            <flag>wxALIGN_CENTER</flag>
+                                            <object class="wxSpinCtrl" name="spnLogFontSize">
+                                                <value>8</value>
+                                                <min>6</min>
+                                                <max>32</max>
+                                            </object>
+                                        </object>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxTOP|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP</flag>
+                                    <object class="wxFlexGridSizer">
+                                        <rows>0</rows>
+                                        <cols>2</cols>
+                                        <vgap>8</vgap>
+                                        <hgap>8</hgap>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                            <object class="wxRadioBox" name="rbToolbarSize">
+                                                <label>Toolbar icons size</label>
+                                                <selection>0</selection>
+                                                <content>
+                                                    <item>22 x 22 - Normal</item>
+                                                    <item>16 x 16 - Small</item>
+                                                </content>
+                                                <style>wxRA_SPECIFY_COLS</style>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                            <object class="wxRadioBox" name="rbSettingsIconsSize">
+                                                <label>Settings icons size</label>
+                                                <selection>0</selection>
+                                                <content>
+                                                    <item>80 x 80 - Large</item>
+                                                    <item>No icons, just text</item>
+                                                </content>
+                                                <style>wxRA_SPECIFY_COLS</style>
+                                            </object>
+                                        </object>
+                                    </object>
+                                </object>
+                            </object>
+                        </object>
                     </object>
-                  </object>
-                </object>
-                <object class="spacer">
-                  <size>0,16</size>
-                  <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP</flag>
-                  <object class="wxStaticBoxSizer">
-                    <orient>wxVERTICAL</orient>
-                    <label>Gradient style colours</label>
-                    <object class="sizeritem">
-                      <border>4</border>
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxFlexGridSizer">
-                        <rows>0</rows>
-                        <cols>2</cols>
-                        <vgap>4</vgap>
-                        <hgap>4</hgap>
-                        <object class="sizeritem">
-                          <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                          <object class="wxStaticText" name="ID_STATICTEXT2">
-                            <label>Border colour:</label>
-                          </object>
+                    <object class="listbookpage">
+                        <label>Notebooks appearence</label>
+                        <object class="wxPanel" name="pblNotebooks">
+                            <object class="wxBoxSizer">
+                                <orient>wxVERTICAL</orient>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxFlexGridSizer">
+                                        <rows>0</rows>
+                                        <cols>2</cols>
+                                        <vgap>4</vgap>
+                                        <hgap>4</hgap>
+                                        <growablecols>1</growablecols>
+                                        <object class="sizeritem">
+                                            <border>4</border>
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT1">
+                                                <label>Tabs style:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <option>1</option>
+                                            <border>4</border>
+                                            <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                            <object class="wxComboBox" name="cmbEditorTabs">
+                                                <selection>0</selection>
+                                                <content>
+                                                    <item>Default</item>
+                                                    <item>Fancy gradient</item>
+                                                    <item>Microsoft (tm) VisualStudio</item>
+                                                </content>
+                                                <style>wxCB_READONLY</style>
+                                            </object>
+                                        </object>
+                                    </object>
+                                </object>
+                                <object class="spacer">
+                                    <size>0,16</size>
+                                    <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP</flag>
+                                    <object class="wxStaticBoxSizer">
+                                        <orient>wxVERTICAL</orient>
+                                        <label>Gradient style colours</label>
+                                        <object class="sizeritem">
+                                            <border>4</border>
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxFlexGridSizer">
+                                                <rows>0</rows>
+                                                <cols>2</cols>
+                                                <vgap>4</vgap>
+                                                <hgap>4</hgap>
+                                                <object class="sizeritem">
+                                                    <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                                    <object class="wxStaticText" name="ID_STATICTEXT2">
+                                                        <label>Border colour:</label>
+                                                    </object>
+                                                </object>
+                                                <object class="sizeritem">
+                                                    <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                                    <object class="wxButton" name="btnFNBorder">
+                                                        <label></label>
+                                                    </object>
+                                                </object>
+                                                <object class="sizeritem">
+                                                    <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                                    <object class="wxStaticText" name="ID_STATICTEXT3">
+                                                        <label>From colour:</label>
+                                                    </object>
+                                                </object>
+                                                <object class="sizeritem">
+                                                    <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                                    <object class="wxButton" name="btnFNFrom">
+                                                        <label></label>
+                                                    </object>
+                                                </object>
+                                                <object class="sizeritem">
+                                                    <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                                    <object class="wxStaticText" name="ID_STATICTEXT4">
+                                                        <label>To colour:</label>
+                                                    </object>
+                                                </object>
+                                                <object class="sizeritem">
+                                                    <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                                    <object class="wxButton" name="btnFNTo">
+                                                        <label></label>
+                                                    </object>
+                                                </object>
+                                            </object>
+                                        </object>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxALL|wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                    <object class="wxCheckBox" name="chkSmartTabs">
+                                        <label>Use Smart Tab-switching scheme</label>
+                                    </object>
+                                </object>
+                            </object>
                         </object>
-                        <object class="sizeritem">
-                          <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                          <object class="wxButton" name="btnFNBorder">
-                            <label></label>
-                          </object>
+                    </object>
+                    <object class="listbookpage">
+                        <label>Docking system</label>
+                        <object class="wxPanel" name="pnlDocking">
+                            <object class="wxBoxSizer">
+                                <orient>wxVERTICAL</orient>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxFlexGridSizer">
+                                        <rows>0</rows>
+                                        <cols>2</cols>
+                                        <vgap>4</vgap>
+                                        <hgap>4</hgap>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT5">
+                                                <label>Pane border size:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxSpinCtrl" name="spnAuiBorder">
+                                                <value>1</value>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT6">
+                                                <label>Sash size:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxSpinCtrl" name="spnAuiSash">
+                                                <value>4</value>
+                                                <min>1</min>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT7">
+                                                <label>Caption height:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxSpinCtrl" name="spnAuiCaption">
+                                                <value>17</value>
+                                                <min>4</min>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT8">
+                                                <label>Background colour:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxButton" name="btnAuiBgColour">
+                                                <label></label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT9">
+                                                <label>Sash colour:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxButton" name="btnAuiSashColour">
+                                                <label></label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT10">
+                                                <label>Border colour:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxButton" name="btnAuiBorderColour">
+                                                <label></label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT11">
+                                                <label>Gripper colour:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxButton" name="btnAuiGripperColour">
+                                                <label></label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT12">
+                                                <label>Active caption colour:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxButton" name="btnAuiActiveCaptionColour">
+                                                <label></label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT13">
+                                                <label>Active caption gradient colour:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxButton" name="btnAuiActiveCaptionGradientColour">
+                                                <label></label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT14">
+                                                <label>Active caption text colour:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxButton" name="btnAuiActiveCaptionTextColour">
+                                                <label></label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT15">
+                                                <label>Inactive caption colour:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxButton" name="btnAuiInactiveCaptionColour">
+                                                <label></label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT16">
+                                                <label>Inactive caption gradient colour:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxButton" name="btnAuiInactiveCaptionGradientColour">
+                                                <label></label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+                                            <object class="wxStaticText" name="ID_STATICTEXT17">
+                                                <label>Inactive caption text colour:</label>
+                                            </object>
+                                        </object>
+                                        <object class="sizeritem">
+                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                            <object class="wxButton" name="btnAuiInactiveCaptionTextColour">
+                                                <label></label>
+                                            </object>
+                                        </object>
+                                    </object>
+                                </object>
+                            </object>
                         </object>
-                        <object class="sizeritem">
-                          <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                          <object class="wxStaticText" name="ID_STATICTEXT3">
-                            <label>From colour:</label>
-                          </object>
+                    </object>
+                    <object class="listbookpage">
+                        <label>Disabled dialogs</label>
+                        <object class="wxPanel" name="tabDialogs">
+                            <object class="wxBoxSizer">
+                                <orient>wxVERTICAL</orient>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxStaticText" name="ID_STATICTEXT18">
+                                        <label>Re-enable the following confirmation dialogs:</label>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxStaticText" name="ID_STATICTEXT19">
+                                        <label>(list will be empty if all dialogs are enabled)</label>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <option>1</option>
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxCheckList" name="chkDialogs">
+                                        <style></style>
+                                        <content />
+                                    </object>
+                                </object>
+                            </object>
                         </object>
-                        <object class="sizeritem">
-                          <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                          <object class="wxButton" name="btnFNFrom">
-                            <label></label>
-                          </object>
+                    </object>
+                    <object class="listbookpage">
+                        <label>Network proxy</label>
+                        <object class="wxPanel" name="tabNetwork">
+                            <object class="wxBoxSizer">
+                                <orient>wxVERTICAL</orient>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxStaticText" name="ID_STATICTEXT20">
+                                        <label>Use the following proxy when making network connections:</label>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxStaticText" name="ID_STATICTEXT21">
+                                        <label>Format: hostname:port</label>
+                                    </object>
+                                </object>
+                                <object class="sizeritem">
+                                    <border>8</border>
+                                    <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                                    <object class="wxTextCtrl" name="txtProxy">
+                                        <value></value>
+                                    </object>
+                                </object>
+                            </object>
                         </object>
-                        <object class="sizeritem">
-                          <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                          <object class="wxStaticText" name="ID_STATICTEXT4">
-                            <label>To colour:</label>
-                          </object>
-                        </object>
-                        <object class="sizeritem">
-                          <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                          <object class="wxButton" name="btnFNTo">
-                            <label></label>
-                          </object>
-                        </object>
-                      </object>
                     </object>
-                  </object>
                 </object>
-              </object>
             </object>
-          </object>
-          <object class="listbookpage">
-            <label>Docking system</label>
-            <object class="wxPanel" name="pnlDocking">
-              <object class="wxBoxSizer">
-                <orient>wxVERTICAL</orient>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxFlexGridSizer">
-                    <rows>0</rows>
-                    <cols>2</cols>
-                    <vgap>4</vgap>
-                    <hgap>4</hgap>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT5">
-                        <label>Pane border size:</label>
-                      </object>
+            <object class="sizeritem">
+                <border>8</border>
+                <flag>wxLEFT|wxRIGHT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
+                <object class="wxStaticLine" name="ID_STATICLINE2" />
+            </object>
+            <object class="sizeritem">
+                <border>8</border>
+                <flag>wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP</flag>
+                <object class="wxStdDialogButtonSizer">
+                    <object class="button">
+                        <object class="wxButton" name="wxID_OK" />
                     </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxSpinCtrl" name="spnAuiBorder">
-                        <value>1</value>
-                      </object>
+                    <object class="button">
+                        <object class="wxButton" name="wxID_CANCEL" />
                     </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT6">
-                        <label>Sash size:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxSpinCtrl" name="spnAuiSash">
-                        <value>4</value>
-                        <min>1</min>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT7">
-                        <label>Caption height:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxSpinCtrl" name="spnAuiCaption">
-                        <value>17</value>
-                        <min>4</min>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT8">
-                        <label>Background colour:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxButton" name="btnAuiBgColour">
-                        <label></label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT9">
-                        <label>Sash colour:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxButton" name="btnAuiSashColour">
-                        <label></label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT10">
-                        <label>Border colour:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxButton" name="btnAuiBorderColour">
-                        <label></label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT11">
-                        <label>Gripper colour:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxButton" name="btnAuiGripperColour">
-                        <label></label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT12">
-                        <label>Active caption colour:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxButton" name="btnAuiActiveCaptionColour">
-                        <label></label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT13">
-                        <label>Active caption gradient colour:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxButton" name="btnAuiActiveCaptionGradientColour">
-                        <label></label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT14">
-                        <label>Active caption text colour:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxButton" name="btnAuiActiveCaptionTextColour">
-                        <label></label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT15">
-                        <label>Inactive caption colour:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxButton" name="btnAuiInactiveCaptionColour">
-                        <label></label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT16">
-                        <label>Inactive caption gradient colour:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxButton" name="btnAuiInactiveCaptionGradientColour">
-                        <label></label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                      <object class="wxStaticText" name="ID_STATICTEXT17">
-                        <label>Inactive caption text colour:</label>
-                      </object>
-                    </object>
-                    <object class="sizeritem">
-                      <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
-                      <object class="wxButton" name="btnAuiInactiveCaptionTextColour">
-                        <label></label>
-                      </object>
-                    </object>
-                  </object>
                 </object>
-              </object>
             </object>
-          </object>
-          <object class="listbookpage">
-            <label>Disabled dialogs</label>
-            <object class="wxPanel" name="tabDialogs">
-              <object class="wxBoxSizer">
-                <orient>wxVERTICAL</orient>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxStaticText" name="ID_STATICTEXT18">
-                    <label>Re-enable the following confirmation dialogs:</label>
-                  </object>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxStaticText" name="ID_STATICTEXT19">
-                    <label>(list will be empty if all dialogs are enabled)</label>
-                  </object>
-                </object>
-                <object class="sizeritem">
-                  <option>1</option>
-                  <border>8</border>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxCheckList" name="chkDialogs">
-                    <style></style>
-                    <content/>
-                  </object>
-                </object>
-              </object>
-            </object>
-          </object>
-          <object class="listbookpage">
-            <label>Network proxy</label>
-            <object class="wxPanel" name="tabNetwork">
-              <object class="wxBoxSizer">
-                <orient>wxVERTICAL</orient>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxStaticText" name="ID_STATICTEXT20">
-                    <label>Use the following proxy when making network connections:</label>
-                  </object>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxStaticText" name="ID_STATICTEXT21">
-                    <label>Format: hostname:port</label>
-                  </object>
-                </object>
-                <object class="sizeritem">
-                  <border>8</border>
-                  <flag>wxLEFT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-                  <object class="wxTextCtrl" name="txtProxy">
-                    <value></value>
-                  </object>
-                </object>
-              </object>
-            </object>
-          </object>
         </object>
-      </object>
-      <object class="sizeritem">
-        <border>8</border>
-        <flag>wxLEFT|wxRIGHT|wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND</flag>
-        <object class="wxStaticLine" name="ID_STATICLINE2"/>
-      </object>
-      <object class="sizeritem">
-        <object class="wxStdDialogButtonSizer">
-          <object class="button">
-            <object class="wxButton" name="wxID_OK">
-              <label></label>
-              <label>&amp;Ok</label>
-              <default>1</default>
-            </object>
-          </object>
-          <object class="button">
-            <object class="wxButton" name="wxID_CANCEL">
-              <label></label>
-              <label>&amp;Cancel</label>
-            </object>
-          </object>
-        </object>
-        <flag>wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP</flag>
-        <border>8</border>
-      </object>
     </object>
-  </object>
-</resource>
\ No newline at end of file
+</resource>
