Commit 7ce586e9 authored by Rocky's avatar Rocky
Browse files

UWatchFrameUnit Frane has been added

--HG--
branch : DataSrcs
parent d94d0ce045d1
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "UWatchFramePageUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TUWatchFramePage *UWatchFramePage;
//---------------------------------------------------------------------------
__fastcall TUWatchFramePage::TUWatchFramePage(TComponent* Owner)
: TUVisualControllerFrame(Owner)
{
}
//---------------------------------------------------------------------------
// ------------------------------
//
// ------------------------------
void TUWatchFramePage::AUpdateInterface(void)
{
//
}
//
void TUWatchFramePage::AClearInterface(void)
{
ClearPages();
}
void TUWatchFramePage::ABeforeCalculate(void)
{
//
}
void TUWatchFramePage::AAfterCalculate(void)
{
//
}
// xml
void TUWatchFramePage::ASaveParameters(RDK::USerStorageXML &xml)
{
xml.WriteInteger("PageCount",NTWPageControl->PageCount);
xml.SelectNodeForce("Pages");
for(int i=0;i<NTWPageControl->PageCount;i++)
{
xml.WriteString(string("Caption_")+RDK::sntoa(i+1),AnsiString(NTWPageControl->Pages[i]->Caption).c_str());
}
xml.SelectUp();
}
// xml
void TUWatchFramePage::ALoadParameters(RDK::USerStorageXML &xml)
{
int count=xml.ReadInteger("PageCount",0);
ClearPages();
for(int i=1;i<count;i++)
AddPage();
xml.SelectNodeForce("Pages");
for(int i=0;i<NTWPageControl->PageCount;i++)
{
NTWPageControl->Pages[i]->Caption=xml.ReadString(string("Caption_")+RDK::sntoa(i+1),std::string("Page")+RDK::sntoa(i+1)).c_str();
}
xml.SelectUp();
}
//
TUWatchFramePage* TUWatchFramePage::New(TComponent *owner)
{
return new TUWatchFramePage(owner);
}
// ------------------------------
// ------------------------------
//
// ------------------------------
// ( 1 )
void TUWatchFramePage::ClearPages(void)
{
while(NTWPageControl->PageCount > 1)
delete NTWPageControl->Pages[NTWPageControl->PageCount-1];
}
//
void TUWatchFramePage::AddPage(void)
{
TTabSheet* tab=new TTabSheet(NTWPageControl);
tab->PageControl=NTWPageControl;
TUWatchFrame *frame=new TUWatchFrame(0);
frame->Name=frame->Name+String("_")+NTWPageControl->PageCount;
InsertComponent(frame);
frame->Parent=tab;
frame->Align=alClient;
tab->Caption=String("Page")+IntToStr(NTWPageControl->PageCount);
}
//
void TUWatchFramePage::DelPage(int index)
{
if(index < NTWPageControl->PageCount && index >= 0)
delete NTWPageControl->Pages[index];
}
//
void TUWatchFramePage::RenamePage(int index, String new_name)
{
if(index < NTWPageControl->PageCount && index >= 0)
NTWPageControl->Pages[index]->Caption=new_name;
}
// ------------------------------
inherited UWatchFramePage: TUWatchFramePage
object NTWPageControl: TPageControl
Left = 0
Top = 0
Width = 213
Height = 161
Align = alClient
TabOrder = 0
end
object NTWPageControlPopupMenu: TPopupMenu
Left = 64
Top = 64
object AddPage1: TMenuItem
Caption = 'Add Page'
end
object DeletePage1: TMenuItem
Caption = 'Delete Page'
end
object RanamePage1: TMenuItem
Caption = 'Raname Page'
end
end
end
//---------------------------------------------------------------------------
#ifndef UWatchFramePageUnitH
#define UWatchFramePageUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ComCtrls.hpp>
#include "TUVisualControllerFrameUnit.h"
#include "UWatchFrameUnit.h"
#include <Vcl.Menus.hpp>
//---------------------------------------------------------------------------
class TUWatchFramePage : public TUVisualControllerFrame
{
__published: // IDE-managed Components
TPageControl *NTWPageControl;
TPopupMenu *NTWPageControlPopupMenu;
TMenuItem *AddPage1;
TMenuItem *DeletePage1;
TMenuItem *RanamePage1;
private: // User declarations
public: // User declarations
// ------------------------------
//
// ------------------------------
void AUpdateInterface(void);
void ABeforeCalculate(void);
void AAfterCalculate(void);
//
virtual void AClearInterface(void);
// xml
virtual void ASaveParameters(RDK::USerStorageXML &xml);
// xml
virtual void ALoadParameters(RDK::USerStorageXML &xml);
//
virtual TUWatchFramePage* New(TComponent *owner=0);
// ------------------------------
// ------------------------------
//
// ------------------------------
// ( 1 )
void ClearPages(void);
//
void AddPage(void);
//
void DelPage(int index);
//
void RenamePage(int index, String new_name);
// ------------------------------
__fastcall TUWatchFramePage(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TUWatchFramePage *UWatchFramePage;
//---------------------------------------------------------------------------
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment