Use a MessagePanel instead of a MessageDialog for samples that may not

be runnable in certain conditions


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30229 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-11-01 19:39:09 +00:00
parent 45fb81e556
commit c4ef95daf6
14 changed files with 165 additions and 139 deletions

View File

@@ -265,6 +265,60 @@ class MyTP(wx.PyTipProvider):
def GetTip(self):
return "This is my tip"
#---------------------------------------------------------------------------
# A class to be used to simply display a message in the demo pane
# rather than running the sample itself.
class MessagePanel(wx.Panel):
def __init__(self, parent, message, caption='', flags=0):
wx.Panel.__init__(self, parent)
# Make widgets
if flags:
artid = None
if flags & wx.ICON_EXCLAMATION:
artid = wx.ART_WARNING
elif flags & wx.ICON_ERROR:
artid = wx.ART_ERROR
elif flags & wx.ICON_QUESTION:
artid = wx.ART_QUESTION
elif flags & wx.ICON_INFORMATION:
artid = wx.ART_INFORMATION
if artid is not None:
bmp = wx.ArtProvider.GetBitmap(artid, wx.ART_MESSAGE_BOX, (32,32))
icon = wx.StaticBitmap(self, -1, bmp)
else:
icon = (32,32) # make a spacer instead
if caption:
caption = wx.StaticText(self, -1, caption)
caption.SetFont(wx.Font(28, wx.SWISS, wx.NORMAL, wx.BOLD))
message = wx.StaticText(self, -1, message)
# add to sizers for layout
tbox = wx.BoxSizer(wx.VERTICAL)
if caption:
tbox.Add(caption)
tbox.Add((10,10))
tbox.Add(message)
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add((10,10), 1)
hbox.Add(icon)
hbox.Add((10,10))
hbox.Add(tbox)
hbox.Add((10,10), 1)
box = wx.BoxSizer(wx.VERTICAL)
box.Add((10,10), 1)
box.Add(hbox, 0, wx.EXPAND)
box.Add((10,10), 2)
self.SetSizer(box)
#---------------------------------------------------------------------------
# A class to be used to display source code in the demo. Try using the