tab-frame-item.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #if defined(Hiro_TabFrame)
  2. namespace hiro {
  3. auto pTabFrameItem::construct() -> void {
  4. }
  5. auto pTabFrameItem::destruct() -> void {
  6. }
  7. auto pTabFrameItem::append(sSizable sizable) -> void {
  8. if(auto parent = _parent()) {
  9. parent->_synchronizeSizable();
  10. }
  11. }
  12. auto pTabFrameItem::remove(sSizable sizable) -> void {
  13. if(auto parent = _parent()) {
  14. parent->_synchronizeSizable();
  15. }
  16. }
  17. auto pTabFrameItem::setClosable(bool closable) -> void {
  18. //unsupported
  19. }
  20. auto pTabFrameItem::setIcon(const image& icon) -> void {
  21. if(auto parent = _parent()) {
  22. parent->_buildImageList();
  23. }
  24. }
  25. auto pTabFrameItem::setMovable(bool movable) -> void {
  26. //unsupported
  27. }
  28. auto pTabFrameItem::setSelected() -> void {
  29. if(auto parent = _parent()) {
  30. TabCtrl_SetCurSel(parent->hwnd, self().offset());
  31. parent->_synchronizeSizable();
  32. }
  33. }
  34. auto pTabFrameItem::setText(const string& text) -> void {
  35. if(auto parent = _parent()) {
  36. utf16_t wText(text);
  37. TCITEM tcItem;
  38. tcItem.mask = TCIF_TEXT;
  39. tcItem.pszText = (wchar_t*)wText;
  40. TabCtrl_SetItem(parent->hwnd, self().offset(), &tcItem);
  41. }
  42. }
  43. auto pTabFrameItem::_parent() -> maybe<pTabFrame&> {
  44. if(auto parent = self().parentTabFrame()) {
  45. if(auto self = parent->self()) return *self;
  46. }
  47. return nothing;
  48. }
  49. }
  50. #endif