]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/wxIEHtmlWin.py
added comments to the makefile; added WX_CONFIG var to be able to use a different...
[wxWidgets.git] / wxPython / demo / wxIEHtmlWin.py
index 12210cf03b50a4d416f53c49eaff947822932130..1604da40cc6f6c89f0376679d6de7126d372deeb 100644 (file)
@@ -8,9 +8,10 @@ if wxPlatform == '__WXMSW__':
 
 class TestPanel(wxWindow):
     def __init__(self, parent, log, frame=None):
-        wxWindow.__init__(self, parent, -1, style=wxCLIP_CHILDREN)
+        wxWindow.__init__(self, parent, -1,
+                          style=wxTAB_TRAVERSAL|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE)
         self.log = log
-        self.current = "http://wxPython.org/"
+        self.current = "http://wxWindows.org/"
         self.frame = frame
         if frame:
             self.titleBase = frame.GetTitle()
@@ -19,7 +20,7 @@ class TestPanel(wxWindow):
         sizer = wxBoxSizer(wxVERTICAL)
         btnSizer = wxBoxSizer(wxHORIZONTAL)
 
-        self.ie = wxIEHtmlWin(self, -1) ##, style=wxSUNKEN_BORDER)
+        self.ie = wxIEHtmlWin(self, -1, style = wxNO_FULL_REPAINT_ON_RESIZE)
 
 
         btn = wxButton(self, wxNewId(), "Open", style=wxBU_EXACTFIT)
@@ -53,20 +54,21 @@ class TestPanel(wxWindow):
         txt = wxStaticText(self, -1, "Location:")
         btnSizer.Add(txt, 0, wxCENTER|wxALL, 2)
 
-        self.location = wxComboBox(self, wxNewId(), "", style=wxCB_DROPDOWN)
+        self.location = wxComboBox(self, wxNewId(), "", style=wxCB_DROPDOWN|wxPROCESS_ENTER)
         EVT_COMBOBOX(self, self.location.GetId(), self.OnLocationSelect)
         EVT_KEY_UP(self.location, self.OnLocationKey)
         EVT_CHAR(self.location, self.IgnoreReturn)
         btnSizer.Add(self.location, 1, wxEXPAND|wxALL, 2)
 
+
         sizer.Add(btnSizer, 0, wxEXPAND)
         sizer.Add(self.ie, 1, wxEXPAND)
 
-        self.ie.LoadUrl(self.current)
+        self.ie.Navigate(self.current)
         self.location.Append(self.current)
 
         self.SetSizer(sizer)
-        self.SetAutoLayout(true)
+        self.SetAutoLayout(True)
         EVT_SIZE(self, self.OnSize)
 
         # Hook up the event handlers for the IE window
@@ -78,25 +80,32 @@ class TestPanel(wxWindow):
         EVT_MSHTML_TITLECHANGE(self, -1, self.OnTitleChange)
 
 
+    def ShutdownDemo(self):
+        # put the frame title back
+        if self.frame:
+            self.frame.SetTitle(self.titleBase)
+
+
     def OnSize(self, evt):
         self.Layout()
 
+
     def OnLocationSelect(self, evt):
         url = self.location.GetStringSelection()
         self.log.write('OnLocationSelect: %s\n' % url)
-        self.ie.LoadUrl(url)
+        self.ie.Navigate(url)
 
     def OnLocationKey(self, evt):
         if evt.KeyCode() == WXK_RETURN:
             URL = self.location.GetValue()
             self.location.Append(URL)
-            self.ie.LoadUrl(URL)
+            self.ie.Navigate(URL)
         else:
             evt.Skip()
 
+
     def IgnoreReturn(self, evt):
-        print 'IgnoreReturn'
-        if evt.KeyCode() != WXK_RETURN:
+        if evt.GetKeyCode() != WXK_RETURN:
             evt.Skip()
 
     def OnOpenButton(self, event):
@@ -106,7 +115,7 @@ class TestPanel(wxWindow):
         dlg.CentreOnParent()
         if dlg.ShowModal() == wxID_OK:
             self.current = dlg.GetValue()
-            self.ie.LoadUrl(self.current)
+            self.ie.Navigate(self.current)
         dlg.Destroy()
 
     def OnHomeButton(self, event):
@@ -131,7 +140,7 @@ class TestPanel(wxWindow):
 
     def logEvt(self, name, event):
         self.log.write('%s: %s\n' %
-                       (name, (event.GetLong1(), event.GetLong2(), event.GetText())))
+                       (name, (event.GetLong1(), event.GetLong2(), event.GetText1())))
 
     def OnBeforeNavigate2(self, evt):
         self.logEvt('OnBeforeNavigate2', evt)
@@ -142,18 +151,18 @@ class TestPanel(wxWindow):
 
     def OnDocumentComplete(self, evt):
         self.logEvt('OnDocumentComplete', evt)
-        self.current = evt.GetText()
+        self.current = evt.GetText1()
         self.location.SetValue(self.current)
 
     def OnTitleChange(self, evt):
         self.logEvt('OnTitleChange', evt)
         if self.frame:
-            self.frame.SetTitle(self.titleBase + ' -- ' + evt.GetText())
+            self.frame.SetTitle(self.titleBase + ' -- ' + evt.GetText1())
 
     def OnStatusTextChange(self, evt):
         self.logEvt('OnStatusTextChange', evt)
         if self.frame:
-            self.frame.SetStatusText(evt.GetText())
+            self.frame.SetStatusText(evt.GetText1())
 
 
 #----------------------------------------------------------------------