wxSizerItem used for painted (solid) areas

ATS asteinarson at gmail.com
Sat Mar 15 09:27:14 PDT 2008


[discussion related to patch [ 1906333 ] wxSizerItem - IsEmptySpace]

I posted two images showing the clariying the whole thing on 
patch tracker: 

http://sourceforge.net/tracker/index.php?func=detail&aid=1906333&group_id=9863&atid=309863

(Images: GrippersOnWrappedToolbar.png and SolidSpacers.png)


The basic idea is:

- wxSizerItem in spacer mode can represent either

  A - An empty area (this is the implicit assumption
      in wxWidgets).

  B - An area that is painted in some other way. 
      It is not a wxWindow and not a wxSizer but 
      still painted on screen (despite being referred
      to as a spacer).

Type B items are very useful for representing small bits 
and pieces like grippers, edges and micros buttons. Using 
a wxWindow for each such item is too heavy and really not 
needed. 

Of course, at the root of the wxSizer tree (a full layout) 
there is a layout manager that must take care of painting 
these items. 

Now... putting spacers items into a wxWrapSizer we see that
items of type A should be peeled off (when first or last on 
a line). 

Items of type B should stay in the sizer also when first 
or last on the line. 


So there needs to be some method to determine if an item 
is empty or painted. Hence the new virtual method 

  wxSizerItem::IsEmptySpace( ).


And, no, it's not likely to be used by other sizers like 
box sizers. But, without this mechanism it's difficult to 
use wxWrapSizer in the context it was designed for. 


Hope this clarifies things.

Regards
// ATS. 






More information about the wx-dev mailing list