Mercurial > foo_out_sdl
comparison foosdk/sdk/libPPUI/CListControl_EditImpl.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #pragma once | |
| 2 | |
| 3 #include "InPlaceEditTable.h" | |
| 4 #include "GDIUtils.h" // MakeTempBrush() | |
| 5 | |
| 6 //! Implements inplace-edit functionality on top of TParent class. Must derive from CListControlHeaderImpl. | |
| 7 template<typename T_CListControl_EditImpl_Parent> class CListControl_EditImpl : public T_CListControl_EditImpl_Parent, protected InPlaceEdit::CTableEditHelperV2 { | |
| 8 public: | |
| 9 BEGIN_MSG_MAP_EX(CListControl_EditImpl) | |
| 10 CHAIN_MSG_MAP(T_CListControl_EditImpl_Parent) | |
| 11 MESSAGE_HANDLER(WM_CTLCOLOREDIT,OnCtlColor); | |
| 12 MESSAGE_HANDLER(WM_CTLCOLORSTATIC,OnCtlColor); | |
| 13 END_MSG_MAP() | |
| 14 | |
| 15 // IMPLEMENT ME | |
| 16 // virtual void TableEdit_SetField(t_size item, t_size subItem, const char * value) = 0; | |
| 17 protected: | |
| 18 RECT TableEdit_GetItemRect(t_size item, t_size subItem) const override { | |
| 19 return this->GetSubItemRect(item,subItem); | |
| 20 } | |
| 21 void TableEdit_GetField(t_size item, t_size subItem, pfc::string_base & out, t_size & lineCount) override { | |
| 22 lineCount = 1; | |
| 23 if (!this->GetSubItemText(item,subItem,out)) { | |
| 24 PFC_ASSERT(!"Should not get here."); out = ""; | |
| 25 } | |
| 26 } | |
| 27 HWND TableEdit_GetParentWnd() const override {return this->m_hWnd;} | |
| 28 t_size TableEdit_GetItemCount() const override {return this->GetItemCount();} | |
| 29 t_size TableEdit_GetColumnCount() const override {return this->GetColumnCount();} | |
| 30 void TableEdit_SetItemFocus(t_size item, t_size subItem) override { | |
| 31 this->TooltipRemove(); | |
| 32 this->SetFocusItem(item); this->SetSelection(pfc::bit_array_true(), pfc::bit_array_one(item)); | |
| 33 auto rcView = this->GetVisibleRectAbs(); | |
| 34 auto rcEdit = this->GetSubItemRectAbs(item,subItem); | |
| 35 CRect rcTest; | |
| 36 if (!rcTest.IntersectRect(rcView, rcEdit)) { | |
| 37 // Only scroll to subitem if entirely invisible | |
| 38 this->EnsureVisibleRectAbs( rcEdit ); | |
| 39 } | |
| 40 } | |
| 41 void TableEdit_GetColumnOrder(t_size * out, t_size count) const override { | |
| 42 PFC_ASSERT( count == this->GetColumnCount() ); | |
| 43 if ( this->IsHeaderEnabled() ) { | |
| 44 pfc::array_t<int> temp; temp.set_size(count); | |
| 45 WIN32_OP_D( this->GetHeaderCtrl().GetOrderArray((int) temp.get_size(), temp.get_ptr()) ); | |
| 46 for(t_size walk = 0; walk < count; ++walk) out[walk] = (t_size) temp[walk]; | |
| 47 } else { | |
| 48 for(t_size walk = 0; walk < count; ++walk) out[walk] = walk; | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 void TableEdit_OnColorsChanged() {} | |
| 53 bool TableEdit_GetDarkMode() const override { | |
| 54 return this->GetDarkMode(); | |
| 55 } | |
| 56 t_uint32 TableEdit_GetEditFlags(t_size item, t_size subItem) const override { | |
| 57 auto ret = __super::TableEdit_GetEditFlags(item, subItem); | |
| 58 if (this->GetCellTypeSupported()) { | |
| 59 auto cell = this->GetCellType(item, subItem); | |
| 60 if (cell != nullptr) ret |= cell->EditFlags(); | |
| 61 } | |
| 62 return ret; | |
| 63 } | |
| 64 void RequestEditItem(size_t item, size_t subItem) override { | |
| 65 this->TableEdit_Start(item, subItem); | |
| 66 } | |
| 67 private: | |
| 68 LRESULT OnCtlColor(UINT,WPARAM wp,LPARAM lp,BOOL&) { | |
| 69 (void)lp; | |
| 70 CDCHandle dc((HDC)wp); | |
| 71 const COLORREF bkgnd = this->GetSysColorHook(CListControlImpl::colorBackground); | |
| 72 dc.SetTextColor(this->GetSysColorHook(CListControlImpl::colorText)); | |
| 73 dc.SetBkColor(bkgnd); | |
| 74 | |
| 75 return (LRESULT) MakeTempBrush(dc, bkgnd); | |
| 76 } | |
| 77 }; |
