在OSX上使用wxDataViewCtrl的通用实现

时间:2016-03-21 14:22:56

标签: wxwidgets

默认情况下,wxDataViewCtrl在OSX下具有本机实现。如何在OSX下使用wxDataViewCtrl的通用实现。 我不想在wxWidgets Code中进行任何更改。我更喜欢宏或一些特定的标题。

此外,我正在考虑如何同时使用本机和通用实现。

尝试了建议的方式:

构建wxWidgets动态库时出现错误:

./src/osx/dataview_osx.cpp:101:38: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
  noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Add(parent,item);
                  ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:112:38: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
  noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Add(parent,items);
                  ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:123:26: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
  if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(item),item))
      ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:153:28: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
    if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(items[indexItem]),items[indexItem]))
        ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:178:22: error: no member named 'SetDeleting' in 'wxDataViewCtrl'
  m_DataViewCtrlPtr->SetDeleting(true);
  ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:179:38: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
  noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent,item);
                  ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:181:22: error: no member named 'SetDeleting' in 'wxDataViewCtrl'
  m_DataViewCtrlPtr->SetDeleting(false);
  ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:197:22: error: no member named 'SetDeleting' in 'wxDataViewCtrl'
  m_DataViewCtrlPtr->SetDeleting(true);
  ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:199:38: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
  noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent,items);
                  ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:201:22: error: no member named 'SetDeleting' in 'wxDataViewCtrl'
  m_DataViewCtrlPtr->SetDeleting(false);
  ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:212:26: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
  if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(item),item))
      ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:233:29: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
  return m_DataViewCtrlPtr->GetDataViewPeer()->Reload();
         ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:238:22: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
  m_DataViewCtrlPtr->GetDataViewPeer()->Resort();
  ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:252:55: error: no member named 'GetColumnPtr' in 'wxDataViewCtrl'; did you mean 'GetColumnAt'?
          wxDataViewColumn* column(m_DataViewCtrlPtr->GetColumnPtr(col));
                                                      ^~~~~~~~~~~~
                                                      GetColumnAt
./include/wx/generic/dataview.h:248:23: note: 'GetColumnAt' declared here
    wxDataViewColumn *GetColumnAt(unsigned int pos) const;
                      ^
./src/osx/dataview_osx.cpp:267:28: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
        m_DataViewCtrlPtr->GetDataViewPeer()->SetRowHeight(item,height);
        ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:287:57: error: no member named 'GetColumnPtr' in 'wxDataViewCtrl'; did you mean 'GetColumnAt'?
            wxDataViewColumn* column(m_DataViewCtrlPtr->GetColumnPtr(col));
                                                        ^~~~~~~~~~~~
                                                        GetColumnAt
./include/wx/generic/dataview.h:248:23: note: 'GetColumnAt' declared here
    wxDataViewColumn *GetColumnAt(unsigned int pos) const;
                      ^
./src/osx/dataview_osx.cpp:302:30: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
          m_DataViewCtrlPtr->GetDataViewPeer()->SetRowHeight(items[itemIndex],height);
          ~~~~~~~~~~~~~~~~~  ^
./src/osx/dataview_osx.cpp:312:53: error: no member named 'GetColumnPtr' in 'wxDataViewCtrl'; did you mean 'GetColumnAt'?
      wxDataViewColumn *column = m_DataViewCtrlPtr->GetColumnPtr(col);
                                                    ^~~~~~~~~~~~
                                                    GetColumnAt
./include/wx/generic/dataview.h:248:23: note: 'GetColumnAt' declared here
    wxDataViewColumn *GetColumnAt(unsigned int pos) const;
                      ^
./src/osx/dataview_osx.cpp:314:20: error: no member named 'GetWidthVariable' in 'wxDataViewColumn'
      if ( column->GetWidthVariable() == wxCOL_WIDTH_AUTOSIZE )
           ~~~~~~  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [advdll_dataview_osx.o] Error 1

3 个答案:

答案 0 :(得分:0)

#include <wx/generic/dataview.h>

答案 1 :(得分:0)

您需要全局预定义wxHAS_GENERIC_DATAVIEWCTRL并使用它重建wxWidgets和您的应用程序。

目前无法在同一版本中同时使用此控件的本机和通用实现。

答案 2 :(得分:0)

我们需要使用以下两者构建wxWidgets:

wxHAS_GENERIC_DATAVIEWCTRL
wxUSE_GENERICDATAVIEWCTRL

只有wxHAS_GENERIC_DATAVIEWCTRL无效。注意,现在我可以在OSX上使用wxWidgets的通用实现。