本文整理汇总了C++中DockCont类的典型用法代码示例。如果您正苦于以下问题:C++ DockCont类的具体用法?C++ DockCont怎么用?C++ DockCont使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DockCont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComposeTab
void AutoHideBar::ComposeTab(Tab& tab, const Font &font, Color ink, int style)
{
DockableCtrl *d;
WString txt;
const Value &q = tab.value;
ink = (style == CTRL_DISABLED) ? SColorDisabled : ink;
if (IsTypeRaw<DockCont *>(q)) {
DockCont *c = ValueTo<DockCont *>(q);
d = &c->GetCurrent();
txt = c->GetTitle();
}
else {
ASSERT(IsTypeRaw<DockableCtrl *>(q));
d = ValueTo<DockableCtrl *>(q);
txt = d->GetTitle();
}
if(icons)
{
tab.AddImage((style == CTRL_DISABLED) ? DisabledImage(d->GetIcon()) : d->GetIcon());
}
if (showtext)
{
tab.AddText(txt, font, ink);
}
}
示例2: KillTimeCallback
void DockWindow::ContainerDragEnd(DockCont &dc)
{
KillTimeCallback(TIMEID_ANIMATE_DELAY);
if (!dc.IsFloating()) return;
HighlightCtrl &hl = GetHighlightCtrl();
Ctrl *p = hl.GetParent();
int align = DOCK_NONE;
if (p)
for (int i = 0; i < 4; i++)
if (p == &dockpane[i]) align = i;
if (animatewnd && (p || align != DOCK_NONE)) {
FloatAnimate(dc, hl.GetScreenRect());
}
if (align != DOCK_NONE) {
Unfloat(dc);
dc.StateDocked(*this);
dockpane[align].Swap(hl, dc);
}
else if (DockCont *target = dynamic_cast<DockCont *>(p)) {
StopHighlight(false);
bool nest = (GetMouseFlags() & NestedToggleKey()) ? !IsNestedTabs() : IsNestedTabs();
DockContainerAsTab(*target, dc, nest && dc.GetCount() > 1);
}
else
StopHighlight(false);
if (dc.GetParent())
dc.SetFocus();
}
示例3: Get0
void DockCont::TabSelected()
{
int ix = tabbar.GetCursor();
if (ix >= 0) {
DockableCtrl *dc = Get0(ix);
if (!dc) return;
Ctrl *ctrl = GetCtrl(ix);
Ctrl *first = &handle;
for (Ctrl *c = first->GetNext(); c; c = c->GetNext())
if (c != ctrl) c->Hide();
ctrl->Show();
Icon(dc->GetIcon()).Title(dc->GetTitle());
handle.dc = dc;
SyncButtons(*dc);
if (IsTabbed()) {
DockCont *c = static_cast<DockCont *>(GetParent());
c->tabbar.SyncRepos();
c->TabSelected();
c->RefreshFrame();
}
else
RefreshLayout();
}
}
示例4: Undock
void DockWindow::Undock(DockCont &c)
{
if (!c.IsFloating() && !c.IsHidden()) {
if (c.IsAutoHide()) {
for (int i = 0; i < 4; i++) {
int ix = hideframe[i].FindCtrl(c);
if (ix >= 0) {
hideframe[i].RemoveCtrl(ix);
hideframe[i].RefreshFrame();
break;
}
}
}
else {
int dock = GetDockAlign(c);
if (dock >= 0 && dock < 4) {
Ctrl *p = &c;
while (p && p->GetParent() != &dockpane[dock]) p = p->GetParent();
ASSERT(p);
bool v = !IsTB(dock);
c.SyncUserSize(v, !v);
}
Undock0(c);
}
c.StateNotDocked();
}
}
示例5:
/*
* Container management
*/
DockCont * DockWindow::CreateContainer()
{
DockCont *dc = &conts.Add();
dc->StateNotDocked(this);
SyncContainer(*dc);
return dc;
}
示例6: FloatFromTab
void DockWindow::FloatFromTab(DockCont &c, DockCont &tab)
{
Rect r = c.GetScreenRect();
tab.SetRect(r);
tab.StateDocked(*this);
c.RefreshLayout();
tab.MoveBegin();
}
示例7: ALIGN_ASSERT
void DockWindow::AutoHide(int align, DockableCtrl &dc)
{
ALIGN_ASSERT(align);
Register(dc);
DockCont *c = GetReleasedContainer(dc);
c->StateAutoHide(*this);
hideframe[align].AddCtrl(*c, dc.GetGroup());
}
示例8: ContCast
void DockCont::Serialize(Stream& s)
{
int ctrl = 'D';
int cont = 'C';
const Vector<DockableCtrl *> &dcs = base->GetDockableCtrls();
if (s.IsStoring()) {
if (GetCount() == 1 && IsDockCont(tabbar.Get(0)))
return ContCast(tabbar.Get(0))->Serialize(s);
int cnt = GetCount();
s / cont / cnt;
for (int i = GetCount() - 1; i >= 0; i--) {
if (IsDockCont(tabbar.Get(i)))
ContCast(tabbar.Get(i))->Serialize(s);
else {
DockableCtrl *dc = DockCast(tabbar.Get(i));
int ix = base->FindDocker(dc);
s / ctrl / ix;
}
}
int cursor = tabbar.GetCursor();
int groupix = tabbar.GetGroup();
s / cursor / groupix;
}
else {
int cnt;
int type;
s / type / cnt;
ASSERT(type == cont);
for (int i = 0; i < cnt; i++) {
int64 pos = s.GetPos();
s / type;
if (type == cont) {
s.Seek(pos);
DockCont *dc = base->CreateContainer();
dc->Serialize(s);
base->DockContainerAsTab(*this, *dc, true);
}
else if (type == ctrl) {
int ix;
s / ix;
if (ix >= 0 && ix <= dcs.GetCount())
Add(*dcs[ix]);
}
else
ASSERT(false);
}
int cursor, groupix;
s / cursor / groupix;
tabbar.SetGroup(groupix);
tabbar.SetCursor(min(tabbar.GetCount()-1, cursor));
TabSelected();
}
}
示例9: GetContainer
void DockWindow::Close(DockableCtrl &dc)
{
DockCont *c = GetContainer(dc);
if (c && c->GetCount() > 1) {
dc.Remove();
c->Layout();
c = NULL;
}
if (c) CloseContainer(*c);
}
示例10: GetMousePos
DockCont *DockWindow::FindDockTarget(DockCont &dc, int &dock)
{
Point p = GetMousePos();
Rect r = GetScreenView();
DockCont *target = NULL;
int align = DOCK_NONE;
dock = DOCK_NONE;
if (r.Contains(p)) {
dock = GetPointAlign(p, r, true, true, true);
if (dock != DOCK_NONE && dockpane[dock].IsVisible())
dock = DOCK_NONE;
}
else {
target = GetMouseDockTarget();
if (target) {
r = target->GetScreenRect();
dock = GetDockAlign(*target);
align = GetPointAlign(p, r, IsTabbing(), IsTB(dock), !IsTB(dock));
}
else
return NULL;
}
if (dock != DOCK_NONE && (!dc.IsDockAllowed(dock)
|| IsPaneAnimating(dock) || IsFrameAnimating(dock))
|| (dock == DOCK_NONE && !target)) {
dock = DOCK_NONE;
return NULL;
}
// Prepare for highlight
if (target) {
GetHighlightCtrl().bounds = GetAlignBounds(align, r, IsTabbing(), IsTB(dock), !IsTB(dock));
if (align == DOCK_NONE)
dock = DOCK_NONE; // Tabbing
// The following code handles the case of an insertion between two docked controls. In this case we must set
// the highlight bounds to be a union of the bounds from each control. Very ugly.
if (dock != DOCK_NONE) {
Ctrl *c = IsTL(align) ? target->GetPrev() : target->GetNext();
if (c) {
int opal = align > 1 ? align-2 : align+2;
GetHighlightCtrl().bounds.Union(GetAlignBounds(opal, c->GetScreenRect(), IsTabbing()));
}
target = IsTL(align) ? target : dynamic_cast<DockCont*>(target->GetNext());
}
}
else if (dock != DOCK_NONE)
GetHighlightCtrl().bounds = GetAlignBounds(dock, r, true);
return target;
}
示例11: AddFrom
void DockCont::AddFrom(DockCont &cont, int except)
{
bool all = except < 0 || except >= cont.GetCount();
for (int i = cont.GetCount() - 1; i >= 0; i--)
if (i != except) {
Ctrl *c = cont.GetCtrl(i);
c->Remove();
Add(*c);
}
if (all)
cont.tabbar.Clear();
}
示例12: FloatContainer
void DockWindow::FloatContainer(DockCont &c, Point p)
{
ASSERT(IsOpen());
if (c.IsFloating()) return;
if (p.IsNullInstance())
p = GetScreenRect().CenterPoint();
Detach(c);
c.StateFloating(*this);
Size best = CtrlBestSize(c, false);
c.SetRect(Rect(p, best));
c.Open(this);
}
示例13: DockContainerAsTab
void DockWindow::DockContainerAsTab(DockCont &target, DockCont &c, bool do_nested)
{
Detach(c);
if (do_nested) {
c.StateTabbed(*this);
target << c;
}
else {
target.AddFrom(c);
DestroyContainer(c);
}
}
示例14: GetMouseDockTarget
void PopUpDockWindow::ContainerDragMove(DockCont &dc)
{
int align = DOCK_NONE;
// Is the highlight the same as last time? (Quick escape)
if (last_popup && last_popup->IsPopUp() && last_popup->GetRect().Contains(GetMousePos()))
return;
DockCont *target = GetMouseDockTarget();
int dock = DOCK_NONE;
if (target) {
dock = GetDockAlign(*target);
if (!dc.IsDockAllowed(dock))
target = NULL;
}
bool target_changed = (target != last_target)
&& !GetHighlightCtrl().GetParent()
&& (!target || !IsPaneAnimating(dock));
// Hide show inner popups as necessary
if (!target && last_target != NULL)
HidePopUps(true, false);
else if (target_changed)
ShowInnerPopUps(dc, target);
ShowOuterPopUps(dc);
last_target = target;
// Get potential alignment
align = PopUpHighlight(inner, 5);
if (align == DOCK_NONE) {
target = NULL;
last_target = NULL;
align = PopUpHighlight(outer, 4);
}
else if (align == 4)
align = DOCK_NONE;
else if (target) {
target = IsTL(align) ? target : dynamic_cast<DockCont*>(target->GetNext());
align = dock;
}
// Do highlight
if (align != DOCK_NONE || target) {
if (align == DOCK_NONE) StopHighlight(false);
dc.SyncUserSize(true, true);
Highlight(align, dc, target);
}
else {
StopHighlight(IsAnimatedHighlight());
last_popup = NULL;
}
}
示例15: ShowOuterPopUps
void PopUpDockWindow::ShowOuterPopUps(DockCont &dc)
{
Rect wrect = GetScreenRect();
Point cp = wrect.CenterPoint();
Size psz(style->outersize, style->outersize);
Rect prect = Rect(psz);
psz /= 2;
wrect.Deflate(12, 12);
if (dc.IsDockAllowed(DOCK_LEFT)) ShowPopUp(outer[DOCK_LEFT], prect.Offseted(wrect.left + POPUP_SPACING, cp.y - psz.cy));
if (dc.IsDockAllowed(DOCK_TOP)) ShowPopUp(outer[DOCK_TOP], prect.Offseted(cp.x - psz.cx, wrect.top + POPUP_SPACING));
if (dc.IsDockAllowed(DOCK_RIGHT)) ShowPopUp(outer[DOCK_RIGHT], prect.Offseted(wrect.right - POPUP_SPACING - psz.cx*2, cp.y - psz.cy));
if (dc.IsDockAllowed(DOCK_BOTTOM)) ShowPopUp(outer[DOCK_BOTTOM], prect.Offseted(cp.x - psz.cx, wrect.bottom - POPUP_SPACING - psz.cy*2));
}