News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Instead wxToolBar by wxAuiToolBar ?

Started by Loaden, August 22, 2010, 03:00:44 PM

Previous topic - Next topic

Loaden

In Ubuntu 10.4, the wxToolBar is very ugly.

So, why not instead by wxAuiToolBar ?

Any comments are welcome ?

thynson

Agreed. I remember that I used to complained for it in "Using codeblocks" forum.

MortenMacFly

Quote from: Loaden on August 22, 2010, 03:00:44 PM
So, why not instead by wxAuiToolBar ?
Any comments are welcome ?
That would be OK, however, it requires re-writing quite some portions, not to forget plugins (probably not in our own repo).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Loaden

I am trying, but is seems so hard! Because since there is currently no XRC handler for wxAuiToolBar.
My current thinking like this.

include/cbtoolbar.h
/*
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
* http://www.gnu.org/licenses/lgpl-3.0.html
*/

#ifndef CBTOOLBAR_H
#define CBTOOLBAR_H

#define CB_USE_WXAUITOOLBAR

#ifdef CB_USE_WXTOOLBAR
#undef CB_USE_WXAUITOOLBAR
#endif

#ifdef CB_USE_WXAUITOOLBAR
#include <wx/aui/aui.h>
#else
#include <wx/toolbar.h>
#endif

class DLLIMPORT cbToolBar :
#ifdef CB_USE_WXAUITOOLBAR
    public wxAuiToolBar
#else
    public wxToolBar
#endif
{
public:
    cbToolBar(wxWindow* parent,
              wxWindowID id = wxID_ANY,
              const wxPoint& pos = wxDefaultPosition,
              const wxSize& size = wxDefaultSize,
#ifdef CB_USE_WXAUITOOLBAR
              long style = wxAUI_TB_DEFAULT_STYLE
#else
              long style = wxNO_BORDER | wxTB_HORIZONTAL
#endif
             ) :
#ifdef CB_USE_WXAUITOOLBAR
        wxAuiToolBar(parent, id, pos, size, style)
#else
        wxToolBar(parent, id, pos, size, style, wxToolBarNameStr)
#endif
    {
    }
};

#endif // CBTOOLBAR_H


I need more help, or any good idea.
This patch *JUST* for trying, and it's can not build success.

Jenna

Creating an xrc-handler should not be too hard, I will try it, if I find the time.

eranif

Instead of replacing wxToolBar with wxAUIToolBar, you could inherit from wxAuiDefaultToolBarArt and override the method:

virtual void DrawGripper( wxDC& dc, wxWindow* wnd, const wxRect& rect);

This will remove the 'ugliness' of the wxToolBar. You should also remember that wxAuiToolBar does not look native on the various themes of Ubuntu (especially the dark ones)

Eran


Loaden

Quote from: jens on September 24, 2010, 10:42:12 AM
Creating an xrc-handler should not be too hard, I will try it, if I find the time.
If it is not easy, I think we can give up xrc, just only C++ code instead?

Loaden

Quote from: eranif on September 24, 2010, 01:59:36 PM
Instead of replacing wxToolBar with wxAUIToolBar, you could inherit from wxAuiDefaultToolBarArt and override the method:

virtual void DrawGripper( wxDC& dc, wxWindow* wnd, const wxRect& rect);

This will remove the 'ugliness' of the wxToolBar. You should also remember that wxAuiToolBar does not look native on the various themes of Ubuntu (especially the dark ones)

Eran

Thank to eranif!

ironhead

Could this be extended to Windows as well?  The toolbars look OK in WinXP, but look ugly under Win7 (similar to the Ubuntu screenshots).

I noticed the SVN change was limited to Linux only...

Loaden

Quote from: ironhead on November 08, 2010, 07:27:58 PM
Could this be extended to Windows as well?  The toolbars look OK in WinXP, but look ugly under Win7 (similar to the Ubuntu screenshots).

I noticed the SVN change was limited to Linux only...
No, the SVN change just for status bar.
In Linux, the status bar is very ugly, and not the default show like other GTK2 applications.
So, I'm set the style to wxSB_FLAT, it's looks better than before.

Maybe we can find another way?

polygon7

Quote from: Loaden on September 24, 2010, 08:39:48 AM
I am trying, but is seems so hard! Because since there is currently no XRC handler for wxAuiToolBar.
My current thinking like this.

include/cbtoolbar.h
/*
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
* http://www.gnu.org/licenses/lgpl-3.0.html
*/

#ifndef CBTOOLBAR_H
#define CBTOOLBAR_H

#define CB_USE_WXAUITOOLBAR

#ifdef CB_USE_WXTOOLBAR
#undef CB_USE_WXAUITOOLBAR
#endif

#ifdef CB_USE_WXAUITOOLBAR
#include <wx/aui/aui.h>
#else
#include <wx/toolbar.h>
#endif

class DLLIMPORT cbToolBar :
#ifdef CB_USE_WXAUITOOLBAR
    public wxAuiToolBar
#else
    public wxToolBar
#endif
{
public:
    cbToolBar(wxWindow* parent,
              wxWindowID id = wxID_ANY,
              const wxPoint& pos = wxDefaultPosition,
              const wxSize& size = wxDefaultSize,
#ifdef CB_USE_WXAUITOOLBAR
              long style = wxAUI_TB_DEFAULT_STYLE
#else
              long style = wxNO_BORDER | wxTB_HORIZONTAL
#endif
             ) :
#ifdef CB_USE_WXAUITOOLBAR
        wxAuiToolBar(parent, id, pos, size, style)
#else
        wxToolBar(parent, id, pos, size, style, wxToolBarNameStr)
#endif
    {
    }
};

#endif // CBTOOLBAR_H


I need more help, or any good idea.
This patch *JUST* for trying, and it's can not build success.

Unfortunately this patch don't apply cleanly on rev. 6845 - there are problems in:

src/include/cbplugin.h
src/plugins/autosave/autosave.h
src/plugins/codecompletion/codecompletion.h

with

bool BuildToolBar(cbToolBar* /*toolBar*/)

and after hand-made modifications compilation breaks on Manager::LoadToolBar():

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../src/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../src/include -I../../src/sdk/wxscintilla/include -I../../src/sdk/wxpropgrid/include -I../../src/include/tinyxml -I../../src/include/scripting/include -I../../src/include/scripting/sqplus -I../../src/include/mozilla_chardet -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -march=k8-sse3 -O3 -fomit-frame-pointer -ftracer -ftree-vectorize -fpeel-loops -funroll-loops -fsplit-ivs-in-unroller -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT manager.lo -MD -MP -MF .deps/manager.Tpo -c manager.cpp  -fPIC -DPIC -o .libs/manager.o
manager.cpp: In static member function 'static cbToolBar* Manager::LoadToolBar(wxFrame*, wxString, bool)':
manager.cpp:276:92: error: invalid static_cast from type 'wxToolBar*' to type 'cbToolBar*'


After changing static_cast into reinterpret_cast there are another problems:

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../src/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../src/include -I../../src/sdk/wxscintilla/include -I../../src/sdk/wxpropgrid/include -I../../src/include/tinyxml -I../../src/include/scripting/include -I../../src/include/scripting/sqplus -I../../src/include/mozilla_chardet -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -march=k8-sse3 -O3 -fomit-frame-pointer -ftracer -ftree-vectorize -fpeel-loops -funroll-loops -fsplit-ivs-in-unroller -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT CharDistribution.lo -MD -MP -MF .deps/CharDistribution.Tpo -c mozilla_chardet/src/CharDistribution.cpp  -fPIC -DPIC -o .libs/CharDistribution.o
xtra_res.cpp: In member function 'virtual wxObject* cbToolBarAddOnXmlHandler::DoCreateResource()':
xtra_res.cpp:114:55: error: no matching function for call to 'cbToolBar::AddTool(int, wxBitmap, wxBitmap, bool, int, int, NULL, wxString, wxString)'
/usr/include/wx-2.8/wx/aui/auibar.h:438:10: note: candidates are: void wxAuiToolBar::AddTool(int, const wxString&, const wxBitmap&, const wxString&, wxItemKind)
/usr/include/wx-2.8/wx/aui/auibar.h:444:10: note:                 void wxAuiToolBar::AddTool(int, const wxString&, const wxBitmap&, const wxBitmap&, wxItemKind, const wxString&, const wxString&, wxObject*)
/usr/include/wx-2.8/wx/aui/auibar.h:453:10: note:                 void wxAuiToolBar::AddTool(int, const wxBitmap&, const wxBitmap&, bool, wxObject*, const wxString&, const wxString&)
xtra_res.cpp:138:55: error: no matching function for call to 'cbToolBar::AddTool(int, wxString, wxBitmap, wxBitmap, wxItemKind&, wxString, wxString)'
/usr/include/wx-2.8/wx/aui/auibar.h:438:10: note: candidates are: void wxAuiToolBar::AddTool(int, const wxString&, const wxBitmap&, const wxString&, wxItemKind)
/usr/include/wx-2.8/wx/aui/auibar.h:444:10: note:                 void wxAuiToolBar::AddTool(int, const wxString&, const wxBitmap&, const wxBitmap&, wxItemKind, const wxString&, const wxString&, wxObject*)
/usr/include/wx-2.8/wx/aui/auibar.h:453:10: note:                 void wxAuiToolBar::AddTool(int, const wxBitmap&, const wxBitmap&, bool, wxObject*, const wxString&, const wxString&)
xtra_res.cpp:170:13: error: no matching function for call to 'cbToolBar::cbToolBar()'
./cbtoolbar.h:29:5: note: candidates are: cbToolBar::cbToolBar(wxWindow*, wxWindowID, const wxPoint&, const wxSize&, long int)
./cbtoolbar.h:27:1: note:                 cbToolBar::cbToolBar(const cbToolBar&)
xtra_res.cpp:177:39: error: no matching function for call to 'cbToolBar::Create(wxWindow*&, int, wxPoint, wxSize, int&, wxString)'
/usr/include/wx-2.8/wx/gtk/control.h:40:10: note: candidate is: bool wxControl::Create(wxWindow*, wxWindowID, const wxPoint&, const wxSize&, long int, const wxValidator&, const wxString&)
xtra_res.cpp:233:52: error: no matching function for call to 'wxFrame::SetToolBar(cbToolBar*&)'
/usr/include/wx-2.8/wx/gtk/frame.h:69:10: note: candidate is: virtual void wxFrame::SetToolBar(wxToolBar*)


Arch Linux, g++ (GCC) 4.5.1, wx 2.8.11, C::B rev. 6845

best regards,
p7
Free open source UML modeling tool: ArgoUML