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

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

<< < (3/35) > >>

kimastergeorge:
Yeah, I've already started. My goal is to make it look almost exactly like Firefox's tabs (although that might be impossible) and behave just like a wxNotebook.

takeshimiya:
Yeah! I vote for exactly Firefox tabs!  :D

kimastergeorge:
So...

I've got one. It doesn't have middle-click-close or right-click menus yet, but it does switch pages and close them with the button. The code might not be totally readable... but it should work.

The code is attached.

If anybody knows how to make it behave more like a real wxControl (currently it's just a wxPanel), I'd appreciate it if they'd tell me... or do it for me (for example, styles?).

Also, it looks a bit.... not right. I tried overloading wxWindow's Layout() to move the sizer which contains the displayed panel up 2 pixels, to remove that little bit of space between the wxNotebook and the panels, but that just ends up with the screen flashing a bunch, even if I do use Freeze/Thaw.

The syntax is pretty obvious; just like any other wxWindow, except, after the id, there's an argument of the bitmap for the close button. Currently, the close button doesn't have any borders, so it really doesn't look like a button at all (you can add in some code to change the image when it's clicked, if you want). You could add borders, too, by removing the wxNO_BORDERS for the wxBitmapButton.

[attachment deleted by admin]

rickg22:
Mind attaching some screenshots, so we can see how it looks?

kimastergeorge:
Yeah... I developed it on Windows, and I found a big, huge bug on wxGTK (which might occur on other systems, too).

It is a wxGTK bug, actually: when the wxNotebook isn't shown yet, and you change tabs (through SetSelection) it doesn't call the event handler, so I changed the SetSelection function. I've attached the new version.

A screenshot on wxGTK is attached. I'll add a Windows screenshot later.

The little black dot in the upper-left corner is the close button. I just used a random bitmap I had on my machine for it. On wxGTK, though, the button, even without borders, pops up when you select it, so it ends up only showing a little bit of the picture.

[attachment deleted by admin]

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version