本文整理汇总了C++中wxListItem::GetColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ wxListItem::GetColumn方法的具体用法?C++ wxListItem::GetColumn怎么用?C++ wxListItem::GetColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxListItem
的用法示例。
在下文中一共展示了wxListItem::GetColumn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetItem
bool wxListCtrl::SetItem(wxListItem& info)
{
const long id = info.GetId();
QTreeWidgetItem *qitem = QtGetItem(id);
if ( qitem != NULL )
{
if ((info.m_mask & wxLIST_MASK_TEXT) && !info.GetText().IsNull() )
qitem->setText(info.GetColumn(), wxQtConvertString(info.GetText()));
qitem->setTextAlignment(info.GetColumn(), wxQtConvertTextAlign(info.GetAlign()));
if ( info.m_mask & wxLIST_MASK_DATA )
{
QVariant variant = qVariantFromValue(info.GetData());
qitem->setData(0, Qt::UserRole, variant);
}
if (info.m_mask & wxLIST_MASK_STATE)
{
if ((info.m_stateMask & wxLIST_STATE_FOCUSED) &&
(info.m_state & wxLIST_STATE_FOCUSED))
m_qtTreeWidget->setCurrentItem(qitem, 0);
if (info.m_stateMask & wxLIST_STATE_SELECTED)
qitem->setSelected(info.m_state & wxLIST_STATE_SELECTED);
}
if (info.m_mask & wxLIST_MASK_IMAGE)
{
if (info.m_image >= 0)
{
wxImageList *imglst = GetImageList(InReportView() ? wxIMAGE_LIST_SMALL : wxIMAGE_LIST_NORMAL);
wxCHECK_MSG(imglst, false, "invalid listctrl imagelist");
const wxBitmap* bitmap = imglst->GetBitmapPtr(info.m_image);
if (bitmap != NULL)
{
// set the new image:
qitem->setIcon( info.GetColumn(), QIcon( *bitmap->GetHandle() ));
}
}
else
{
// remove the image using and empty qt icon:
qitem->setIcon( info.GetColumn(), QIcon() );
}
}
for (int col=0; col<GetColumnCount(); col++)
{
if ( info.GetFont().IsOk() )
qitem->setFont(col, info.GetFont().GetHandle() );
if ( info.GetTextColour().IsOk() )
qitem->setTextColor(col, info.GetTextColour().GetHandle());
if ( info.GetBackgroundColour().IsOk() )
qitem->setBackgroundColor(col, info.GetBackgroundColour().GetHandle());
}
return true;
}
else
return false;
}
示例2: GetItem
bool wxListCtrl::GetItem(wxListItem& info) const
{
const long id = info.GetId();
QTreeWidgetItem *qitem = QtGetItem(id);
if ( qitem != NULL )
{
if ( !info.m_mask )
// by default, get everything for backwards compatibility
info.m_mask = -1;
if ( info.m_mask & wxLIST_MASK_TEXT )
info.SetText(wxQtConvertString(qitem->text(info.GetColumn())));
if ( info.m_mask & wxLIST_MASK_DATA )
{
QVariant variant = qitem->data(0, Qt::UserRole);
info.SetData(variant.value<long>());
}
if ( info.m_mask & wxLIST_MASK_STATE )
{
info.m_state = wxLIST_STATE_DONTCARE;
if ( info.m_stateMask & wxLIST_STATE_FOCUSED )
{
if ( m_qtTreeWidget->currentIndex().row() == id )
info.m_state |= wxLIST_STATE_FOCUSED;
}
if ( info.m_stateMask & wxLIST_STATE_SELECTED )
{
if ( qitem->isSelected() )
info.m_state |= wxLIST_STATE_SELECTED;
}
}
return true;
}
else
return false;
}
示例3: GetItem
bool wxCheckedListCtrl::GetItem(wxListItem &info) const
{
// wx internal wxListCtrl::GetItem remove from the state mask the
// wxLIST_STATE_CHECKED & wxLIST_STATE_ENABLED bits since they
// are not part of wx standard flags... so we need to check those
// flags against the original wxListItem's statemask...
wxListItem original(info);
#ifdef __WXDEBUG__
// we always want to retrieve also the image state for checking purposes...
info.m_mask |= wxLIST_MASK_IMAGE;
#endif
if (!wxListCtrl::GetItem(info))
return FALSE;
// these are our additional supported states: read them from m_stateList
bool checked = (m_stateList[info.m_itemId] & wxLIST_STATE_CHECKED) != 0;
bool enabled = (m_stateList[info.m_itemId] & wxLIST_STATE_ENABLED) != 0;
// now intercept state requests about enable or check mode
if ((original.m_mask & wxLIST_MASK_STATE) &&
(original.m_stateMask & wxLIST_STATE_CHECKED))
{
info.m_state |= (m_stateList[info.m_itemId] & wxLIST_STATE_CHECKED);
info.m_stateMask |= wxLIST_STATE_CHECKED;
info.m_mask |= wxLIST_MASK_STATE; // contains valid info !
}
if ((original.m_mask & wxLIST_MASK_STATE) &&
(original.m_stateMask & wxLIST_STATE_ENABLED))
{
info.m_state |= (m_stateList[info.m_itemId] & wxLIST_STATE_ENABLED);
info.m_stateMask |= wxLIST_STATE_ENABLED;
info.m_mask |= wxLIST_MASK_STATE; // contains valid info !
}
// check that state & image are synch
#if CLC_VBAM_USAGE
if (info.GetColumn())
return TRUE;
#endif
#ifdef __WXDEBUG__
wxASSERT_MSG((int)m_stateList.GetCount() == (int)GetItemCount(),
wxT("Something wrong ! See InsertItem()"));
// read info by image index
bool imagecheck = (info.m_image == wxCLC_CHECKED_IMGIDX) ||
(info.m_image == wxCLC_DISABLED_CHECKED_IMGIDX);
bool imageenabled = (info.m_image == wxCLC_CHECKED_IMGIDX) ||
(info.m_image == wxCLC_UNCHECKED_IMGIDX);
wxASSERT_MSG((checked && imagecheck) || (!checked && !imagecheck),
wxT("This is item has checked state but it's shown as unchecked (or viceversa)"));
wxASSERT_MSG((enabled && imageenabled) || (!enabled && !imageenabled),
wxT("This is item has enabled state but it's shown as disabled (or viceversa)"));
#endif
return TRUE;
}
示例4: RestoreListColumnState
void CViewBase::RestoreListColumnState(wxString strName, wxListItem& liColumnInfo)
{
CConfigManager* pConfig = wxGetApp().GetConfigManager();
long lTempValue = 0;
if (pConfig->GetConfigValue(GetViewName(), strName, wxT("Width"), -1, &lTempValue))
{
liColumnInfo.SetWidth(lTempValue);
}
m_pListPane->SetColumn(liColumnInfo.GetColumn(), liColumnInfo);
}
示例5: SetItem
bool wxCheckedListCtrl::SetItem(wxListItem &info)
{
#if CLC_VBAM_USAGE
// only col 0 gets a checkbox
if (info.GetColumn())
return wxListCtrl::SetItem(info);
#endif
// remove the checked & enabled states from the state flag:
// we'll store them in our separate array
int additionalstate = GetAndRemoveAdditionalState(&info.m_state, info.m_stateMask);
// set image index
// we will ignore the info.m_image field since we need
// to overwrite it...
if (info.m_mask & wxLIST_MASK_STATE)
{
// if some state is not included in the state mask, then get the state info
// from our internal state array
if (!(info.m_stateMask & wxLIST_STATE_ENABLED))
additionalstate |= (m_stateList[info.m_itemId] & wxLIST_STATE_ENABLED);
if (!(info.m_stateMask & wxLIST_STATE_CHECKED))
additionalstate |= (m_stateList[info.m_itemId] & wxLIST_STATE_CHECKED);
// state is valid: use it to determine the image to set...
info.m_mask |= wxLIST_MASK_IMAGE;
info.m_image = GetItemImageFromAdditionalState(additionalstate);
// since when changing the background color, also the foreground color
// and the font of the item are changed, we try to respect the user
// choices of such attributes
info.SetTextColour(this->GetItemTextColour(info.GetId()));
#if wxCHECK_VERSION(2, 6, 2)
// before wx 2.6.2 the wxListCtrl::SetItemFont function is missing
info.SetFont(this->GetItemFont(info.GetId()));
#endif
// change the background color to respect the enabled/disabled status...
info.SetBackgroundColour(GetBgColourFromAdditionalState(additionalstate));
m_stateList[info.m_itemId] = additionalstate;
}
else
{
// state is invalid; don't change image
info.m_mask &= ~wxLIST_MASK_IMAGE;
}
// save the changes
return wxListCtrl::SetItem(info);
}