Author Topic: Instead wxToolBar by wxAuiToolBar ?  (Read 15544 times)

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Instead wxToolBar by wxAuiToolBar ?
« on: August 22, 2010, 03:00:44 pm »
In Ubuntu 10.4, the wxToolBar is very ugly.

So, why not instead by wxAuiToolBar ?

Any comments are welcome ?
« Last Edit: August 22, 2010, 03:07:18 pm by Loaden »

Offline thynson

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Instead wxToolBar by wxAuiToolBar ?
« Reply #1 on: September 14, 2010, 10:46:59 pm »
Agreed. I remember that I used to complained for it in "Using codeblocks" forum.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Instead wxToolBar by wxAuiToolBar ?
« Reply #2 on: September 15, 2010, 06:55:53 am »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Instead wxToolBar by wxAuiToolBar ?
« Reply #3 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
Code
/*
 * 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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Instead wxToolBar by wxAuiToolBar ?
« Reply #4 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.

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: Instead wxToolBar by wxAuiToolBar ?
« Reply #5 on: September 24, 2010, 01:59:36 pm »
Instead of replacing wxToolBar with wxAUIToolBar, you could inherit from wxAuiDefaultToolBarArt and override the method:

Code
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


Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Instead wxToolBar by wxAuiToolBar ?
« Reply #6 on: November 08, 2010, 05:30:27 pm »
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?

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Instead wxToolBar by wxAuiToolBar ?
« Reply #7 on: November 08, 2010, 05:31:16 pm »
Instead of replacing wxToolBar with wxAUIToolBar, you could inherit from wxAuiDefaultToolBarArt and override the method:

Code
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!

Offline ironhead

  • Almost regular
  • **
  • Posts: 210
Re: Instead wxToolBar by wxAuiToolBar ?
« Reply #8 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...

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Instead wxToolBar by wxAuiToolBar ?
« Reply #9 on: November 09, 2010, 01:04:51 am »
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?

Offline polygon7

  • Multiple posting newcomer
  • *
  • Posts: 104
    • Home site
Re: Instead wxToolBar by wxAuiToolBar ?
« Reply #10 on: November 12, 2010, 08:53:24 pm »
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
Code
/*
 * 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:
Code
src/include/cbplugin.h
src/plugins/autosave/autosave.h
src/plugins/codecompletion/codecompletion.h
with
Code
bool BuildToolBar(cbToolBar* /*toolBar*/)
and after hand-made modifications compilation breaks on Manager::LoadToolBar():
Code
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:
Code
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