📄 dockingmegademomain.cpp
字号:
cbAllowDockBottom->Enabled = true;
cbAllowDockBottom->Checked = FDockControl->AllowDock.Contains(dtBottom);
cbAllowDockClient->Enabled = true;
cbAllowDockClient->Checked = FDockControl->AllowDock.Contains(dtClient);
cbAllowFloating->Enabled = true;
cbAllowFloating->Checked = FDockControl->AllowFloating;
cbAllowDockClientsLeft->Enabled = true;
cbAllowDockClientsLeft->Checked = FDockControl->AllowDockClients.Contains(dtLeft);
cbAllowDockClientsTop->Enabled = true;
cbAllowDockClientsTop->Checked = FDockControl->AllowDockClients.Contains(dtTop);
cbAllowDockClientsRight->Enabled = true;
cbAllowDockClientsRight->Checked = FDockControl->AllowDockClients.Contains(dtRight);
cbAllowDockClientsBottom->Enabled = true;
cbAllowDockClientsBottom->Checked = FDockControl->AllowDockClients.Contains(dtBottom);
cbAllowDockClientsClient->Enabled = true;
cbAllowDockClientsClient->Checked = FDockControl->AllowDockClients.Contains(dtClient);
if (dynamic_cast<TdxTabContainerDockSite*>(FDockControl)) {
cbTabsOnTop->Enabled = true;
cbTabsOnTop->Checked = ((TdxTabContainerDockSite*)FDockControl)->TabsPosition == Dxdockcontrol::tctpTop;
cbTabsScrollable->Enabled = true;
cbTabsScrollable->Checked = ((TdxTabContainerDockSite*)FDockControl)->TabsScroll;}
else {
cbTabsOnTop->Enabled = false;
cbTabsScrollable->Enabled = false;
};
btnApply->Enabled = true;
btnCancel->Enabled = true;
}
else DisableProperties();
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::ApplyProperties()
{
TdxDockingTypes ADockTypes;
if ((FDockControl == NULL) || (FDockControl->ComponentState.Contains(csDestroying))) return;
FDockControl->ManagerColor = cbManagerColor->Checked;
FDockControl->ManagerFont = cbManagerFont->Checked;
FDockControl->Caption = eCaption->Text;
FDockControl->ShowCaption = cbShowCaption->Checked;
FDockControl->CaptionButtons.Clear();
if (cbShowCloseButton->Checked)
FDockControl->CaptionButtons = FDockControl->CaptionButtons + (TdxCaptionButtons() << cbClose);
if (cbShowMaxButton->Checked)
FDockControl->CaptionButtons = FDockControl->CaptionButtons + (TdxCaptionButtons() << cbMaximize);
if (cbShowHideButton->Checked)
FDockControl->CaptionButtons = FDockControl->CaptionButtons + (TdxCaptionButtons() << cbHide);
ADockTypes.Clear();
if (cbAllowDockLeft->Checked) ADockTypes = ADockTypes + (TdxDockingTypes() << dtLeft);
if (cbAllowDockTop->Checked) ADockTypes = ADockTypes + (TdxDockingTypes() << dtTop);
if (cbAllowDockRight->Checked) ADockTypes = ADockTypes + (TdxDockingTypes() << dtRight);
if (cbAllowDockBottom->Checked) ADockTypes = ADockTypes + (TdxDockingTypes() << dtBottom);
if (cbAllowDockClient->Checked) ADockTypes = ADockTypes + (TdxDockingTypes() << dtClient);
FDockControl->AllowDock = ADockTypes;
FDockControl->AllowFloating = cbAllowFloating->Checked;
ADockTypes.Clear();
if (cbAllowDockClientsLeft->Checked) ADockTypes = ADockTypes + (TdxDockingTypes() << dtLeft);
if (cbAllowDockClientsTop->Checked) ADockTypes = ADockTypes + (TdxDockingTypes() << dtTop);
if (cbAllowDockClientsRight->Checked) ADockTypes = ADockTypes + (TdxDockingTypes() << dtRight);
if (cbAllowDockClientsBottom->Checked) ADockTypes = ADockTypes + (TdxDockingTypes() << dtBottom);
if (cbAllowDockClientsClient->Checked) ADockTypes = ADockTypes + (TdxDockingTypes() << dtClient);
FDockControl->AllowDockClients = ADockTypes;
if(dynamic_cast<TdxTabContainerDockSite*>(FDockControl)) {
if( cbTabsOnTop->Checked)
((TdxTabContainerDockSite*)FDockControl)->TabsPosition = Dxdockcontrol::tctpTop;
else ((TdxTabContainerDockSite*)FDockControl)->TabsPosition = Dxdockcontrol::tctpBottom;
((TdxTabContainerDockSite*)FDockControl)->TabsScroll = cbTabsScrollable->Checked;
}
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::DisableProperties()
{
cbManagerColor->Checked = false;
cbManagerColor->Enabled = false;
cbManagerFont->Checked = false;
cbManagerFont->Enabled = false;
eCaption->Text = "";
eCaption->Enabled = false;
cbShowCaption->Checked = false;
cbShowCaption->Enabled = false;
cbShowCloseButton->Checked = false;
cbShowCloseButton->Enabled = false;
cbShowMaxButton->Checked = false;
cbShowMaxButton->Enabled = false;
cbShowHideButton->Checked = false;
cbShowHideButton->Enabled = false;
cbAllowDockLeft->Checked = false;
cbAllowDockLeft->Enabled = false;
cbAllowDockTop->Checked = false;
cbAllowDockTop->Enabled = false;
cbAllowDockRight->Checked = false;
cbAllowDockRight->Enabled = false;
cbAllowDockBottom->Checked = false;
cbAllowDockBottom->Enabled = false;
cbAllowDockClient->Checked = false;
cbAllowDockClient->Enabled = false;
cbAllowFloating->Checked = false;
cbAllowFloating->Enabled = false;
cbAllowDockClientsLeft->Checked = false;
cbAllowDockClientsLeft->Enabled = false;
cbAllowDockClientsTop->Checked = false;
cbAllowDockClientsTop->Enabled = false;
cbAllowDockClientsRight->Checked = false;
cbAllowDockClientsRight->Enabled = false;
cbAllowDockClientsBottom->Checked = false;
cbAllowDockClientsBottom->Enabled = false;
cbAllowDockClientsClient->Checked = false;
cbAllowDockClientsClient->Enabled = false;
cbTabsOnTop->Checked = false;
cbTabsOnTop->Enabled = false;
cbTabsScrollable->Checked = false;
cbTabsScrollable->Enabled = false;
btnApply->Enabled = false;
btnCancel->Enabled = false;
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::SetDockControl(TdxCustomDockControl* Value)
{
if (FDockControl != Value) {
FDockControl = Value;
UpdateProperties();
}
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::btnApplyClick(TObject *Sender)
{
ApplyProperties();
UpdateProperties();
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::btnCancelClick(TObject *Sender)
{
UpdateProperties();
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::tvSolutionExplorerChange(
TObject *Sender, TTreeNode *Node)
{
TTreeNode* ANode = tvSolutionExplorer->Selected;
if (ANode != NULL)
DockControl = ((TdxCustomDockControl*)ANode->Data);
else DockControl = dsHost;
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::dxDockingManager1LayoutChanged(
TdxCustomDockControl *Sender)
{
UpdateSolutionTV();
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::dxBarButtonStartPageClick(
TObject *Sender)
{
if (dpStartPage != NULL) {
if (!dpStartPage->Visible)
dpStartPage->Visible = true;
dxDockingController()->ActiveDockControl = dpStartPage;
}
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::dxBarButtonSolutionExplorerClick(
TObject *Sender)
{
if (dpSolutionExplorer != NULL) {
if (!dpSolutionExplorer->Visible)
dpSolutionExplorer->Visible = true;
dxDockingController()->ActiveDockControl = dpSolutionExplorer;
}
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::dxBarButtonClassViewClick(
TObject *Sender)
{
if (dpClassView != NULL) {
if (!dpClassView->Visible)
dpClassView->Visible = true;
dxDockingController()->ActiveDockControl = dpClassView;
}
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::dxBarButtonPropertiesClick(
TObject *Sender)
{
if (dpProperties != NULL) {
if (!dpProperties->Visible)
dpProperties->Visible = true;
dxDockingController()->ActiveDockControl = dpProperties;
}
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::dxBarButtonToolBoxClick(
TObject *Sender)
{
if (dpToolbox != NULL) {
if (!dpToolbox->Visible)
dpToolbox->Visible = true;
dxDockingController()->ActiveDockControl = dpToolbox;
}
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::dxBarButtonCallStackClick(
TObject *Sender)
{
if (dpCallStack != NULL) {
if (!dpCallStack->Visible)
dpCallStack->Visible = true;
dxDockingController()->ActiveDockControl = dpCallStack;
}
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::dxBarButtonOutputClick(
TObject *Sender)
{
if (dpOutput != NULL) {
if (!dpOutput->Visible)
dpOutput->Visible = true;
dxDockingController()->ActiveDockControl = dpOutput;
}
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::dxBarButtonWatchClick(
TObject *Sender)
{
if (dpWatch != NULL) {
if (!dpWatch->Visible)
dpWatch->Visible = true;
dxDockingController()->ActiveDockControl = dpWatch;
}
}
//---------------------------------------------------------------------------
void __fastcall TDockingMegaDemoMainForm::FormCreate(TObject *Sender)
{
dmCommonData->AboutFormClass = __classid(TDockingMegaDemoAboutForm);
#if __BORLANDC__ >= 0x550 // BCB version >= 5
dpStartPage->OnContextPopup = dpContextPopup;
dpProperties->OnContextPopup = dpContextPopup;
dpSolutionExplorer->OnContextPopup = dpContextPopup;
dpClassView->OnContextPopup = dpContextPopup;
dpOutput->OnContextPopup = dpContextPopup;
dpCallStack->OnContextPopup = dpContextPopup;
dpWatch->OnContextPopup = dpContextPopup;
dpToolbox->OnContextPopup = dpContextPopup;
#endif
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -