// 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
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
// called when any column setting is changed and/or changed
// the column count
virtual void UpdateDisplay();
-
+
virtual void OnInternalIdle();
// called Refresh afterwards
virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL);
-
- virtual bool CanApplyThemeBorder() const { return false; }
+
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
protected:
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
-
+
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
wxSize DoGetBestSize() const;
wxDataViewColumn *GetColumnFromHeader(NMHEADER *nmHDR)
{ return GetColumn(GetColumnIdxFromHeader(nmHDR)); }
-
+
int m_scrollOffsetX;
int m_buttonHeight;
bool m_delayedUpdate;
colour = dc->GetTextForeground();
dc->SetTextForeground( m_attr.GetColour() );
}
-
+
if (m_attr.GetBold() || m_attr.GetItalic())
{
font = dc->GetFont();
dc->SetFont( myfont );
}
}
-
+
dc->DrawText( m_text, cell.x, cell.y + ((cell.height - dc->GetCharHeight()) / 2));
-
+
// restore dc
if (m_hasAttr)
{
if (m_attr.HasColour())
dc->SetTextForeground( colour );
-
+
if (m_attr.GetBold() || m_attr.GetItalic())
dc->SetFont( font );
}
-
+
return true;
}
-
+
// ---------------------------------------------------------
// wxDataViewBitmapRenderer
SetTitle(title);
SetFlags(flags);
+ m_autosize = width < 0; // TODO
+
Init(width < 0 ? wxDVC_DEFAULT_WIDTH : width);
}
parent->GetEventHandler()->ProcessEvent(le);
}
-#if defined(__WXMSW__) && USE_NATIVE_HEADER_WINDOW
+#ifdef USE_NATIVE_HEADER_WINDOW
#ifndef HDS_DRAGDROP
#define HDS_DRAGDROP 0x0040
// create the native WC_HEADER window:
WXHWND hwndParent = (HWND)parent->GetHandle();
WXDWORD msStyle = WS_CHILD | HDS_DRAGDROP | HDS_BUTTONS | HDS_HORZ | HDS_HOTTRACK | HDS_FULLDRAG;
-
+
if ( m_isShown )
msStyle |= WS_VISIBLE;
-
+
m_hWnd = CreateWindowEx(0,
WC_HEADER,
(LPCTSTR) NULL,
// the following is required to get the default win's font for
// header windows and must be done befor sending the HDM_LAYOUT msg
SetFont(GetFont());
-
+
return true;
}
m_delayedUpdate = true;
}
break;
-
+
case HDN_ITEMCHANGING:
if (nmHDR->pitem != NULL &&
(nmHDR->pitem->mask & HDI_WIDTH) != 0)
const wxRect * WXUNUSED(rect))
{
m_scrollOffsetX += dx;
-
+
GetParent()->Layout();
}
SetBackgroundColour( *wxWHITE );
+ SetBackgroundStyle(wxBG_STYLE_CUSTOM);
+
m_penRule = wxPen(GetRuleColour(), 1, wxSOLID);
//Here I compose a pen can draw black lines, maybe there are something system colour to use
wxVariant value;
wxDataViewTreeNode *node = NULL;
wxDataViewItem dataitem;
-
+
if (m_root)
{
node = GetTreeNodeByRow(item);
model->GetValue( value, dataitem, col->GetModelColumn());
cell->SetValue( value );
-
+
if (cell->GetWantsAttr())
{
wxDataViewItemAttr attr;
if ((m_root) && (col == expander))
{
indent = node->GetIndentLevel();
-
+
//Calculate the indent first
indent = cell_rect.x + GetOwner()->GetIndent() * indent;
// I am wondering whether we should draw dot lines between tree nodes
if (node)
delete node;
- // Yes, if the node does not have any child, it must be a leaf which
+ // Yes, if the node does not have any child, it must be a leaf which
// mean that it is a temporarily created by GetTreeNodeByRow
}
UpdateDisplay();
return true;
}
-
+
SortPrepare();
wxDataViewTreeNode * node;
m_currentRow = m_count - 1;
m_selection.Empty();
-
+
UpdateDisplay();
return true;
bool wxDataViewMainWindow::Cleared()
{
DestroyTree();
-
+
SortPrepare();
BuildTree( GetOwner()->GetModel() );
-
+
UpdateDisplay();
return true;
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())
}
// 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())
{
model->AddNotifier( m_notifier );
m_clientArea->DestroyTree();
-
+
m_clientArea->BuildTree(model);
m_clientArea->UpdateDisplay();
if (new_pos > m_cols.GetCount()) return;
m_cols.DeleteObject( col );
m_cols.Insert( new_pos, col );
-
+
m_clientArea->UpdateDisplay();
}