]> git.saurik.com Git - wxWidgets.git/commitdiff
Changed SetToolBar() to behave a bit smarter. Untested.
authorRobert Roebling <robert@roebling.de>
Sat, 9 Oct 1999 09:06:35 +0000 (09:06 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 9 Oct 1999 09:06:35 +0000 (09:06 +0000)
  Removed some unused variables.
  More tests in scroll sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3903 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/frame.h
include/wx/gtk/window.h
include/wx/gtk1/frame.h
include/wx/gtk1/window.h
samples/scroll/scroll.cpp
src/gtk/frame.cpp
src/gtk/textctrl.cpp
src/gtk1/frame.cpp
src/gtk1/textctrl.cpp

index 497343f54fadf010d3fdbf82b4c9b6bfdb2ce209..0268757d7168c3d785e5bc87d9ae64bf8447ffec 100644 (file)
@@ -78,7 +78,7 @@ public:
             const wxString& name = wxToolBarNameStr);
     virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name );
     virtual wxToolBar *GetToolBar() const;
-    void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
+    void SetToolBar(wxToolBar *toolbar);
 #endif // wxUSE_TOOLBAR
 
     virtual void SetMenuBar( wxMenuBar *menuBar );
index cb221b82fbcba33c58fde790b640daf0c46a8bde..ae02499808c9e5562de9209db1b47a4e52bd0c2d 100644 (file)
@@ -196,13 +196,7 @@ public:
     bool                 m_delayedFont:1;
     bool                 m_delayedForegroundColour:1;
     bool                 m_delayedBackgroundColour:1;
-    bool                 m_delayedCursor:1;
     
-    // the cursor is set in OnInternalIdle(). this fields holds
-    // a reference to the cursor currently set in theGdk window 
-    // so that we don't have to set it more than once
-    wxCursor             m_currentGdkCursor;
-
     // contains GTK's widgets internal information about non-default widget
     // font and colours. we create one for each widget that gets any
     // non-default attribute set via SetFont() or SetForegroundColour() /
index 497343f54fadf010d3fdbf82b4c9b6bfdb2ce209..0268757d7168c3d785e5bc87d9ae64bf8447ffec 100644 (file)
@@ -78,7 +78,7 @@ public:
             const wxString& name = wxToolBarNameStr);
     virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name );
     virtual wxToolBar *GetToolBar() const;
-    void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
+    void SetToolBar(wxToolBar *toolbar);
 #endif // wxUSE_TOOLBAR
 
     virtual void SetMenuBar( wxMenuBar *menuBar );
index cb221b82fbcba33c58fde790b640daf0c46a8bde..ae02499808c9e5562de9209db1b47a4e52bd0c2d 100644 (file)
@@ -196,13 +196,7 @@ public:
     bool                 m_delayedFont:1;
     bool                 m_delayedForegroundColour:1;
     bool                 m_delayedBackgroundColour:1;
-    bool                 m_delayedCursor:1;
     
-    // the cursor is set in OnInternalIdle(). this fields holds
-    // a reference to the cursor currently set in theGdk window 
-    // so that we don't have to set it more than once
-    wxCursor             m_currentGdkCursor;
-
     // contains GTK's widgets internal information about non-default widget
     // font and colours. we create one for each widget that gets any
     // non-default attribute set via SetFont() or SetForegroundColour() /
index 67c936293b51791c9c69e54839368a7bc742b2c5..0d20a0aed6963f9c6b4ef2bf6d9d298e07808266 100644 (file)
@@ -38,6 +38,7 @@ public:
     MyCanvas( wxWindow *parent, wxWindowID, const wxPoint &pos, const wxSize &size );
     ~MyCanvas();
     void OnPaint( wxPaintEvent &event );
+    void OnQueryPosition( wxCommandEvent &event );
     void OnAddButton( wxCommandEvent &event );
     void OnDeleteButton( wxCommandEvent &event );
     void OnMoveButton( wxCommandEvent &event );
@@ -84,6 +85,7 @@ IMPLEMENT_APP(MyApp)
 #define   ID_DELBUTTON    2
 #define   ID_MOVEBUTTON   3
 #define   ID_SCROLLWIN    4
+#define   ID_QUERYPOS     5
 
 #define   ID_NEWBUTTON    10
 
@@ -92,7 +94,8 @@ IMPLEMENT_APP(MyApp)
 IMPLEMENT_DYNAMIC_CLASS(MyCanvas, wxScrolledWindow)
 
 BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
-  EVT_PAINT(                   MyCanvas::OnPaint)
+  EVT_PAINT(                  MyCanvas::OnPaint)
+  EVT_BUTTON( ID_QUERYPOS,    MyCanvas::OnQueryPosition)
   EVT_BUTTON( ID_ADDBUTTON,   MyCanvas::OnAddButton)
   EVT_BUTTON( ID_DELBUTTON,   MyCanvas::OnDeleteButton)
   EVT_BUTTON( ID_MOVEBUTTON,  MyCanvas::OnMoveButton)
@@ -117,7 +120,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
         "examples."
     };
   
-    m_button = new wxButton( this, -1, "wxButton", wxPoint(10,110) );
+    m_button = new wxButton( this, ID_QUERYPOS, "Query position", wxPoint(10,110) );
   
     (void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,150) );
   
@@ -171,15 +174,25 @@ MyCanvas::~MyCanvas()
 {
 }
 
+void MyCanvas::OnQueryPosition( wxCommandEvent &WXUNUSED(event) )
+{
+    wxPoint pt( m_button->GetPosition() );
+    wxLogMessage( """wxButton"" position %d %d", pt.x, pt.y );
+    if ((pt.x == 10) && (pt.y == 110))
+        wxLogMessage( "-> Correct." );
+    else
+        wxLogMessage( "-> Incorrect." );
+}
+
 void MyCanvas::OnAddButton( wxCommandEvent &WXUNUSED(event) )
 {
-    wxLogMessage( "Inserting button at position 50,50" );
-    (void) new wxButton( this, ID_NEWBUTTON, "new button", wxPoint(50,50) );
+    wxLogMessage( "Inserting button at position 10,70..." );
+    (void) new wxButton( this, ID_NEWBUTTON, "new button", wxPoint(10,70), wxSize(80,25) );
 }
 
 void MyCanvas::OnDeleteButton( wxCommandEvent &event )
 {
-    wxLogMessage( "deleting button inserted with ""add button""" );
+    wxLogMessage( "Deleting button inserted with ""Add button""..." );
     wxWindow *win = FindWindow( ID_NEWBUTTON );
     if (win)
        win->Destroy();
@@ -209,6 +222,8 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
 
     dc.DrawText( "Some text", 140, 140 );
   
+    dc.DrawRectangle( 10, 70, 80, 25 );
+    
     dc.DrawRectangle( 100, 160, 200, 200 );
 }
 
index 9cc4171c2d1076fdb5815e9f7c994f7baaeb69d0..c0d27bd46447dda5bb78c90a4b18dc3fba1d77ec 100644 (file)
@@ -942,6 +942,26 @@ wxToolBar* wxFrame::OnCreateToolBar( long style, wxWindowID id, const wxString&
     return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
 }
 
+void wxFrame::SetToolBar(wxToolBar *toolbar) 
+{ 
+    m_frameToolBar = toolbar; 
+    if (m_frameToolBar)
+    {
+        /* insert into toolbar area if not already there */
+        if (m_frameToolBar->m_widget->parent != m_mainWidget)
+        {
+           gtk_widget_ref( m_frameToolBar->m_widget );
+           gtk_widget_unparent( m_frameToolBar->m_widget );
+           
+            m_insertInClientArea = TRUE;
+           wxInsertChildInFrame( this, m_frameToolBar );
+            m_insertInClientArea = FALSE;
+           
+           gtk_widget_unref( m_frameToolBar->m_widget );
+       }
+    }
+}
+
 wxToolBar *wxFrame::GetToolBar() const
 {
     return m_frameToolBar;
index db100d48ec8bf4443693acb529fcced399682b18..66fbb33bd5eac4198516418ba062c88697560653 100644 (file)
@@ -931,10 +931,8 @@ void wxTextCtrl::OnInternalIdle()
     wxCursor cursor = m_cursor;
     if (g_globalCursor.Ok()) cursor = g_globalCursor;
 
-    if (cursor.Ok() && m_currentGdkCursor != cursor)
+    if (cursor.Ok())
     {
-        m_currentGdkCursor = cursor;
-       
         GdkWindow *window = (GdkWindow*) NULL;
        if (HasFlag(wxTE_MULTILINE))
             window = GTK_TEXT(m_text)->text_area;
index 9cc4171c2d1076fdb5815e9f7c994f7baaeb69d0..c0d27bd46447dda5bb78c90a4b18dc3fba1d77ec 100644 (file)
@@ -942,6 +942,26 @@ wxToolBar* wxFrame::OnCreateToolBar( long style, wxWindowID id, const wxString&
     return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
 }
 
+void wxFrame::SetToolBar(wxToolBar *toolbar) 
+{ 
+    m_frameToolBar = toolbar; 
+    if (m_frameToolBar)
+    {
+        /* insert into toolbar area if not already there */
+        if (m_frameToolBar->m_widget->parent != m_mainWidget)
+        {
+           gtk_widget_ref( m_frameToolBar->m_widget );
+           gtk_widget_unparent( m_frameToolBar->m_widget );
+           
+            m_insertInClientArea = TRUE;
+           wxInsertChildInFrame( this, m_frameToolBar );
+            m_insertInClientArea = FALSE;
+           
+           gtk_widget_unref( m_frameToolBar->m_widget );
+       }
+    }
+}
+
 wxToolBar *wxFrame::GetToolBar() const
 {
     return m_frameToolBar;
index db100d48ec8bf4443693acb529fcced399682b18..66fbb33bd5eac4198516418ba062c88697560653 100644 (file)
@@ -931,10 +931,8 @@ void wxTextCtrl::OnInternalIdle()
     wxCursor cursor = m_cursor;
     if (g_globalCursor.Ok()) cursor = g_globalCursor;
 
-    if (cursor.Ok() && m_currentGdkCursor != cursor)
+    if (cursor.Ok())
     {
-        m_currentGdkCursor = cursor;
-       
         GdkWindow *window = (GdkWindow*) NULL;
        if (HasFlag(wxTE_MULTILINE))
             window = GTK_TEXT(m_text)->text_area;