wxoo.wxcontrolcontainer
index
p:\wxproperties\wxoo\wxcontrolcontainer.py

Implementation of explicitly-set tabbing-order windows

 
Modules
       
clip_dndc
cmndlgsc
controls2c
controlsc
eventsc
filesysc
fontsc
framesc
gdic
imagec
mdic
misc2c
miscc
printfwc
sizersc
stattoolc
streamsc
sys
types
utilsc
weakref
windows2c
windows3c
windowsc
wxPython.wx
wxPython.wxc

 
Classes
       
ContainerWindow
HolderFrame(ContainerWindow, wxFrame)
wxControlContainer
ControlContainer

 
class ContainerWindow
    Mix-in class for interacting with a control container object
 
This class can be mixed-in with wxWindow classes in order
to interact with a ControlContainer.  You must call
 
        ContainerWindow.__init__(self)
        
in order to activate the ContainerWindow functionality.
 
The other major method of note is:
 
        GetControlContainer()
 
which returns a pointer to the current container object.
 
  Methods defined here:
GetControlContainer(self)
Get the current control-container object
GetDefaultItem(self)
return container.GetDefaultItem()
OnChildFocus(self, focusEvent)
container.SetLastFocus
OnFocus(self, focusEvent)
container.HandleOnFocus
OnNavigationKey(self, navigationKeyEvent)
container.HandleOnNavigationKey
RemoveChild(self, childWindow)
container.HandleOnWindowDestroy(child), then base
SetControlContainer(self, value)
Set the current control-container object
SetDefaultItem(self, childWindow)
container.SetDefaultItem(childWindow)
SetFocus(self)
container.DoSetFocus(), calls base SetFocus if that returns false
SetTmpDefaultItem(self, childWindow)
container.SetTmpDefaultItem(childWindow)
__init__(self)
Initialize the ContainerWindow functionality
 
Note:
        This method must be called to establish the
        ContainerWindow functionality!

Data and other attributes defined here:
controlContainerClass = <class wxoo.wxcontrolcontainer.ControlContainer at 0x012BD720>
ControlContainer with ability to explicitly specify tab-order
 
This is a wxoo-specific tabbing-order control
container object.  It provides a simple mechanism
for explicitly setting the focus set through
which keyboard navigation will traverse.
 
XXX Should have API for manipulating the list:
 
        AppendFocusItem
        RemoveFocusItem
        InsertFocusItem
 
or
 
        Have GetFocusChildren set the focus children
        on default get to allow for direct manipulation
        of the list.  However, this is ideologically
        fuzzy, because it is not immediately clear
        whether the focus children should then be the
        whole children set, or merely an empty list
        to begin with.

 
class ControlContainer(wxControlContainer)
    ControlContainer with ability to explicitly specify tab-order
 
This is a wxoo-specific tabbing-order control
container object.  It provides a simple mechanism
for explicitly setting the focus set through
which keyboard navigation will traverse.
 
XXX Should have API for manipulating the list:
 
        AppendFocusItem
        RemoveFocusItem
        InsertFocusItem
 
or
 
        Have GetFocusChildren set the focus children
        on default get to allow for direct manipulation
        of the list.  However, this is ideologically
        fuzzy, because it is not immediately clear
        whether the focus children should then be the
        whole children set, or merely an empty list
        to begin with.
 
  Methods defined here:
GetFocusChildren(self)
Retrive or calculate our focus children set
 
If SetFocusChildren has not already been called
this will return GetChildren(), i.e. a list
of the top-level children of our containerWindow
SetFocusChildren(self, set=None)
Set our focus-children set
 
A copy is taken, and only top-level windows
are eligible, so don't specify multiple children
of a single direct child.
 
Errors will be raised if any child in the set
is not a child of our containerWindow
findFocusIndex(self, child)
Find the index of a given child window in the focus set
 
This method adds the ability to determine a proper
index even if the child is not a member of our focus
group, but is a member of our children.
 
XXX There are problems with reverse traversal, as the
        algorithm will wind up skipping the item before
        the current control if the child is not a member,
        as the index is reported as the index of the
        previous control.
        
if an index can't be found, returns 0

Methods inherited from wxControlContainer:
AcceptsFocusFromKeyboard(self, window)
Determine whether a given window would accept focus
DoSetFocus(self)
Do the actual work of a SetFocus on containerWindow
 
return boolean whether or not we have now got focus
GetChildren(self)
Customization point: Retrieve the sequence of children
GetContainerWindow(self)
Get the container window
GetDefaultItem(self)
Get the (permanent) default child window
HandleOnFocus(self, event)
Handle a focus-event
HandleOnNavigationKey(self, event)
Handle a navigation-key-event
 
This is where the "magic" occurs:
HandleOnWindowDestroy(self, childWindow)
Handle destruction of one of our children
RestoreFocus(self)
Attempt to set focus to the last-held or "first" child
 
This is used to "restore" focus to the container's child,
using the first child as a default
 
part of wxSetFocusToChild in the C++ code
SetContainerWindow(self, containerWindow)
Set the container window for the container
SetDefaultItem(self, childWindow)
Set the (permanent) default child window
 
returns previous default item
SetFocusFirst(self)
Attempt to set focus to First child in our container-set
 
part of wxSetFocusToChild in the C++ code
SetFocusLast(self)
Attempt to set focus to First child in our container-set
 
part of wxSetFocusToChild in the C++ code
SetFocusNext(self, event)
Set focus to the next item in focusChildren
 
event gives us direction, as well as potentially
the focus-child which is driving our choice to change
SetFocusToChild(self)
Called to restore focus to our parent
 
try to RestoreFocus, if that's not possible,
try to SetFocusFirst
 
return whether we changed the focus
SetLastFocus(self, childWindow)
Store reference to the window so that restoring focus comes back to it
SetTmpDefaultItem(self, childWindow=None)
Set the (temporary) default child window
__init__(self, containerWindow)
Initialize the control container
childHandleFocus(self, child, event)
Ask a particular child if it would like to handle this event
 
return 1 if the event was handled
getImmediateChild(self, grandChild, top)
Get the ancestor of grandChild which is an immediate child of top
parentHandleFocus(self, event)
Ask our parents if they want to handle this event
 
Called by SetFocusNext if it gets to either end of the
focus-children list without finding a taker.
 
return whether a parent has processed the event

 
class HolderFrame(ContainerWindow, wxFrame)
    Simple demonstration of a composite frame sub-class
 
 
Method resolution order:
HolderFrame
ContainerWindow
wxFrame
wxFramePtr
wxTopLevelWindowPtr
wxWindowPtr
wxEvtHandlerPtr
wxObjectPtr

Methods defined here:
__init__(self, parent=None, id=-1, title='', pos=wxPoint(-1, -1), size=wxSize(-1, -1), style=541593152, name='holderframe')

Methods inherited from ContainerWindow:
GetControlContainer(self)
Get the current control-container object
GetDefaultItem(self)
return container.GetDefaultItem()
OnChildFocus(self, focusEvent)
container.SetLastFocus
OnFocus(self, focusEvent)
container.HandleOnFocus
OnNavigationKey(self, navigationKeyEvent)
container.HandleOnNavigationKey
RemoveChild(self, childWindow)
container.HandleOnWindowDestroy(child), then base
SetControlContainer(self, value)
Set the current control-container object
SetDefaultItem(self, childWindow)
container.SetDefaultItem(childWindow)
SetFocus(self)
container.DoSetFocus(), calls base SetFocus if that returns false
SetTmpDefaultItem(self, childWindow)
container.SetTmpDefaultItem(childWindow)

Data and other attributes inherited from ContainerWindow:
controlContainerClass = <class wxoo.wxcontrolcontainer.ControlContainer at 0x012BD720>
ControlContainer with ability to explicitly specify tab-order
 
This is a wxoo-specific tabbing-order control
container object.  It provides a simple mechanism
for explicitly setting the focus set through
which keyboard navigation will traverse.
 
XXX Should have API for manipulating the list:
 
        AppendFocusItem
        RemoveFocusItem
        InsertFocusItem
 
or
 
        Have GetFocusChildren set the focus children
        on default get to allow for direct manipulation
        of the list.  However, this is ideologically
        fuzzy, because it is not immediately clear
        whether the focus children should then be the
        whole children set, or merely an empty list
        to begin with.

Methods inherited from wxFramePtr:
Command = ProcessCommand(self, *_args, **_kwargs)
Create(self, *_args, **_kwargs)
CreateStatusBar(self, *_args, **_kwargs)
CreateToolBar(self, *_args, **_kwargs)
DoGiveHelp(self, *_args, **_kwargs)
GetClientAreaOrigin(self, *_args, **_kwargs)
GetMenuBar(self, *_args, **_kwargs)
GetStatusBar(self, *_args, **_kwargs)
GetStatusBarPane(self, *_args, **_kwargs)
GetToolBar(self, *_args, **_kwargs)
PopStatusText(self, *_args, **_kwargs)
ProcessCommand(self, *_args, **_kwargs)
PushStatusText(self, *_args, **_kwargs)
SendSizeEvent(self, *_args, **_kwargs)
SetMenuBar(self, *_args, **_kwargs)
SetStatusBar(self, *_args, **_kwargs)
SetStatusBarPane(self, *_args, **_kwargs)
SetStatusText(self, *_args, **_kwargs)
SetStatusWidths(self, *_args, **_kwargs)
SetToolBar(self, *_args, **_kwargs)
__repr__(self)

Methods inherited from wxTopLevelWindowPtr:
GetIcon(self, *_args, **_kwargs)
GetTitle(self, *_args, **_kwargs)
Iconize(self, *_args, **_kwargs)
IsFullScreen(self, *_args, **_kwargs)
IsIconized(self, *_args, **_kwargs)
IsMaximized(self, *_args, **_kwargs)
Maximize(self, *_args, **_kwargs)
Restore(self, *_args, **_kwargs)
SetIcon(self, *_args, **_kwargs)
SetIcons(self, *_args, **_kwargs)
SetShape(self, *_args, **_kwargs)
SetTitle(self, *_args, **_kwargs)
ShowFullScreen(self, *_args, **_kwargs)

Methods inherited from wxWindowPtr:
AcceptsFocus(self, *_args, **_kwargs)
AddChild(self, *_args, **_kwargs)
CaptureMouse(self, *_args, **_kwargs)
Center(self, *_args, **_kwargs)
CenterOnParent(self, *_args, **_kwargs)
CenterOnScreen(self, *_args, **_kwargs)
Centre(self, *_args, **_kwargs)
CentreOnParent(self, *_args, **_kwargs)
CentreOnScreen(self, *_args, **_kwargs)
Clear(self, *_args, **_kwargs)
ClientToScreen(self, *_args, **_kwargs)
ClientToScreenXY(self, *_args, **_kwargs)
Close(self, *_args, **_kwargs)
ConvertDialogPointToPixels(self, *_args, **_kwargs)
ConvertDialogSizeToPixels(self, *_args, **_kwargs)
ConvertPixelPointToDialog(self, *_args, **_kwargs)
ConvertPixelSizeToDialog(self, *_args, **_kwargs)
DLG_PNT(self, *_args, **_kwargs)
DLG_SZE(self, *_args, **_kwargs)
Destroy(self, *_args, **_kwargs)
DestroyChildren(self, *_args, **_kwargs)
Disable(self, *_args, **_kwargs)
DragAcceptFiles(self, *_args, **_kwargs)
Enable(self, *_args, **_kwargs)
FindWindowById(self, *_args, **_kwargs)
FindWindowByName(self, *_args, **_kwargs)
Fit(self, *_args, **_kwargs)
FitInside(self, *_args, **_kwargs)
Freeze(self, *_args, **_kwargs)
GetAcceleratorTable(self, *_args, **_kwargs)
GetAdjustedBestSize(self, *_args, **_kwargs)
GetAutoLayout(self, *_args, **_kwargs)
GetBackgroundColour(self, *_args, **_kwargs)
GetBestSize(self, *_args, **_kwargs)
GetBestVirtualSize(self, *_args, **_kwargs)
GetBorder(self, *_args, **_kwargs)
GetCaret(self, *_args, **_kwargs)
# replaces broken shadow method
GetCharHeight(self, *_args, **_kwargs)
GetCharWidth(self, *_args, **_kwargs)
GetChildren(self, *_args, **_kwargs)
GetClientRect(self, *_args, **_kwargs)
GetClientSize(self, *_args, **_kwargs)
GetClientSizeTuple(self, *_args, **_kwargs)
GetConstraints(self, *_args, **_kwargs)
GetContainingSizer(self, *_args, **_kwargs)
GetCursor(self, *_args, **_kwargs)
GetDropTarget(self, *_args, **_kwargs)
GetEventHandler(self, *_args, **_kwargs)
GetFont(self, *_args, **_kwargs)
GetForegroundColour(self, *_args, **_kwargs)
GetFullTextExtent(self, *_args, **_kwargs)
GetGrandParent(self, *_args, **_kwargs)
GetHandle(self, *_args, **_kwargs)
GetHelpText(self, *_args, **_kwargs)
GetId(self, *_args, **_kwargs)
GetLabel(self, *_args, **_kwargs)
GetMaxSize(self, *_args, **_kwargs)
GetName(self, *_args, **_kwargs)
GetParent(self, *_args, **_kwargs)
GetPosition(self, *_args, **_kwargs)
GetPositionTuple(self, *_args, **_kwargs)
GetRect(self, *_args, **_kwargs)
GetScrollPos(self, *_args, **_kwargs)
GetScrollRange(self, *_args, **_kwargs)
GetScrollThumb(self, *_args, **_kwargs)
GetSize(self, *_args, **_kwargs)
GetSizeTuple(self, *_args, **_kwargs)
GetSizer(self, *_args, **_kwargs)
GetTextExtent(self, *_args, **_kwargs)
GetThemeEnabled(self, *_args, **_kwargs)
GetToolTip(self, *_args, **_kwargs)
GetUpdateRegion(self, *_args, **_kwargs)
GetValidator(self, *_args, **_kwargs)
GetVirtualSize(self, *_args, **_kwargs)
GetVirtualSizeTuple(self, *_args, **_kwargs)
GetWindowStyleFlag(self, *_args, **_kwargs)
HasCapture(self, *_args, **_kwargs)
HasScrollbar(self, *_args, **_kwargs)
Hide(self, *_args, **_kwargs)
HitTest(self, *_args, **_kwargs)
InitDialog(self, *_args, **_kwargs)
IsBeingDeleted(self, *_args, **_kwargs)
IsEnabled(self, *_args, **_kwargs)
IsExposed(self, *_args, **_kwargs)
IsExposedPoint(self, *_args, **_kwargs)
IsExposedRect(self, *_args, **_kwargs)
IsRetained(self, *_args, **_kwargs)
IsShown(self, *_args, **_kwargs)
IsTopLevel(self, *_args, **_kwargs)
Layout(self, *_args, **_kwargs)
LineDown(self, *_args, **_kwargs)
LineUp(self, *_args, **_kwargs)
Lower(self, *_args, **_kwargs)
MakeModal(self, *_args, **_kwargs)
Move(self, *_args, **_kwargs)
MoveXY(self, *_args, **_kwargs)
OnPaint(self, *_args, **_kwargs)
PageDown(self, *_args, **_kwargs)
PageUp(self, *_args, **_kwargs)
PopEventHandler(self, *_args, **_kwargs)
PopupMenu(self, *_args, **_kwargs)
PopupMenuXY(self, *_args, **_kwargs)
PushEventHandler(self, *_args, **_kwargs)
Raise(self, *_args, **_kwargs)
Refresh(self, *_args, **_kwargs)
RefreshRect(self, *_args, **_kwargs)
ReleaseMouse(self, *_args, **_kwargs)
RemoveEventHandler(self, *_args, **_kwargs)
Reparent(self, *_args, **_kwargs)
ScreenToClient(self, *_args, **_kwargs)
ScreenToClientXY(self, *_args, **_kwargs)
ScrollLines(self, *_args, **_kwargs)
ScrollPages(self, *_args, **_kwargs)
ScrollWindow(self, *_args, **_kwargs)
SetAcceleratorTable(self, *_args, **_kwargs)
SetAutoLayout(self, *_args, **_kwargs)
SetBackgroundColour(self, *_args, **_kwargs)
SetCaret(self, *_args, **_kwargs)
SetClientSize(self, *_args, **_kwargs)
SetClientSizeWH(self, *_args, **_kwargs)
SetConstraints(self, *_args, **_kwargs)
SetContainingSizer(self, *_args, **_kwargs)
SetCursor(self, *_args, **_kwargs)
SetDimensions(self, *_args, **_kwargs)
SetDropTarget(self, *_args, **_kwargs)
SetEventHandler(self, *_args, **_kwargs)
SetExtraStyle(self, *_args, **_kwargs)
SetFocusFromKbd(self, *_args, **_kwargs)
SetFont(self, *_args, **_kwargs)
SetForegroundColour(self, *_args, **_kwargs)
SetHelpText(self, *_args, **_kwargs)
SetHelpTextForId(self, *_args, **_kwargs)
SetId(self, *_args, **_kwargs)
SetLabel(self, *_args, **_kwargs)
SetName(self, *_args, **_kwargs)
SetPosition(self, *_args, **_kwargs)
SetRect(self, *_args, **_kwargs)
SetScrollPos(self, *_args, **_kwargs)
SetScrollbar(self, *_args, **_kwargs)
SetSize(self, *_args, **_kwargs)
SetSizeHints(self, *_args, **_kwargs)
SetSizer(self, *_args, **_kwargs)
SetSizerAndFit(self, *_args, **_kwargs)
SetThemeEnabled(self, *_args, **_kwargs)
SetToolTip(self, *_args, **_kwargs)
SetToolTipString(self, *_args, **_kwargs)
SetValidator(self, *_args, **_kwargs)
SetVirtualSize(self, *_args, **_kwargs)
SetVirtualSizeHints(self, *_args, **_kwargs)
SetVirtualSizeWH(self, *_args, **_kwargs)
SetWindowStyle(self, *_args, **_kwargs)
SetWindowStyleFlag(self, *_args, **_kwargs)
Show(self, *_args, **_kwargs)
Thaw(self, *_args, **_kwargs)
TransferDataFromWindow(self, *_args, **_kwargs)
TransferDataToWindow(self, *_args, **_kwargs)
UnsetConstraints(self, *_args, **_kwargs)
Update(self, *_args, **_kwargs)
UpdateWindowUI(self, *_args, **_kwargs)
Validate(self, *_args, **_kwargs)
WarpPointer(self, *_args, **_kwargs)

Methods inherited from wxEvtHandlerPtr:
AddPendingEvent(self, *_args, **_kwargs)
Connect(self, *_args, **_kwargs)
Disconnect(self, *_args, **_kwargs)
GetEvtHandlerEnabled(self, *_args, **_kwargs)
GetNextHandler(self, *_args, **_kwargs)
GetPreviousHandler(self, *_args, **_kwargs)
ProcessEvent(self, *_args, **_kwargs)
SetEvtHandlerEnabled(self, *_args, **_kwargs)
SetNextHandler(self, *_args, **_kwargs)
SetPreviousHandler(self, *_args, **_kwargs)

Methods inherited from wxObjectPtr:
GetClassName(self, *_args, **_kwargs)

 
class wxControlContainer
    A helper object used by container-type windows
 
About the Name:
 
        You may notice that wxControlContainer is an anomaly
        in its naming (wxoo does not normally use wx prefixes)
 
        This was done to emphasize that the wxControlContainer
        class is a simple reimplementation of the C++ version.
        In effect, subclassing wxControlContainer gives you
        something that should be indistinguishable from the
        wxWindows wxControlContainer C++ class.
        
        Hopefully, at some point in time, wxControlContainer
        (the C++ version) will be exposed, with some
        refactoring, making this Python version obsolete.
 
wxControlContainer is (according to the C++ code)
almost-a-mix-in (I consider the pattern "helper").
There are macros provided that allow particular window
classes to declare and implement support for
wxControlContainer operation.
 
See ContainerWindow below for a mix-in for wxPython
window classes that does the same work as those macros.
 
  Methods defined here:
AcceptsFocusFromKeyboard(self, window)
Determine whether a given window would accept focus
DoSetFocus(self)
Do the actual work of a SetFocus on containerWindow
 
return boolean whether or not we have now got focus
GetChildren(self)
Customization point: Retrieve the sequence of children
GetContainerWindow(self)
Get the container window
GetDefaultItem(self)
Get the (permanent) default child window
GetFocusChildren = GetChildren(self)
HandleOnFocus(self, event)
Handle a focus-event
HandleOnNavigationKey(self, event)
Handle a navigation-key-event
 
This is where the "magic" occurs:
HandleOnWindowDestroy(self, childWindow)
Handle destruction of one of our children
RestoreFocus(self)
Attempt to set focus to the last-held or "first" child
 
This is used to "restore" focus to the container's child,
using the first child as a default
 
part of wxSetFocusToChild in the C++ code
SetContainerWindow(self, containerWindow)
Set the container window for the container
SetDefaultItem(self, childWindow)
Set the (permanent) default child window
 
returns previous default item
SetFocusFirst(self)
Attempt to set focus to First child in our container-set
 
part of wxSetFocusToChild in the C++ code
SetFocusLast(self)
Attempt to set focus to First child in our container-set
 
part of wxSetFocusToChild in the C++ code
SetFocusNext(self, event)
Set focus to the next item in focusChildren
 
event gives us direction, as well as potentially
the focus-child which is driving our choice to change
SetFocusToChild(self)
Called to restore focus to our parent
 
try to RestoreFocus, if that's not possible,
try to SetFocusFirst
 
return whether we changed the focus
SetLastFocus(self, childWindow)
Store reference to the window so that restoring focus comes back to it
SetTmpDefaultItem(self, childWindow=None)
Set the (temporary) default child window
__init__(self, containerWindow)
Initialize the control container
childHandleFocus(self, child, event)
Ask a particular child if it would like to handle this event
 
return 1 if the event was handled
findFocusIndex(self, child)
Find the index of a given child window in the focus set
 
Note: the child may not exist in the focus sub-set,
so sub-classes have to have logic for determining
a focus-set-index for items that only appear in the
children-set.
 
if an index can't be found, return 0
getImmediateChild(self, grandChild, top)
Get the ancestor of grandChild which is an immediate child of top
parentHandleFocus(self, event)
Ask our parents if they want to handle this event
 
Called by SetFocusNext if it gets to either end of the
focus-children list without finding a taker.
 
return whether a parent has processed the event