Developer forums (C::B DEVELOPMENT STRICTLY!) > Contributions to C::B

BOUNTY: Notebook class with "close" button at the right

<< < (2/35) > >>

rickg22:
On top of the menubar... hmmmm not bad.
Unfortunately my wxWidgets expertise isn't as broad as to try to implement that. Implementations welcome.

takeshimiya:
On Wed, 3 Oct 2001 18:13:13 -0700 David Cuny <dcuny@xxxxxxxxxx> wrote:

DC> Has the wxTabCtrl deprecated for wxNotebook?

Yes, it is/was - and since a long time as well. Please don't use it in the
new code, it's old and unmaintained and has no advantages (but plenty of
problems) compared to wxNotebook.

It should still be in the source tree but it's not built into the library
by default.

Regards,
VZ

DreadNot:
Copy of post from http://forums.codeblocks.org/index.php/topic,633.msg4646.html#msg4646:


--- Quote from: DreadNot on August 09, 2005, 02:07:11 pm ---As far as the toolbar is concerned, add the following buttons after Save:
1] Save All
2] Close (current tab/file)
3] Close All

Did anyone notice that Mozilla also has a "New Tab" button on the left side as well as a "Close Tab" on the right.

The notebook code calls "wx/generic/tabg.h", so what I believe needs to be changed is "tabg.h" and "tabg.cpp" in wx to have a controlled left and right margin something like it has for the top margin.  I think these files are generic to all wx versions.  The left/right margin should act something like (and in addition to) the m_tabHorizontalOffset value.  These margins would allow the addition of the button(s) to the left and right sides of the notebook in the tabs area.

--- End quote ---

In addition, the left/right margin values should default to the current values (which I beleive are hardcoded to 4 in /msw/).  The values should be setable in wxNotebook [void SetMargins(const int &left, const int &right)], passed to the wxTabView via wxNotebookTabView in src/(whatever)/notebook.cpp, and used in wxTabView::LayoutTabs().
Adding the buttons in the margin could be done separately (via Yannis solution) or in a derived wxNotebook class as suggested.

Also, should we consider moving tabs (drag-n-drop) in the wxNotebook class?  Maybe add a bool m_bMovablePages.  If true, tabs in the tablist can be rearranged via mouse using RemovePage()/InsertPage().

UPDATE: Sorry, most of this is only good for MOTIF.  Windows would have to somehow resize the tab area width to be less than the page width.

kimastergeorge:
I have an idea that might work:

Make a subclass of wxControl that has some sort of wxSizer or something just to keep the different widgets on top of each other. Then put a wxNotebook with all the wxPanels blank/empty inside the control (this way, we avoid using wxTabCtrl and its bugs/non-portability). Make sure all the wxPanels have a height of 0. Somehow, you'd have to make wxNotebook only as high as the tabs. Then, below, you'd put whatever wxPanel you want shown. You could add whatever buttons you want on the left and right of the wxNotebook (with a sizer). Then, to switch pages, you just use wxNotebook's EVT_NOTEBOOK_PAGE_CHANGED/EVT_NOTEBOOK_PAGE_CHANGING to detect when to change the panel that is shown (and then create new events for your new control which mirror those events). You could also combine this with the middle-click-close etc. ideas.

aMule (http://www.amule.org/) also has a different way to make closable notebook pages, although you can't have any images in the tabs if you use their way. Their method is having a close button as the image for each tab, and when the image is clicked, that tab is closed. It also has a right-click menu on the tabs that allow you to close that tab, close all tabs, or close all except that tab.

BTW, I'm not a developer for Code::Blocks, and I probably will never touch the code, it's just I want this control just as much as you do. I'll give you the code I come up with, if I come up with a result first.

rickg22:

--- Quote from: kimastergeorge on August 11, 2005, 12:09:37 am ---I have an idea that might work:

...Somehow, you'd have to make wxNotebook only as high as the tabs.
--- End quote ---

Brilliant! That would be the perfect replacement! Will you do it please? :D (we're too busy fixing bugs, youknow)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version