]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxDC:DrawPolygone
authorRobert Roebling <robert@roebling.de>
Sat, 8 Aug 1998 13:11:54 +0000 (13:11 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 8 Aug 1998 13:11:54 +0000 (13:11 +0000)
  Corrected wxBitmap::SetLabel
  Added wxASSERT here and there
  wxDropSource:DoDrop() now returns Cancel when supposed to

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

23 files changed:
include/wx/gtk/button.h
include/wx/gtk/dnd.h
include/wx/gtk1/button.h
include/wx/gtk1/dnd.h
src/.cvsignore
src/gtk/button.cpp
src/gtk/choice.cpp
src/gtk/colour.cpp
src/gtk/combobox.cpp
src/gtk/control.cpp
src/gtk/dcclient.cpp
src/gtk/dialog.cpp
src/gtk/dnd.cpp
src/gtk/notebook.cpp
src/gtk1/button.cpp
src/gtk1/choice.cpp
src/gtk1/colour.cpp
src/gtk1/combobox.cpp
src/gtk1/control.cpp
src/gtk1/dcclient.cpp
src/gtk1/dialog.cpp
src/gtk1/dnd.cpp
src/gtk1/notebook.cpp

index 6932755578dde8e3e353b605081cb26f2594b661..c423cc21fb630856787a36be797c439e36cd1afa 100644 (file)
@@ -52,7 +52,6 @@ class wxButton: public wxControl
       long style = 0, const wxString &name = wxButtonNameStr  );
     void SetDefault(void);
     void SetLabel( const wxString &label );
-    wxString GetLabel(void) const;
 };
 
 #endif // __GTKBUTTONH__
index 2c2a0f53386f8a2b9776ece0a1067a3f5c2ef67e..1ca1e33671b11b8814b32499dd6bc2218f89ce6a 100644 (file)
@@ -235,12 +235,14 @@ class wxDropSource: public wxObject
 
   protected:
   
+    friend void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source );
+  
     void RegisterWindow(void);
     void UnregisterWindow(void);
   
     GtkWidget     *m_widget;
     wxWindow      *m_window;
-    
+    DragResult     m_retValue;
     wxDataObject  *m_data;
     
     wxCursor      m_defaultCursor;
index 6932755578dde8e3e353b605081cb26f2594b661..c423cc21fb630856787a36be797c439e36cd1afa 100644 (file)
@@ -52,7 +52,6 @@ class wxButton: public wxControl
       long style = 0, const wxString &name = wxButtonNameStr  );
     void SetDefault(void);
     void SetLabel( const wxString &label );
-    wxString GetLabel(void) const;
 };
 
 #endif // __GTKBUTTONH__
index 2c2a0f53386f8a2b9776ece0a1067a3f5c2ef67e..1ca1e33671b11b8814b32499dd6bc2218f89ce6a 100644 (file)
@@ -235,12 +235,14 @@ class wxDropSource: public wxObject
 
   protected:
   
+    friend void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source );
+  
     void RegisterWindow(void);
     void UnregisterWindow(void);
   
     GtkWidget     *m_widget;
     wxWindow      *m_window;
-    
+    DragResult     m_retValue;
     wxDataObject  *m_data;
     
     wxCursor      m_defaultCursor;
index 9b075671eacd53b1d7cc5407599bafb963314395..ab1b8840ad71087fbfeb281d29405c9d210e47de 100644 (file)
@@ -1 +1,2 @@
 Linux
+linux
index 9e64e2579e839a5b5764f904296526b564a8950b..7205e098c58630accee6d3a1d75fa5144ddf6df6 100644 (file)
@@ -89,9 +89,8 @@ void wxButton::SetDefault(void)
 void wxButton::SetLabel( const wxString &label )
 {
   wxControl::SetLabel( label );
+  GtkBin *bin = GTK_BIN( m_widget );
+  GtkLabel *g_label = GTK_LABEL( bin->child );
+  gtk_label_set( g_label, GetLabel() );
 };
 
-wxString wxButton::GetLabel(void) const
-{
-  return wxControl::GetLabel();
-};
index 09af84d007cdba14185c1999f21a953bf4520f73..039b4fda7ff8e66bd186989662b0f5425c804896 100644 (file)
@@ -122,11 +122,17 @@ int wxChoice::FindString( const wxString &string ) const
     GtkBin *bin = GTK_BIN( child->data );
     GtkLabel *label = NULL;
     if (bin->child) label = GTK_LABEL(bin->child);
+    
+    wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
+    
     if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
     if (string == label->label) return count;
     child = child->next;
     count++;
   };
+  
+  wxFAIL_MSG( "wxChoice: string not found" );
+  
   return -1;
 };
 
@@ -147,6 +153,9 @@ int wxChoice::GetSelection(void)
     child = child->next;
     count++;
   };
+  
+  wxFAIL_MSG( "wxChoice: no selection" );
+  
   return -1;
 };
 
@@ -162,18 +171,27 @@ wxString wxChoice::GetString( int n ) const
     {
       GtkLabel *label = NULL;
       if (bin->child) label = GTK_LABEL(bin->child);
+      
+      wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
+      
       if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
       return label->label;
     };
     child = child->next;
     count++;
   };
+  
+  wxFAIL_MSG( "wxChoice: string not found" );
+  
   return "";
 };
 
 wxString wxChoice::GetStringSelection(void) const
 {
   GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
+  
+  wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
+  
   return label->label;
 };
 
index b0efc2dcc218dc362d095a9bafea47659c5a773c..90bd8e158a443b4182f2849ed137774233a2ca2d 100644 (file)
@@ -93,6 +93,7 @@ wxColour::wxColour( const wxString &colourName )
     m_refData = new wxColourRefData();
     if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
     {
+      wxFAIL_MSG( "wxColour: couldn't find colour" );
       delete m_refData;
       m_refData = NULL;
     };
@@ -134,6 +135,7 @@ wxColour& wxColour::operator = ( const wxString& colourName )
     m_refData = new wxColourRefData();
     if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
     {
+      wxFAIL_MSG( "wxColour: couldn't find colour" );
       delete m_refData;
       m_refData = NULL;
     };
index 9965d5b5a7dd0d14fba7bd84db7c355a3c456acf..6f0acae1372d3b828dcd292655c23cfdd1509062 100644 (file)
@@ -156,7 +156,7 @@ void wxComboBox::Delete( int n )
   wxNode *node = m_clientData.Nth( n );
   if (!node)
   {
-    wxFAIL_MSG(_("wxComboBox::Delete wrong index"));
+    wxFAIL_MSG( "wxComboBox: wrong index" );
   }
   else
     m_clientData.DeleteNode( node );
@@ -176,6 +176,9 @@ int wxComboBox::FindString( const wxString &item )
     count++;
     child = child->next;
   };
+  
+  wxFAIL_MSG( "wxComboBox: string not found" );
+  
   return -1;
 };
 
@@ -183,6 +186,9 @@ char* wxComboBox::GetClientData( int n )
 {
   wxNode *node = m_clientData.Nth( n );
   if (node) return (char*)node->Data();
+  
+  wxFAIL_MSG( "wxComboBox: wrong index" );
+  
   return NULL;
 };
 
@@ -190,6 +196,8 @@ void wxComboBox::SetClientData( int n, char * clientData )
 {
   wxNode *node = m_clientData.Nth( n );
   if (node) node->SetData( (wxObject*) clientData );
+  
+  wxFAIL_MSG( "wxComboBox: wrong index" );
 };
 
 int wxComboBox::GetSelection(void) const
@@ -208,6 +216,9 @@ int wxComboBox::GetSelection(void) const
       child = child->next;
     };
   };
+  
+  wxFAIL_MSG( "wxComboBox: no selection" );
+  
   return -1;
 };
 
@@ -222,6 +233,9 @@ wxString wxComboBox::GetString( int n ) const
     GtkLabel *label = GTK_LABEL( bin->child );
     return label->label;
   };
+  
+  wxFAIL_MSG( "wxComboBox: wrong index" );
+  
   return "";
 };
 
@@ -236,6 +250,9 @@ wxString wxComboBox::GetStringSelection(void) const
     wxString tmp = GTK_LABEL( bin->child )->label;
     return tmp;
   };
+  
+  wxFAIL_MSG( "wxComboBox: no selection" );
+  
   return "";
 };
 
index 3c7f89d95b8af92647bf133ba04f7b71d9a93bdd..fb7fd4d3af88ab1495cf85de0883c3c7ca456431 100644 (file)
@@ -47,6 +47,7 @@ void wxControl::SetLabel( const wxString &label )
 #endif
     }
 
+    m_label = "";
     m_label << *pc;
   }
 };
index 520eaa70365c9d2ef1def78e1070bb9caa934dd2..468db590bc5f647d805dbfc1bf1af3b05f824297 100644 (file)
@@ -279,16 +279,62 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
   };
 };
 
-void wxPaintDC::DrawPolygon( int WXUNUSED(n), wxPoint WXUNUSED(points)[], 
-  long WXUNUSED(xoffset), long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
-{
-  if (!Ok()) return;
+void wxPaintDC::DrawPolygon( int n, wxPoint points[], 
+  long xoffset, long yoffset, int WXUNUSED(fillStyle) )
+ {
+   if (!Ok()) return;
+   if (!n) return;    // Nothing to draw
+   GdkPoint *gdkpoints = new GdkPoint[n+1];
+   int i;
+   for (i = 0 ; i < n ; i++)
+     {
+       gdkpoints[i].x = XLOG2DEV(points[i].x + xoffset);
+       gdkpoints[i].y = YLOG2DEV(points[i].y + yoffset);
+     }
+   if (m_brush.GetStyle() != wxTRANSPARENT)
+     gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
+   // To do: Fillstyle
+   if (m_pen.GetStyle() != wxTRANSPARENT)
+     for (i = 0 ; i < n ; i++)
+       gdk_draw_line( m_window, m_penGC, 
+                    gdkpoints[i%n].x,
+                    gdkpoints[i%n].y,
+                    gdkpoints[(i+1)%n].x,
+                    gdkpoints[(i+1)%n].y);
+   delete[] gdkpoints;
 };
 
-void wxPaintDC::DrawPolygon( wxList *WXUNUSED(lines), long WXUNUSED(xoffset), 
-                             long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
-{
-  if (!Ok()) return;
+void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, 
+                              long yoffset, int WXUNUSED(fillStyle))
+ {
+   int n = lines->Number();
+   if (!Ok()) return;
+   GdkPoint *gdkpoints = new GdkPoint[n];
+   wxNode *node = lines->First();
+   int cnt=0;
+   while (node)
+     {
+       wxPoint *p = (wxPoint *) node->Data();
+       gdkpoints[cnt].x = XLOG2DEV(p->x + xoffset);
+       gdkpoints[cnt].y = YLOG2DEV(p->y + yoffset);
+       node = node->Next();
+       cnt++;
+     }
+   if (m_brush.GetStyle() != wxTRANSPARENT)
+     gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
+   // To do: Fillstyle
+   if (m_pen.GetStyle() != wxTRANSPARENT)
+     {
+       int i;
+       for (i = 0 ; i < n ; i++)
+       gdk_draw_line( m_window, m_penGC, 
+                      gdkpoints[i%n].x,
+                      gdkpoints[i%n].y,
+                      gdkpoints[(i+1)%n].x,
+                      gdkpoints[(i+1)%n].y);
+     }
+   delete[] gdkpoints;
 };
 
 void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
index 6411ba19302f836e7a5db86312cefe0263ad1c1c..4c394a33e5150fcc617ed762ce2c5eb09948176a 100644 (file)
@@ -107,6 +107,7 @@ wxDialog::~wxDialog(void)
 void wxDialog::SetTitle(const wxString& title )
 {
   m_title = title;
+  if (m_title.IsNull()) m_title = "";
   gtk_window_set_title( GTK_WINDOW(m_widget), m_title );
 };
 
@@ -219,7 +220,12 @@ void wxDialog::EndModal( int retCode )
 {
   SetReturnCode( retCode );
   
-  if (!m_modalShowing) return;
+  if (!m_modalShowing)
+  {
+     wxFAIL_MSG( "wxDialog: called EndModal twice" );
+     return;
+  };
+  
   m_modalShowing = FALSE;
   
   gtk_main_quit();
index 9a3b2b08eae4ed6bba9b8b8a4eacd1ab17610129..ce49947151a69444abbfdd9eaf2064091e5e64c9 100644 (file)
@@ -144,10 +144,12 @@ wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
 //-----------------------------------------------------------------------------
 // drag request
 
-void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDataObject *data )
+void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source )
 {
   printf( "Data requested for dropping.\n" );
   
+  wxDataObject *data = source->m_data;
+  
   uint size = data->GetDataSize();
   char *ptr = new char[size];
   data->GetDataHere( ptr );
@@ -155,6 +157,8 @@ void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDataObject *data )
   gtk_widget_dnd_data_set( widget, event, ptr, size );
   
   delete ptr;
+  
+  source->m_retValue = wxDropSource::Copy;
 };
 
 wxDropSource::wxDropSource( wxWindow *win )
@@ -165,7 +169,8 @@ wxDropSource::wxDropSource( wxWindow *win )
   m_widget = win->m_widget;
   if (win->m_wxwindow) m_widget = win->m_wxwindow;
   
-  m_data = NULL;  
+  m_data = NULL;
+  m_retValue = Cancel;
 
   m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
   m_goaheadCursor = wxCursor( wxCURSOR_HAND );
@@ -178,6 +183,7 @@ wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
   m_window = win;
   m_widget = win->m_widget;
   if (win->m_wxwindow) m_widget = win->m_wxwindow;
+  m_retValue = Cancel;
   
   m_data = &data;
 
@@ -202,6 +208,8 @@ wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
   if (gdk_dnd.dnd_grabbed) return None;
   if (gdk_dnd.drag_really) return None;
   
+  wxASSERT_MSG( data, "wxDragSource: no data" );
+  
   if (!m_data) return None;
   if (m_data->GetDataSize() == 0) return None;
   
@@ -255,7 +263,7 @@ wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
   
   UnregisterWindow();
   
-  return Copy;
+  return m_retValue;
 };
 
 void wxDropSource::RegisterWindow(void)
@@ -283,7 +291,7 @@ void wxDropSource::RegisterWindow(void)
   gtk_widget_dnd_drag_set( m_widget, TRUE, &str, 1 );
 
   gtk_signal_connect( GTK_OBJECT(m_widget), "drag_request_event",
-    GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)m_data );
+    GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)this );
 };
 
 void wxDropSource::UnregisterWindow(void)
@@ -292,5 +300,5 @@ void wxDropSource::UnregisterWindow(void)
   
   gtk_widget_dnd_drag_set( m_widget, FALSE, NULL, 0 );
   
-  gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)m_data );
+  gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
 };
index 356a1a4c8f31b8d8038c09a3908961747538e86b..da307dfb3ebbcf547ad2eaf616c848148e081d57 100644 (file)
@@ -184,7 +184,7 @@ int wxNotebook::GetSelection() const
     node = node->Next();
   };
 
-  wxCHECK_MSG( node != NULL, -1, _("wxNotebook: no selection?"));
+  wxCHECK_MSG( node != NULL, -1, "wxNotebook: no selection?" );
 
   return page->m_id;
 };
@@ -230,7 +230,7 @@ wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
     node = node->Next();
   };
 
-  wxLogDebug( _("Notebook page %d not found!"), page );
+  wxLogDebug( "Notebook page %d not found!", page );
 
   return NULL;
 };
index 9e64e2579e839a5b5764f904296526b564a8950b..7205e098c58630accee6d3a1d75fa5144ddf6df6 100644 (file)
@@ -89,9 +89,8 @@ void wxButton::SetDefault(void)
 void wxButton::SetLabel( const wxString &label )
 {
   wxControl::SetLabel( label );
+  GtkBin *bin = GTK_BIN( m_widget );
+  GtkLabel *g_label = GTK_LABEL( bin->child );
+  gtk_label_set( g_label, GetLabel() );
 };
 
-wxString wxButton::GetLabel(void) const
-{
-  return wxControl::GetLabel();
-};
index 09af84d007cdba14185c1999f21a953bf4520f73..039b4fda7ff8e66bd186989662b0f5425c804896 100644 (file)
@@ -122,11 +122,17 @@ int wxChoice::FindString( const wxString &string ) const
     GtkBin *bin = GTK_BIN( child->data );
     GtkLabel *label = NULL;
     if (bin->child) label = GTK_LABEL(bin->child);
+    
+    wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
+    
     if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
     if (string == label->label) return count;
     child = child->next;
     count++;
   };
+  
+  wxFAIL_MSG( "wxChoice: string not found" );
+  
   return -1;
 };
 
@@ -147,6 +153,9 @@ int wxChoice::GetSelection(void)
     child = child->next;
     count++;
   };
+  
+  wxFAIL_MSG( "wxChoice: no selection" );
+  
   return -1;
 };
 
@@ -162,18 +171,27 @@ wxString wxChoice::GetString( int n ) const
     {
       GtkLabel *label = NULL;
       if (bin->child) label = GTK_LABEL(bin->child);
+      
+      wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
+      
       if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
       return label->label;
     };
     child = child->next;
     count++;
   };
+  
+  wxFAIL_MSG( "wxChoice: string not found" );
+  
   return "";
 };
 
 wxString wxChoice::GetStringSelection(void) const
 {
   GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
+  
+  wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
+  
   return label->label;
 };
 
index b0efc2dcc218dc362d095a9bafea47659c5a773c..90bd8e158a443b4182f2849ed137774233a2ca2d 100644 (file)
@@ -93,6 +93,7 @@ wxColour::wxColour( const wxString &colourName )
     m_refData = new wxColourRefData();
     if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
     {
+      wxFAIL_MSG( "wxColour: couldn't find colour" );
       delete m_refData;
       m_refData = NULL;
     };
@@ -134,6 +135,7 @@ wxColour& wxColour::operator = ( const wxString& colourName )
     m_refData = new wxColourRefData();
     if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
     {
+      wxFAIL_MSG( "wxColour: couldn't find colour" );
       delete m_refData;
       m_refData = NULL;
     };
index 9965d5b5a7dd0d14fba7bd84db7c355a3c456acf..6f0acae1372d3b828dcd292655c23cfdd1509062 100644 (file)
@@ -156,7 +156,7 @@ void wxComboBox::Delete( int n )
   wxNode *node = m_clientData.Nth( n );
   if (!node)
   {
-    wxFAIL_MSG(_("wxComboBox::Delete wrong index"));
+    wxFAIL_MSG( "wxComboBox: wrong index" );
   }
   else
     m_clientData.DeleteNode( node );
@@ -176,6 +176,9 @@ int wxComboBox::FindString( const wxString &item )
     count++;
     child = child->next;
   };
+  
+  wxFAIL_MSG( "wxComboBox: string not found" );
+  
   return -1;
 };
 
@@ -183,6 +186,9 @@ char* wxComboBox::GetClientData( int n )
 {
   wxNode *node = m_clientData.Nth( n );
   if (node) return (char*)node->Data();
+  
+  wxFAIL_MSG( "wxComboBox: wrong index" );
+  
   return NULL;
 };
 
@@ -190,6 +196,8 @@ void wxComboBox::SetClientData( int n, char * clientData )
 {
   wxNode *node = m_clientData.Nth( n );
   if (node) node->SetData( (wxObject*) clientData );
+  
+  wxFAIL_MSG( "wxComboBox: wrong index" );
 };
 
 int wxComboBox::GetSelection(void) const
@@ -208,6 +216,9 @@ int wxComboBox::GetSelection(void) const
       child = child->next;
     };
   };
+  
+  wxFAIL_MSG( "wxComboBox: no selection" );
+  
   return -1;
 };
 
@@ -222,6 +233,9 @@ wxString wxComboBox::GetString( int n ) const
     GtkLabel *label = GTK_LABEL( bin->child );
     return label->label;
   };
+  
+  wxFAIL_MSG( "wxComboBox: wrong index" );
+  
   return "";
 };
 
@@ -236,6 +250,9 @@ wxString wxComboBox::GetStringSelection(void) const
     wxString tmp = GTK_LABEL( bin->child )->label;
     return tmp;
   };
+  
+  wxFAIL_MSG( "wxComboBox: no selection" );
+  
   return "";
 };
 
index 3c7f89d95b8af92647bf133ba04f7b71d9a93bdd..fb7fd4d3af88ab1495cf85de0883c3c7ca456431 100644 (file)
@@ -47,6 +47,7 @@ void wxControl::SetLabel( const wxString &label )
 #endif
     }
 
+    m_label = "";
     m_label << *pc;
   }
 };
index 520eaa70365c9d2ef1def78e1070bb9caa934dd2..468db590bc5f647d805dbfc1bf1af3b05f824297 100644 (file)
@@ -279,16 +279,62 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
   };
 };
 
-void wxPaintDC::DrawPolygon( int WXUNUSED(n), wxPoint WXUNUSED(points)[], 
-  long WXUNUSED(xoffset), long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
-{
-  if (!Ok()) return;
+void wxPaintDC::DrawPolygon( int n, wxPoint points[], 
+  long xoffset, long yoffset, int WXUNUSED(fillStyle) )
+ {
+   if (!Ok()) return;
+   if (!n) return;    // Nothing to draw
+   GdkPoint *gdkpoints = new GdkPoint[n+1];
+   int i;
+   for (i = 0 ; i < n ; i++)
+     {
+       gdkpoints[i].x = XLOG2DEV(points[i].x + xoffset);
+       gdkpoints[i].y = YLOG2DEV(points[i].y + yoffset);
+     }
+   if (m_brush.GetStyle() != wxTRANSPARENT)
+     gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
+   // To do: Fillstyle
+   if (m_pen.GetStyle() != wxTRANSPARENT)
+     for (i = 0 ; i < n ; i++)
+       gdk_draw_line( m_window, m_penGC, 
+                    gdkpoints[i%n].x,
+                    gdkpoints[i%n].y,
+                    gdkpoints[(i+1)%n].x,
+                    gdkpoints[(i+1)%n].y);
+   delete[] gdkpoints;
 };
 
-void wxPaintDC::DrawPolygon( wxList *WXUNUSED(lines), long WXUNUSED(xoffset), 
-                             long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
-{
-  if (!Ok()) return;
+void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, 
+                              long yoffset, int WXUNUSED(fillStyle))
+ {
+   int n = lines->Number();
+   if (!Ok()) return;
+   GdkPoint *gdkpoints = new GdkPoint[n];
+   wxNode *node = lines->First();
+   int cnt=0;
+   while (node)
+     {
+       wxPoint *p = (wxPoint *) node->Data();
+       gdkpoints[cnt].x = XLOG2DEV(p->x + xoffset);
+       gdkpoints[cnt].y = YLOG2DEV(p->y + yoffset);
+       node = node->Next();
+       cnt++;
+     }
+   if (m_brush.GetStyle() != wxTRANSPARENT)
+     gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
+   // To do: Fillstyle
+   if (m_pen.GetStyle() != wxTRANSPARENT)
+     {
+       int i;
+       for (i = 0 ; i < n ; i++)
+       gdk_draw_line( m_window, m_penGC, 
+                      gdkpoints[i%n].x,
+                      gdkpoints[i%n].y,
+                      gdkpoints[(i+1)%n].x,
+                      gdkpoints[(i+1)%n].y);
+     }
+   delete[] gdkpoints;
 };
 
 void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
index 6411ba19302f836e7a5db86312cefe0263ad1c1c..4c394a33e5150fcc617ed762ce2c5eb09948176a 100644 (file)
@@ -107,6 +107,7 @@ wxDialog::~wxDialog(void)
 void wxDialog::SetTitle(const wxString& title )
 {
   m_title = title;
+  if (m_title.IsNull()) m_title = "";
   gtk_window_set_title( GTK_WINDOW(m_widget), m_title );
 };
 
@@ -219,7 +220,12 @@ void wxDialog::EndModal( int retCode )
 {
   SetReturnCode( retCode );
   
-  if (!m_modalShowing) return;
+  if (!m_modalShowing)
+  {
+     wxFAIL_MSG( "wxDialog: called EndModal twice" );
+     return;
+  };
+  
   m_modalShowing = FALSE;
   
   gtk_main_quit();
index 9a3b2b08eae4ed6bba9b8b8a4eacd1ab17610129..ce49947151a69444abbfdd9eaf2064091e5e64c9 100644 (file)
@@ -144,10 +144,12 @@ wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
 //-----------------------------------------------------------------------------
 // drag request
 
-void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDataObject *data )
+void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source )
 {
   printf( "Data requested for dropping.\n" );
   
+  wxDataObject *data = source->m_data;
+  
   uint size = data->GetDataSize();
   char *ptr = new char[size];
   data->GetDataHere( ptr );
@@ -155,6 +157,8 @@ void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDataObject *data )
   gtk_widget_dnd_data_set( widget, event, ptr, size );
   
   delete ptr;
+  
+  source->m_retValue = wxDropSource::Copy;
 };
 
 wxDropSource::wxDropSource( wxWindow *win )
@@ -165,7 +169,8 @@ wxDropSource::wxDropSource( wxWindow *win )
   m_widget = win->m_widget;
   if (win->m_wxwindow) m_widget = win->m_wxwindow;
   
-  m_data = NULL;  
+  m_data = NULL;
+  m_retValue = Cancel;
 
   m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
   m_goaheadCursor = wxCursor( wxCURSOR_HAND );
@@ -178,6 +183,7 @@ wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
   m_window = win;
   m_widget = win->m_widget;
   if (win->m_wxwindow) m_widget = win->m_wxwindow;
+  m_retValue = Cancel;
   
   m_data = &data;
 
@@ -202,6 +208,8 @@ wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
   if (gdk_dnd.dnd_grabbed) return None;
   if (gdk_dnd.drag_really) return None;
   
+  wxASSERT_MSG( data, "wxDragSource: no data" );
+  
   if (!m_data) return None;
   if (m_data->GetDataSize() == 0) return None;
   
@@ -255,7 +263,7 @@ wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
   
   UnregisterWindow();
   
-  return Copy;
+  return m_retValue;
 };
 
 void wxDropSource::RegisterWindow(void)
@@ -283,7 +291,7 @@ void wxDropSource::RegisterWindow(void)
   gtk_widget_dnd_drag_set( m_widget, TRUE, &str, 1 );
 
   gtk_signal_connect( GTK_OBJECT(m_widget), "drag_request_event",
-    GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)m_data );
+    GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)this );
 };
 
 void wxDropSource::UnregisterWindow(void)
@@ -292,5 +300,5 @@ void wxDropSource::UnregisterWindow(void)
   
   gtk_widget_dnd_drag_set( m_widget, FALSE, NULL, 0 );
   
-  gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)m_data );
+  gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
 };
index 356a1a4c8f31b8d8038c09a3908961747538e86b..da307dfb3ebbcf547ad2eaf616c848148e081d57 100644 (file)
@@ -184,7 +184,7 @@ int wxNotebook::GetSelection() const
     node = node->Next();
   };
 
-  wxCHECK_MSG( node != NULL, -1, _("wxNotebook: no selection?"));
+  wxCHECK_MSG( node != NULL, -1, "wxNotebook: no selection?" );
 
   return page->m_id;
 };
@@ -230,7 +230,7 @@ wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
     node = node->Next();
   };
 
-  wxLogDebug( _("Notebook page %d not found!"), page );
+  wxLogDebug( "Notebook page %d not found!", page );
 
   return NULL;
 };