]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/datavgen.cpp
indent app name + version from the rest in about dialog; use i18n-friendly way of...
[wxWidgets.git] / src / generic / datavgen.cpp
index 1a442101fc5adea9ac728bd50687b00e5b60ceb6..0d0b1ad1202f618a9b871ff56f57141700bc631a 100644 (file)
@@ -63,7 +63,10 @@ static const int EXPANDER_MARGIN = 4;
 // wxDataViewHeaderWindow
 //-----------------------------------------------------------------------------
 
-#define USE_NATIVE_HEADER_WINDOW    1
+// on wxMSW the header window (only that part however) can be made native!
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+    #define USE_NATIVE_HEADER_WINDOW
+#endif
 
 //Below is the compare stuff
 //For the generic implements, both the leaf nodes and the nodes are sorted for fast search when needed
@@ -109,8 +112,7 @@ protected:
     void SendEvent(wxEventType type, unsigned int n);
 };
 
-// on wxMSW the header window (only that part however) can be made native!
-#if defined(__WXMSW__) && USE_NATIVE_HEADER_WINDOW
+#ifdef USE_NATIVE_HEADER_WINDOW
 
 #define COLUMN_WIDTH_OFFSET         2
 #define wxDataViewHeaderWindowMSW   wxDataViewHeaderWindow
@@ -1148,7 +1150,7 @@ wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewRenderer *c
     SetFlags(flags);
 
     m_autosize = width < 0;  // TODO
-    
+
     Init(width < 0 ? wxDVC_DEFAULT_WIDTH : width);
 }
 
@@ -1265,7 +1267,7 @@ void wxDataViewHeaderWindowBase::SendEvent(wxEventType type, unsigned int n)
     parent->GetEventHandler()->ProcessEvent(le);
 }
 
-#if defined(__WXMSW__) && USE_NATIVE_HEADER_WINDOW
+#ifdef USE_NATIVE_HEADER_WINDOW
 
 #ifndef HDS_DRAGDROP
     #define HDS_DRAGDROP 0x0040
@@ -3395,16 +3397,8 @@ void wxDataViewMainWindow::DestroyTree()
 
 void wxDataViewMainWindow::OnChar( wxKeyEvent &event )
 {
-    if (event.GetKeyCode() == WXK_TAB)
-    {
-        wxNavigationKeyEvent nevent;
-        nevent.SetWindowChange( event.ControlDown() );
-        nevent.SetDirection( !event.ShiftDown() );
-        nevent.SetEventObject( GetParent()->GetParent() );
-        nevent.SetCurrentFocus( m_parent );
-        if (GetParent()->GetParent()->GetEventHandler()->ProcessEvent( nevent ))
-            return;
-    }
+    if ( HandleAsNavigationKey(event) )
+        return;
 
     // no item -> nothing to do
     if (!HasCurrentRow())
@@ -3711,10 +3705,22 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
         }
 
         // notify cell about right click
-        // cell->...
-
-        // Allow generation of context menu event
-        event.Skip();
+        wxVariant value;
+        model->GetValue( value, item, col->GetModelColumn() );
+        cell->SetValue( value );
+        wxRect cell_rect( xpos, current * m_lineHeight,
+                          col->GetWidth(), m_lineHeight );
+        if (!cell->RightClick( event.GetPosition(), cell_rect, model, item, col->GetModelColumn()))
+        {
+            wxWindow *parent = GetParent();
+            wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, parent->GetId());
+            le.SetItem( item );
+            le.SetEventObject(parent);
+            le.SetModel(GetOwner()->GetModel());
+            le.SetValue(value);
+
+            parent->GetEventHandler()->ProcessEvent(le);
+        }
     }
     else if (event.MiddleDown())
     {