Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Proposed rule "Do not include wx/wx.h inside the Code::Blocks SDK headers."

<< < (2/5) > >>

killerbot:
yes, because sdk.h/CB_PRECOMP handles the precompiled headers for CB sdk and wx.
You could do wx independently, but it's better to be do like CB itself.

Or even (better) : no pch  8) 8) 8) 8) :mrgreen: :mrgreen: :mrgreen:

killerbot:
@Tim : on a quick look, why all those includes of wx/frame.h ??

EDIT :

The only thing I can think of is the calls to Manager::Get()->GetAppWindow() return a wxFrame*, and are then handed over to methods that (probably) require a wxWindow*.

And since no include of wx/frame.h, nobody can tell wxFrame inherits from wxWindow.

IF this is the reason I see some other/better fixes :

- everywhere cast to wxWindow*  (don't like this one : ugly)
- have Manager::Get()->GetAppWindow() return a wxWindow*, then it is more in synch with the name !!! And I feel for most uses it will be ok.

dje:

--- Quote from: killerbot on August 13, 2007, 11:26:31 pm ---yes, because sdk.h/CB_PRECOMP handles the precompiled headers for CB sdk and wx.
You could do wx independently, but it's better to be do like CB itself.

--- End quote ---

Ok, just a little preprocessing overhead...

stahta01:

--- Quote from: killerbot on August 13, 2007, 11:27:21 pm ---@Tim : on a quick look, why all those includes of wx/frame.h ??

EDIT :

The only thing I can think of is the calls to Manager::Get()->GetAppWindow() return a wxFrame*, and are then handed over to methods that (probably) require a wxWindow*.

And since no include of wx/frame.h, nobody can tell wxFrame inherits from wxWindow.

IF this is the reason I see some other/better fixes :

- everywhere cast to wxWindow*  (don't like this one : ugly)
- have Manager::Get()->GetAppWindow() return a wxWindow*, then it is more in synch with the name !!! And I feel for most uses it will be ok.

--- End quote ---

At least 75% of them was because of wxFrame to wxWindow conversion.

Edit: I have no idea about "Manager::Get()->GetAppWindow() return a wxWindow*" , I am still not knowledgeable enough about C:B and C++ to have an informed guess on it. But, I think the "cast to wxWindow*" looks ugly to me, also.

It violates the rules I am thinking of, but we could add an include of wx/frame.h to manager.h which declares GetAppWindow.

Tim S

stahta01:

--- Quote from: stahta01 on August 13, 2007, 11:44:33 pm ---It violates the rules I am thinking of, but we could add an include of wx/frame.h to manager.h which declares GetAppWindow.
Tim S

--- End quote ---

I am going to re-write my patch by adding an include of wx/frame.h to manager.h; this looks like the best solution to me.

Tim S

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version