wxFlatNotebook
wxFlatNotebook
Hi,
For a project I am working, I needed a more "modern" notebook, than the one that come with wxWidgets.
Searching here I did found here a flat tab control - but however I found it with some flaws:
1. It did not manage to windows but only the tabs drawing.
2. If I opened too many tabs the drawing is bad (overflow, noway to scroll, etc.)
So, attach you can find a link to my work of the wxFlatNotebook.
The wxFlatNotebook is a full implementation of the wxNotebook, and designed to be a drop-in replacement for the wxNotebook. The API functiosn are similar so one can expect the function to behave in the same way.
Some nice features:
1. The buttons are highlighted a la Firefox style
2. The scrolling is done for bulks of tabs (so, the scrolling is faster and better)
3. The buttons area is never overdrawn by tabs (unlike many other implementations I saw)
4. It is a generic control
5. Currently there are 3 differnt styles - VC 71, Standard and Fancy.
6. Mouse middle click can be used to close tabs
7. A function to add right click menu for tabs (simple as SetRightClickMenu)
8. All styles has bottom style as well (they can be drawn in the bottom of screen)
9. An option to hide 'X' button or navigation buttons (separately)
My initial code (for how to draw tabs) was taken from the arucard visual studio tab control - so thanks arucard.
Linux screenshot:
More screenshots for different styles, can be seen here:
http://sourceforge.net/project/screensh ... _id=156698
Download sources and demo from here (sourceforge):
http://sourceforge.net/projects/wxflatnotebook/
Enjoy,
Eran
For a project I am working, I needed a more "modern" notebook, than the one that come with wxWidgets.
Searching here I did found here a flat tab control - but however I found it with some flaws:
1. It did not manage to windows but only the tabs drawing.
2. If I opened too many tabs the drawing is bad (overflow, noway to scroll, etc.)
So, attach you can find a link to my work of the wxFlatNotebook.
The wxFlatNotebook is a full implementation of the wxNotebook, and designed to be a drop-in replacement for the wxNotebook. The API functiosn are similar so one can expect the function to behave in the same way.
Some nice features:
1. The buttons are highlighted a la Firefox style
2. The scrolling is done for bulks of tabs (so, the scrolling is faster and better)
3. The buttons area is never overdrawn by tabs (unlike many other implementations I saw)
4. It is a generic control
5. Currently there are 3 differnt styles - VC 71, Standard and Fancy.
6. Mouse middle click can be used to close tabs
7. A function to add right click menu for tabs (simple as SetRightClickMenu)
8. All styles has bottom style as well (they can be drawn in the bottom of screen)
9. An option to hide 'X' button or navigation buttons (separately)
My initial code (for how to draw tabs) was taken from the arucard visual studio tab control - so thanks arucard.
Linux screenshot:
More screenshots for different styles, can be seen here:
http://sourceforge.net/project/screensh ... _id=156698
Download sources and demo from here (sourceforge):
http://sourceforge.net/projects/wxflatnotebook/
Enjoy,
Eran
Last edited by eranif on Wed Jan 25, 2006 9:57 pm, edited 5 times in total.
-
- Experienced Solver
- Posts: 75
- Joined: Tue Aug 23, 2005 3:47 am
- T-Rex
- Moderator
- Posts: 1248
- Joined: Sat Oct 23, 2004 9:58 am
- Location: Zaporizhzhya, Ukraine
- Contact:
Very nice work. Like it
I have some propositions which can make the work with your class easier...
- place X button to source using XPM-like variable (I mean save X button as XPM and copy-paste contents of XPM file to the source code)
- create doxygen-like comments and generate the documentation
- create two separate projects (library and sample)
- create standard contrib structure (build - src - include - lib - docs) and installer.
I can help in implementing this propositions if you want.
Regards,
T-Rex
I have some propositions which can make the work with your class easier...
- place X button to source using XPM-like variable (I mean save X button as XPM and copy-paste contents of XPM file to the source code)
- create doxygen-like comments and generate the documentation
- create two separate projects (library and sample)
- create standard contrib structure (build - src - include - lib - docs) and installer.
I can help in implementing this propositions if you want.
Regards,
T-Rex
-
- In need of some credit
- Posts: 7
- Joined: Sat Dec 31, 2005 7:25 am
- Location: Colombia (South America)
Hi.
Dunno if you've heard about Code::Blocks (it's an IDE made with wxWidgets) and we've been looking for a notebook with a close button to replace the current wxNotebook we're using, and the current implementation for the close button (it wastes space).
Somebody posted a link to this thread in the forums and it looks promising. I've already been playing a bit with it and got it to work under Windows and Linux with a few minor changes.
eranif: Would you mind if we take your current code and use it for Code::Blocks?
Thanks in advance
Sorry for the advertisement
Dunno if you've heard about Code::Blocks (it's an IDE made with wxWidgets) and we've been looking for a notebook with a close button to replace the current wxNotebook we're using, and the current implementation for the close button (it wastes space).
Somebody posted a link to this thread in the forums and it looks promising. I've already been playing a bit with it and got it to work under Windows and Linux with a few minor changes.
eranif: Would you mind if we take your current code and use it for Code::Blocks?
Thanks in advance
Sorry for the advertisement
-
- Experienced Solver
- Posts: 75
- Joined: Tue Aug 23, 2005 3:47 am
Hi,
USTabCtrl.cpp/h - is a left over, you can safely remove it.
The notebook is under the usual wxWidgets license
You can take it for Code::blocks (and yes, I have heard about it)
The API implemented is similar to the common wxNotebook, so you could expect the functions to work the same
only one fucntion is changed:
AddPage - instead of receving an index of the image in the image list (using functions like SetImageList or AssignImageList), you need to provide the image directly.
I did it this way since I encountered a bug that I do the following code:
The icons lost their alpha channel !
(my icons are 32bit png files with alpha channel)
I would prefer to use the usuall way of assinging image with functions like( Set/Assign)
So any ideas why I lost the alpha channel are welcomed.
I will update the library in the coming days with more functionality (SetPageText, less flickering, menus and tooltips)
T-Rex - I will apprectiate if you will change the directory structure and send me a link to where i can download it from
Eran
USTabCtrl.cpp/h - is a left over, you can safely remove it.
The notebook is under the usual wxWidgets license
You can take it for Code::blocks (and yes, I have heard about it)
The API implemented is similar to the common wxNotebook, so you could expect the functions to work the same
only one fucntion is changed:
AddPage - instead of receving an index of the image in the image list (using functions like SetImageList or AssignImageList), you need to provide the image directly.
I did it this way since I encountered a bug that I do the following code:
Code: Select all
wxImageList *imgList = new wxImageList(16, 16);
imgList->Add(wxXmlResources::Get()->LoadBitmap("imag1"));
imgList->Add(wxXmlResources::Get()->LoadBitmap("imag2"));
// Assigne the image list
book->AssignImageList(imgList);
(my icons are 32bit png files with alpha channel)
I would prefer to use the usuall way of assinging image with functions like( Set/Assign)
So any ideas why I lost the alpha channel are welcomed.
I will update the library in the coming days with more functionality (SetPageText, less flickering, menus and tooltips)
T-Rex - I will apprectiate if you will change the directory structure and send me a link to where i can download it from
Eran
Hi ,
Just wanted to update you that I updated the class, it now contains the following changes:
1. Ctrl+Tab / Ctrl + Shift + Tab are now supported.
2. Fixed bug in the scrolling when resizing the control, you might have missed some tabs ...
3. The directory files is now changed to suite the usuall contrib directory - Thanks to T-Rex for the job
4. SetSelection API is added to the notebook
5. GetPageCount API is added to the notebook
You can still use the same link from above to download the source files
I will add more styles to the control in the comming days, so stay tuned!
Enjoy,
Eran
Just wanted to update you that I updated the class, it now contains the following changes:
1. Ctrl+Tab / Ctrl + Shift + Tab are now supported.
2. Fixed bug in the scrolling when resizing the control, you might have missed some tabs ...
3. The directory files is now changed to suite the usuall contrib directory - Thanks to T-Rex for the job
4. SetSelection API is added to the notebook
5. GetPageCount API is added to the notebook
You can still use the same link from above to download the source files
I will add more styles to the control in the comming days, so stay tuned!
Enjoy,
Eran
- T-Rex
- Moderator
- Posts: 1248
- Joined: Sat Oct 23, 2004 9:58 am
- Location: Zaporizhzhya, Ukraine
- Contact:
priyank_bolia, could you explain your changes?
I have already added support of non-rectangular tab headers (Inclined borders for tab headers) and I hope this changes will be accepted by eranif. I sent him the private message but still have no answer....
The source code changed by me is avaliable at
http://www.ttanalytics.nm.ru/wxFlatNotebook.zip
I have already added support of non-rectangular tab headers (Inclined borders for tab headers) and I hope this changes will be accepted by eranif. I sent him the private message but still have no answer....
The source code changed by me is avaliable at
http://www.ttanalytics.nm.ru/wxFlatNotebook.zip
-
- wxWorld Domination!
- Posts: 1339
- Joined: Wed Aug 03, 2005 8:10 am
- Location: BANGALORE, INDIA
- Contact:
I modified it little bit to provide greater portability to existing wxNotebook, by providing more functions.
http://www.priyank.in/downloads/wxFlatNotebook.zip
http://www.priyank.in/downloads/wxFlatNotebook.zip
-
- wxWorld Domination!
- Posts: 1339
- Joined: Wed Aug 03, 2005 8:10 am
- Location: BANGALORE, INDIA
- Contact:
More functions like:T-Rex wrote:priyank_bolia, could you explain your changes?
I have already added support of non-rectangular tab headers (Inclined borders for tab headers) and I hope this changes will be accepted by eranif. I sent him the private message but still have no answer....
The source code changed by me is avaliable at
http://www.ttanalytics.nm.ru/wxFlatNotebook.zip
SetPageText
InsertPage
SetPadding
RemovePage
ShowTabTooltip
Left right arrow disable when they don't have anything to do
Sets a minimum size for the tab, when no text or image is given, also when there is no images, the right border overlapped the text, so the padding is increased.
Vector warning removed, coding standards revised, etc..
Ok,
As promissed:
Attached is the updated source file with the following changes:
1. T-Rex added an shaped rectangle option (see demo for usage)
2. Minor bug fixes + API added by priyank_bolia - InsertPage, SetPageText etc. (check out header file)
3. Scrolling buttons are disabled when no scrolling can take place - priyank_bolia
5. bug fixes - drawing issues and fixed crash situation
6. Merge between T-Rex additional style and priyank_bolia fixes (their fixes had a conflict )
7. I introduced a new style and API - SetBookStyle:
you can set it to wxFNB_DEFAULT_STYLE or wxFNB_VC71
Attach are the screenshots for the updated styles
Again, the full source code and example can be downloaded from
http://www.eistware.com/wx/wxFlatNotebook.zip
Screen shots:
Standard style (both images and shaped and non-shaped rectangles):
VC71 style (Visual Studio 7.1, 2003)
Enjoy,
And thanks to all contributors,
Let me know if you find a bug ...
Eran
As promissed:
Attached is the updated source file with the following changes:
1. T-Rex added an shaped rectangle option (see demo for usage)
2. Minor bug fixes + API added by priyank_bolia - InsertPage, SetPageText etc. (check out header file)
3. Scrolling buttons are disabled when no scrolling can take place - priyank_bolia
5. bug fixes - drawing issues and fixed crash situation
6. Merge between T-Rex additional style and priyank_bolia fixes (their fixes had a conflict )
7. I introduced a new style and API - SetBookStyle:
you can set it to wxFNB_DEFAULT_STYLE or wxFNB_VC71
Attach are the screenshots for the updated styles
Again, the full source code and example can be downloaded from
http://www.eistware.com/wx/wxFlatNotebook.zip
Screen shots:
Standard style (both images and shaped and non-shaped rectangles):
VC71 style (Visual Studio 7.1, 2003)
Enjoy,
And thanks to all contributors,
Let me know if you find a bug ...
Eran
has anybody built this wxFlatNotebook lib and Test-demo with MinGW gcc ??
i tried it - built wxFlatNoteBook as static lib, everything compiles smoothly,
but got stuck at linktime with the event-types class
the linker gets the following unresolved refernces, when linking the wxNotebookTest application with the static libwxNoteBook.a
in the libwxFlatNoteBook.a these are exported as
how can i declare these imports or exports so that it can be linked ?
any suggestions ?
thx
[edit]
found a workaround to get the demo running - i had to build wxFlatNotebook as dll instead as static lib
it must something have to do with my wx-widgets build, which is wx262 shared library (wxmsw26.dll)
maybe someone knows a slotution how i can use a self-built static wxwidgets library side by side with a shared wx-widgets library.
i tried it - built wxFlatNoteBook as static lib, everything compiles smoothly,
but got stuck at linktime with the event-types class
Code: Select all
IMPLEMENT_DYNAMIC_CLASS(wxFlatNotebookEvent, wxNotifyEvent)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGING)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING)
Code: Select all
mingw32-g++.exe -L..\..\lib -Ld:\wx262\lib\gcc_dll -Ld:\wx262\lib -LD:\MinGW\lib -o Debug\wxFlatNotebookTest.exe Debug\Frame.o Debug\resources.o Debug\App.o -lwxFlatNotebookd -lwinmm -lcomctl32 -lrpcrt4 -lwsock32 -loleacc -lodbc32 -lwxmsw26 -mwindows
Debug\Frame.o: In function `Z41__static_initialization_and_destruction_0ii':
D:/devel/CodeBlocks/_projects/TESTS/wxFlatNotebook/my/samples/wxFlatNotebook/Frame.cpp:22: undefined reference to `_imp__wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGING'
D:/devel/CodeBlocks/_projects/TESTS/wxFlatNotebook/my/samples/wxFlatNotebook/Frame.cpp:22: undefined reference to `_imp__wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGED'
D:/devel/CodeBlocks/_projects/TESTS/wxFlatNotebook/my/samples/wxFlatNotebook/Frame.cpp:22: undefined reference to `_imp__wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING'
collect2: ld returned 1 exit status
Code: Select all
_wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGING
_wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGED
_wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING
any suggestions ?
thx
[edit]
found a workaround to get the demo running - i had to build wxFlatNotebook as dll instead as static lib
it must something have to do with my wx-widgets build, which is wx262 shared library (wxmsw26.dll)
maybe someone knows a slotution how i can use a self-built static wxwidgets library side by side with a shared wx-widgets library.
Last edited by tiwag on Sun Jan 01, 2006 9:59 pm, edited 1 time in total.
-tiwag
- T-Rex
- Moderator
- Posts: 1248
- Joined: Sat Oct 23, 2004 9:58 am
- Location: Zaporizhzhya, Ukraine
- Contact:
Excellent!
But please, remove this line
#include "resource.h"
from wxFlatNotebook.h
There is no such file in the distro and it causes an error message when compiling using wxDev-CPP
And one more notice... when you press navigation button and there is no more tabs to scroll, it becomes invisible while mouse pointer is above this button but if we move mouse pointer elsewhere it becomes visible.... could you change this behaviour because it irritates IMO.
But please, remove this line
#include "resource.h"
from wxFlatNotebook.h
There is no such file in the distro and it causes an error message when compiling using wxDev-CPP
And one more notice... when you press navigation button and there is no more tabs to scroll, it becomes invisible while mouse pointer is above this button but if we move mouse pointer elsewhere it becomes visible.... could you change this behaviour because it irritates IMO.