File: tab-frame-item.cpp

package info (click to toggle)
higan 098-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 11,904 kB
  • ctags: 13,286
  • sloc: cpp: 108,285; ansic: 778; makefile: 32; sh: 18
file content (63 lines) | stat: -rw-r--r-- 1,287 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#if defined(Hiro_TabFrame)

namespace hiro {

auto pTabFrameItem::construct() -> void {
}

auto pTabFrameItem::destruct() -> void {
}

auto pTabFrameItem::append(sLayout layout) -> void {
  if(auto parent = _parent()) {
    parent->_synchronizeLayout();
  }
}

auto pTabFrameItem::remove(sLayout layout) -> void {
  if(auto parent = _parent()) {
    parent->_synchronizeLayout();
  }
}

auto pTabFrameItem::setClosable(bool closable) -> void {
  //unsupported
}

auto pTabFrameItem::setIcon(const image& icon) -> void {
  if(auto parent = _parent()) {
    parent->_buildImageList();
  }
}

auto pTabFrameItem::setMovable(bool movable) -> void {
  //unsupported
}

auto pTabFrameItem::setSelected() -> void {
  if(auto parent = _parent()) {
    TabCtrl_SetCurSel(parent->hwnd, self().offset());
    parent->_synchronizeLayout();
  }
}

auto pTabFrameItem::setText(const string& text) -> void {
  if(auto parent = _parent()) {
    utf16_t wText(text);
    TCITEM tcItem;
    tcItem.mask = TCIF_TEXT;
    tcItem.pszText = (wchar_t*)wText;
    TabCtrl_SetItem(parent->hwnd, self().offset(), &tcItem);
  }
}

auto pTabFrameItem::_parent() -> maybe<pTabFrame&> {
  if(auto parent = self().parentTabFrame()) {
    if(auto self = parent->self()) return *self;
  }
  return nothing;
}

}

#endif