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 (103 lines) | stat: -rw-r--r-- 2,261 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#if defined(Hiro_TabFrame)

auto mTabFrameItem::allocate() -> pObject* {
  return new pTabFrameItem(*this);
}

auto mTabFrameItem::destruct() -> void {
  if(auto& layout = state.layout) layout->destruct();
  mObject::destruct();
}

//

auto mTabFrameItem::append(sLayout layout) -> type& {
  if(auto& layout = state.layout) remove(layout);
  state.layout = layout;
  layout->setParent(this, 0);
  signal(append, layout);
  return *this;
}

auto mTabFrameItem::closable() const -> bool {
  return state.closable;
}

auto mTabFrameItem::icon() const -> image {
  return state.icon;
}

auto mTabFrameItem::layout() const -> Layout {
  return state.layout;
}

auto mTabFrameItem::movable() const -> bool {
  return state.movable;
}

auto mTabFrameItem::remove() -> type& {
  if(auto tabFrame = parentTabFrame()) tabFrame->remove(*this);
  return *this;
}

auto mTabFrameItem::remove(sLayout layout) -> type& {
  signal(remove, layout);
  state.layout.reset();
  layout->setParent();
  return *this;
}

auto mTabFrameItem::reset() -> type& {
  if(auto layout = state.layout) remove(layout);
  return *this;
}

auto mTabFrameItem::selected() const -> bool {
  return state.selected;
}

auto mTabFrameItem::setClosable(bool closable) -> type& {
  state.closable = closable;
  signal(setClosable, closable);
  return *this;
}

auto mTabFrameItem::setIcon(const image& icon) -> type& {
  state.icon = icon;
  signal(setIcon, icon);
  return *this;
}

auto mTabFrameItem::setMovable(bool movable) -> type& {
  state.movable = movable;
  signal(setMovable, movable);
  return *this;
}

auto mTabFrameItem::setParent(mObject* parent, signed offset) -> type& {
  if(auto layout = state.layout) layout->destruct();
  mObject::setParent(parent, offset);
  if(auto layout = state.layout) layout->setParent(this, layout->offset());
  return *this;
}

auto mTabFrameItem::setSelected() -> type& {
  if(auto parent = parentTabFrame()) {
    for(auto& item : parent->state.items) item->state.selected = false;
  }
  state.selected = true;
  signal(setSelected);
  return *this;
}

auto mTabFrameItem::setText(const string& text) -> type& {
  state.text = text;
  signal(setText, text);
  return *this;
}

auto mTabFrameItem::text() const -> string {
  return state.text;
}

#endif