mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 01:30:07 +01:00
Phoenix:
- Add support for `wx.adv.OwnerDrawnComboBox` and `wx.ComboCtrl` in the documentation building process. Add the appropriate samples as well (and wonder why the sample in `wx.ComboCtrl` doesn't get properly highlighted...). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71669 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
BIN
docs/sphinx/_static/images/widgets/fullsize/wxgtk/comboctrl.png
Normal file
BIN
docs/sphinx/_static/images/widgets/fullsize/wxgtk/comboctrl.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 438 B |
BIN
docs/sphinx/_static/images/widgets/fullsize/wxmac/comboctrl.png
Normal file
BIN
docs/sphinx/_static/images/widgets/fullsize/wxmac/comboctrl.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
docs/sphinx/_static/images/widgets/fullsize/wxmsw/comboctrl.png
Normal file
BIN
docs/sphinx/_static/images/widgets/fullsize/wxmsw/comboctrl.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
@@ -0,0 +1,107 @@
|
||||
"""
|
||||
A simple test case for wx.ComboCtrl using a wx.ListCtrl for the popup
|
||||
"""
|
||||
|
||||
import wx
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# This class is used to provide an interface between a ComboCtrl and the
|
||||
# ListCtrl that is used as the popoup for the combo widget.
|
||||
|
||||
class ListCtrlComboPopup(wx.ComboPopup):
|
||||
|
||||
def __init__(self):
|
||||
wx.ComboPopup.__init__(self)
|
||||
self.lc = None
|
||||
|
||||
def AddItem(self, txt):
|
||||
self.lc.InsertItem(self.lc.GetItemCount(), txt)
|
||||
|
||||
def OnMotion(self, evt):
|
||||
item, flags = self.lc.HitTest(evt.GetPosition())
|
||||
if item >= 0:
|
||||
self.lc.Select(item)
|
||||
self.curitem = item
|
||||
|
||||
def OnLeftDown(self, evt):
|
||||
self.value = self.curitem
|
||||
self.Dismiss()
|
||||
|
||||
|
||||
# The following methods are those that are overridable from the
|
||||
# ComboPopup base class. Most of them are not required, but all
|
||||
# are shown here for demonstration purposes.
|
||||
|
||||
# This is called immediately after construction finishes. You can
|
||||
# use self.GetCombo if needed to get to the ComboCtrl instance.
|
||||
def Init(self):
|
||||
self.value = -1
|
||||
self.curitem = -1
|
||||
|
||||
# Create the popup child control. Return true for success.
|
||||
def Create(self, parent):
|
||||
self.lc = wx.ListCtrl(parent, style=wx.LC_LIST|wx.LC_SINGLE_SEL|wx.SIMPLE_BORDER)
|
||||
self.lc.Bind(wx.EVT_MOTION, self.OnMotion)
|
||||
self.lc.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
|
||||
return True
|
||||
|
||||
# Return the widget that is to be used for the popup
|
||||
def GetControl(self):
|
||||
return self.lc
|
||||
|
||||
# Called just prior to displaying the popup, you can use it to
|
||||
# 'select' the current item.
|
||||
def SetStringValue(self, val):
|
||||
idx = self.lc.FindItem(-1, val)
|
||||
if idx != wx.NOT_FOUND:
|
||||
self.lc.Select(idx)
|
||||
|
||||
# Return a string representation of the current item.
|
||||
def GetStringValue(self):
|
||||
if self.value >= 0:
|
||||
return self.lc.GetItemText(self.value)
|
||||
return ""
|
||||
|
||||
# Called immediately after the popup is shown
|
||||
def OnPopup(self):
|
||||
wx.ComboPopup.OnPopup(self)
|
||||
|
||||
# Called when popup is dismissed
|
||||
def OnDismiss(self):
|
||||
wx.ComboPopup.OnDismiss(self)
|
||||
|
||||
# This is called to custom paint in the combo control itself
|
||||
# (ie. not the popup). Default implementation draws value as
|
||||
# string.
|
||||
def PaintComboControl(self, dc, rect):
|
||||
wx.ComboPopup.PaintComboControl(self, dc, rect)
|
||||
|
||||
# Receives key events from the parent ComboCtrl. Events not
|
||||
# handled should be skipped, as usual.
|
||||
def OnComboKeyEvent(self, event):
|
||||
wx.ComboPopup.OnComboKeyEvent(self, event)
|
||||
|
||||
# Implement if you need to support special action when user
|
||||
# double-clicks on the parent wxComboCtrl.
|
||||
def OnComboDoubleClick(self):
|
||||
wx.ComboPopup.OnComboDoubleClick(self)
|
||||
|
||||
# Return final size of popup. Called on every popup, just prior to OnPopup.
|
||||
# minWidth = preferred minimum width for window
|
||||
# prefHeight = preferred height. Only applies if > 0,
|
||||
# maxHeight = max height for window, as limited by screen size
|
||||
# and should only be rounded down, if necessary.
|
||||
def GetAdjustedSize(self, minWidth, prefHeight, maxHeight):
|
||||
return wx.ComboPopup.GetAdjustedSize(self, minWidth, prefHeight, maxHeight)
|
||||
|
||||
# Return true if you want delay the call to Create until the popup
|
||||
# is shown for the first time. It is more efficient, but note that
|
||||
# it is often more convenient to have the control created
|
||||
# immediately.
|
||||
# Default returns false.
|
||||
def LazyCreate(self):
|
||||
return wx.ComboPopup.LazyCreate(self)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
comboCtrl = wx.ComboCtrl(self, wx.ID_ANY, "")
|
||||
|
||||
popupCtrl = wx.ListViewComboPopup()
|
||||
|
||||
# It is important to call SetPopupControl() as soon as possible
|
||||
comboCtrl.SetPopupControl(popupCtrl)
|
||||
|
||||
# Populate using wx.ListView methods
|
||||
popupCtrl.InsertItem(popupCtrl.GetItemCount(), "First Item")
|
||||
popupCtrl.InsertItem(popupCtrl.GetItemCount(), "Second Item")
|
||||
popupCtrl.InsertItem(popupCtrl.GetItemCount(), "Third Item")
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
comboCtrl = wx.ComboCtrl()
|
||||
|
||||
# Let's make the text right-aligned
|
||||
comboCtrl.SetTextCtrlStyle(wx.TE_RIGHT)
|
||||
|
||||
comboCtrl.Create(parent, wx.ID_ANY, "")
|
||||
@@ -2149,6 +2149,10 @@ class XMLDocString(object):
|
||||
name = function.pyName or function.name
|
||||
fullname = self.current_module + 'functions.%s'%name
|
||||
|
||||
if not fullname.strip():
|
||||
dummy = xml_item.name or xml_item.pyName
|
||||
raise Exception('Invalid item name for %s (kind=%s)'%(dummy, self.kind))
|
||||
|
||||
return fullname
|
||||
|
||||
|
||||
|
||||
@@ -78,16 +78,18 @@ NO_MODULE = {
|
||||
# Widgets
|
||||
'DatePickerCtrlGeneric': 'adv.',
|
||||
'GenericCalendarCtrl' : 'adv.',
|
||||
'OwnerDrawnComboBox' : 'adv.',
|
||||
|
||||
# Enums/constants
|
||||
'AnimationType' : 'adv.',
|
||||
'CalendarDateBorder' : 'adv.',
|
||||
'CalendarHitTestResult': 'adv.',
|
||||
'LayoutAlignment' : 'adv.',
|
||||
'LayoutOrientation' : 'adv.',
|
||||
'SashDragStatus' : 'adv.',
|
||||
'SashEdgePosition' : 'adv.',
|
||||
'TaskBarIconType' : 'adv.',
|
||||
'AnimationType' : 'adv.',
|
||||
'CalendarDateBorder' : 'adv.',
|
||||
'CalendarHitTestResult' : 'adv.',
|
||||
'LayoutAlignment' : 'adv.',
|
||||
'LayoutOrientation' : 'adv.',
|
||||
'OwnerDrawnComboBoxPaintingFlags': 'adv.',
|
||||
'SashDragStatus' : 'adv.',
|
||||
'SashEdgePosition' : 'adv.',
|
||||
'TaskBarIconType' : 'adv.',
|
||||
|
||||
# -- wxDataView -- #
|
||||
# Widgets
|
||||
|
||||
Reference in New Issue
Block a user