Exemplo n.º 1
0
TPanel *TPanelFactory::createPanel(QWidget *parent) {
  TPanel *panel = new TPanel(parent);
  panel->setObjectName(getPanelType());
  panel->setWindowTitle(getPanelType());
  initialize(panel);
  return panel;
}
Exemplo n.º 2
0
 TPanel *createPanel(QWidget *parent) override {
   TPanel *panel = new ToolOptionPanel(parent);
   panel->setObjectName(getPanelType());
   panel->setWindowTitle(getPanelType());
   panel->resize(600, panel->height());
   return panel;
 }
Exemplo n.º 3
0
TPanel *TPanelFactory::createPanel(QWidget *parent, QString panelType) {
  TPanel *panel = 0;

  QMap<QString, TPanelFactory *>::iterator it = tableInstance().find(panelType);
  if (it == tableInstance().end()) {
    TPanel *panel = new TPanel(parent);
    panel->setPanelType(panelType.toStdString());
    return panel;
  } else {
    TPanelFactory *factory = it.value();
    TPanel *panel          = factory->createPanel(parent);
    panel->setPanelType(panelType.toStdString());
    return panel;
  }
}
Exemplo n.º 4
0
void NetMonitor::slotRefresh()
{
    const NetModule* pModule;
    TPanel* pPanel;
    int mCount(client->getNetDevice()->getLPModulesCount());
    client->send_CMD_SET(isEmulationMode);
    for(int m=0;m<mCount;m++)
    {
        pModule=client->getNetDevice()->getLPModule(m);
        pPanel=panels[m];
        int i=0;
        for(auto ind:pPanel->getElements())
            dynamic_cast<TIndicator*>(ind)->setValue(pModule->getIOValue(i++));
    }
}
Exemplo n.º 5
0
void TPanelTitleBar::paintEvent(QPaintEvent *)
{
	QPainter painter(this);
	QRect rect = this->rect();

	QColor titleColor;
	QColor brushColor;

	TPanel *dw = qobject_cast<TPanel *>(parentWidget());
	Q_ASSERT(dw != 0);
	if (!dw->isFloating()) {
		if (dw->widgetInThisPanelIsFocused()) {
			brushColor = QColor(64, 64, 64);
			titleColor = QColor(Qt::white);
		} else {
			brushColor = QColor(100, 100, 100);
			titleColor = QColor(192, 192, 192);
		}
	} else if (isActiveWindow()) {
		brushColor = QColor(96, 96, 96);
		titleColor = QColor(Qt::white);
	} else {
		brushColor = QColor(128, 128, 128);
		titleColor = QColor(192, 192, 192);
	}
	painter.setBrush(brushColor);
	painter.setPen(Qt::black);
	painter.drawRect(rect.adjusted(0, 0, -1, -1));

	painter.setPen(titleColor);
	painter.drawLine(rect.topLeft(), rect.bottomLeft());
	painter.drawLine(rect.topLeft(), rect.topRight());

	if (dw->getOrientation() == TDockWidget::vertical) {
		QString titleText =
			painter.fontMetrics().elidedText(
				dw->windowTitle(), Qt::ElideRight, rect.width() - 50);

		painter.setBrush(Qt::NoBrush);
		painter.setPen(titleColor);
		painter.drawText(QPointF(10, 15), titleText);
	}

	if (dw->isFloating()) {
		const static QPixmap closeButtonPixmap(":/Resources/close_pane.png");
		const static QPixmap closeButtonPixmapOver(":/Resources/close_pane_rollover.png");

		QRect closeRect(rect.right() - 17, rect.top() + 1, 16, 16);

		if (m_closeButtonHighlighted)
			painter.drawPixmap(closeRect, closeButtonPixmapOver);
		else
			painter.drawPixmap(closeRect, closeButtonPixmap);
	}

	painter.end();
}
Exemplo n.º 6
0
void TPanelTitleBar::paintEvent(QPaintEvent *) {
  QPainter painter(this);
  QRect rect = this->rect();

  bool isPanelActive;

  TPanel *dw = qobject_cast<TPanel *>(parentWidget());
  Q_ASSERT(dw != 0);
  // docked panel
  if (!dw->isFloating()) {
    isPanelActive = dw->widgetInThisPanelIsFocused();
    qDrawBorderPixmap(&painter, rect, QMargins(3, 3, 3, 3),
                      (isPanelActive) ? m_activeBorderPm : m_borderPm);
  }
  // floating panel
  else {
    isPanelActive = isActiveWindow();
    qDrawBorderPixmap(
        &painter, rect, QMargins(3, 3, 3, 3),
        (isPanelActive) ? m_floatActiveBorderPm : m_floatBorderPm);
  }

  if (dw->getOrientation() == TDockWidget::vertical) {
    QString titleText = painter.fontMetrics().elidedText(
        dw->windowTitle(), Qt::ElideRight, rect.width() - 50);

    painter.setBrush(Qt::NoBrush);
    painter.setPen(isPanelActive ? m_activeTitleColor : m_titleColor);
    painter.drawText(QPointF(10, 15), titleText);
  }

  if (dw->isFloating()) {
    const static QPixmap closeButtonPixmap(
        svgToPixmap(":/Resources/pane_close.svg", QSize(18, 18)));
    const static QPixmap closeButtonPixmapOver(
        svgToPixmap(":/Resources/pane_close_rollover.svg", QSize(18, 18)));

    QPoint closeButtonPos(rect.right() - 18, rect.top() + 1);

    if (m_closeButtonHighlighted)
      painter.drawPixmap(closeButtonPos, closeButtonPixmapOver);
    else
      painter.drawPixmap(closeButtonPos, closeButtonPixmap);
  }

  painter.end();
}
Exemplo n.º 7
0
void ShowAbout(int iFontSize, Byte bLineBreak, Byte bVersionPos, String sDate,
	TPicture *pPicture, String sAddComp, String sVersion, String sAppName,
	String sCopyright, String sText, HICON hIcon) {
	TForm *Form;

	int I;
	String sCaption;

	TVSFixedFileInfo FileVersionInfo;

	String CompanyName, FileDescription, FileVersion, InternalName,
		LegalCopyright, OriginalFilename, ProductName, ProductVersion;

	TAboutObject *AboutObject;

	ShowWaitCursor();
//	Randomize;

	if (IsShift() & IsCtrl()) {
		sAppName = "Дураев";
		sAppName += sLineBreak;
		sAppName += "Константин Петрович";
		sCopyright = "";
		sCaption   = "Автор";
		sDate      = "29.03.1981";
		sVersion   = "";
		iFontSize  = 16;
		sAddComp   = NULL;
		pPicture   = NULL;
		sText      = "";
		for (int i = 1; i < 280; i++)
			if (i % 40 == 0)
				sText = sText + sLineBreak;
			else
				// TODO: 				sText = sText + String(AnsiChar(Chr(Ord('А') +
				// Random(Ord('Я') - Ord('А')))));
					sText = sText + L"Я";
	}
	else {
		GetFileVerInfo(Application->ExeName, FileVersionInfo, CompanyName,
			FileDescription, FileVersion, InternalName, LegalCopyright,
			OriginalFilename, ProductName, ProductVersion);

		sCaption = LoadStr(IDS_ABOUT_CAPTION);

		if (sDate == NULL)
			sDate = FormatDateTime("yyyy.mm.dd",
			UnixToDateTime(((PIMAGE_NT_HEADERS)((DWORD)((PIMAGE_DOS_HEADER)
			HInstance) + (((PIMAGE_DOS_HEADER) HInstance)->e_lfanew)))
			->FileHeader.TimeDateStamp));

		if (sVersion == NULL) {
			sVersion = FileVersion;
			if (IsValueInWord(FileVersionInfo.dwFileFlags, VS_FF_DEBUG))
				sVersion = sVersion + LoadStr(IDS_ABOUT_DEBUG);
			else if (IsValueInWord(FileVersionInfo.dwFileFlags,
				VS_FF_PRERELEASE))
				sVersion = sVersion + LoadStr(IDS_ABOUT_RC);
		}

		if (sAppName == NULL)
			sAppName = ProductName;

		if (sCopyright == NULL)
			sCopyright = LegalCopyright + "|@[email protected]";

		if (sText == NULL) {
			sText = LoadStr(IDS_ABOUT_EULA1) + sLineBreak +
				LoadStr(IDS_ABOUT_EULA2) + sLineBreak + LoadStr(IDS_ABOUT_EULA3)
				+ sLineBreak + LoadStr(IDS_ABOUT_EULA4);
		}

		if (bLineBreak != MAXBYTE) {
			I        = PosPlace(SPACE, sAppName, bLineBreak);
			sAppName = sAppName.SubString(1, I - 1) + sLineBreak +
				sAppName.SubString(I + 1, MAXINT);
		}
	} // IsShift and IsCtrl

	if (hIcon == NULL)
		hIcon = LoadIcon(HInstance, L"MAINICON");

	AboutObject = new TAboutObject();

	Form               = new TForm(Application); // Owner;
	Form->ShowHint     = true;
	Form->Font->Name   = "Arial";
	Form->Font->Size   = 10;
	Form->BorderStyle  = bsDialog;
	Form->Caption      = sCaption;
	Form->ClientHeight = 165;
	Form->ClientWidth  = 420;

	TBevel *bvlIconFrame = new TBevel(Form);
	bvlIconFrame->Parent = Form;
	bvlIconFrame->SetBounds(8, 14, 52, 52);
	bvlIconFrame->Shape = bsFrame;

	TPanel *pnlIcon = new TPanel(Form);
	pnlIcon->Parent = Form;
	pnlIcon->SetBounds(16, 22, 36, 36);
	pnlIcon->Caption          = "";
	pnlIcon->BevelOuter       = bvNone;
	pnlIcon->BorderStyle      = bsSingle;
	pnlIcon->ParentBackground = false;
	pnlIcon->Color            = (TColor) Random(0xFFFFFF);

	TImage *imgIcon                = new TImage(Form); // Icon
	imgIcon->Parent                = pnlIcon;
	imgIcon->Align                 = alClient;
	imgIcon->Transparent           = true;
	imgIcon->Picture->Icon->Handle = hIcon;

	TLabel *lblCopyright      = new TLabel(Form); // Copyright
	lblCopyright->Tag         = 1;
	lblCopyright->Parent      = Form;
	lblCopyright->Font->Style = TFontStyles() << fsBold;
	lblCopyright->SetBounds(8, 80, 0, 0);

	int PosHint = Pos('|', sCopyright);
	if (PosHint == 0)
		lblCopyright->Caption = sCopyright;
	else {
		lblCopyright->Caption      = sCopyright.SubString(1, PosHint - 1);
		lblCopyright->Hint         = sCopyright.SubString(PosHint + 1, MAXINT);
		lblCopyright->Cursor       = crHandPoint;
		lblCopyright->OnMouseEnter = AboutObject->MouseEnter;
		lblCopyright->OnMouseLeave = AboutObject->MouseLeave;
		if (lblCopyright->Hint[1] == '@') {
			lblCopyright->Hint = lblCopyright->Hint.SubString(2, MAXINT);

			AboutObject->MailAddress = lblCopyright->Hint;
			AboutObject->MailSubject = OriginalFilename + " " + FileVersion;
		}
		lblCopyright->OnClick = AboutObject->Click;
	}

	TLabel *lblText = new TLabel(Form); // Text
	lblText->Parent   = Form;
	lblText->WordWrap = true;
	lblText->SetBounds(8, 100, Form->ClientWidth - 16, 0);
	lblText->Caption = sText;
	// I                  =
	lblText->Top + lblText->Height;
	Form->ClientHeight = Form->ClientHeight + lblText->Height;

	if (sAddComp != NULL) {
		/* with TBevel.Create(Form) do
		 {
		 Parent = Form;
		 SetBounds(7, I + 5, Form.ClientWidth - 15, 5);
		 Shape = bsTopLine;
		 I = Top + Height;
		 };

		 with TLabel.Create(Form) do // Add Components
		 {
		 Parent = Form;
		 SetBounds(8, I, 0, 0);
		 Caption = 'Программное обеспечение использует следующие компоненты:';
		 I = Top + Height;
		 };

		 with TLabel.Create(Form) do // Components
		 {
		 Tag = 2;
		 Parent = Form;
		 Font.Style = [fsBold];
		 SetBounds(8, I, 0, 0);
		 Caption = sAddComp;
		 Form.ClientHeight = Form.ClientHeight + Height + 12;
		 if FileExists(FileInAppDir(rsLicenses)) then
		 {
		 Cursor = crHandPoint;
		 OnClick = ClickObject.Click;
		 OnMouseEnter = ClickObject.MouseEnter;
		 OnMouseLeave = ClickObject.MouseLeave;
		 };
		 } */
	}
	else // sAddComp != NULL
			Form->ClientHeight = Form->ClientHeight - 12;

	TBevel *bvlBottom = new TBevel(Form);
	bvlBottom->Parent = Form;
	bvlBottom->SetBounds(7, Form->ClientHeight - 43, Form->ClientWidth - 15, 5);
	bvlBottom->Shape = bsTopLine;

	lblMemory         = new TLabel(Form); // Физическая ...
	lblMemory->Parent = Form;
	lblMemory->SetBounds(8, Form->ClientHeight - 38, 0, 0);
	lblMemory->Caption = LoadStr(IDS_ABOUT_MEMORY);

	lblMemoryValue              = new TLabel(Form); // TotalPhys
	lblMemoryValue->Parent      = Form;
	lblMemoryValue->Font->Style = TFontStyles() << fsBold;
	lblMemoryValue->SetBounds(lblMemory->Width + 13,
		Form->ClientHeight - 38, 0, 0);

	lblProc         = new TLabel(Form); // Процессор:
	lblProc->Parent = Form;
	lblProc->SetBounds(8, Form->ClientHeight - 22, 0, 0);
	lblProc->Caption = LoadStr(IDS_ABOUT_PROCESSOR);

	lblProcValue              = new TLabel(Form); // CPUSpeed
	lblProcValue->Parent      = Form;
	lblProcValue->Font->Style = TFontStyles() << fsBold;
	lblProcValue->SetBounds(lblMemory->Width + 13,
		Form->ClientHeight - 22, 0, 0);

	TGradientPanel *pnlName = new TGradientPanel(Form);
	pnlName->Parent = Form;
	pnlName->StartUpdate();
	pnlName->SetBounds(68, 8, Form->ClientWidth - 76, 64);
	pnlName->BorderStyle = bsSingle;

	pnlName->BevelOuter       = bvNone;
	pnlName->ParentBackground = false;
	if (pPicture == NULL) pnlName->ColorStart = pnlIcon->Color;
	else pnlName->ColorStart = clBlack;
	pnlName->ColorEnd = clBlack;
	pnlName->EndUpdate();

	if (pPicture == NULL) {
		TLabel *lblAppName = new TLabel(Form); // Application Name (1)
		lblAppName->Parent = pnlName;
		lblAppName->SetBounds(2, 2, Form->ClientWidth - 83, 58);
		lblAppName->Alignment     = taCenter;
		lblAppName->AutoSize      = false;
		lblAppName->Caption       = sAppName;
		lblAppName->ParentColor   = false;
		lblAppName->Color         = clBlack;
		lblAppName->ParentFont    = false;
		lblAppName->Font->Charset = DEFAULT_CHARSET;
		lblAppName->Font->Color   = clBlack;
		lblAppName->Font->Height  = -51;
		lblAppName->Font->Name    = "Courier New";
		lblAppName->Font->Style   = TFontStyles() << fsBold << fsItalic;
		lblAppName->Font->Size    = iFontSize;
		lblAppName->Transparent   = true;
		lblAppName->Layout        = tlCenter;
		lblAppName->WordWrap      = true;

		TLabel *lblAppName2 = new TLabel(Form); // Application Name (2)
		lblAppName2->Parent = pnlName;
		lblAppName2->SetBounds(0, 0, Form->ClientWidth - 83, 58);
		lblAppName2->Alignment     = taCenter;
		lblAppName2->AutoSize      = false;
		lblAppName2->Caption       = sAppName;
		lblAppName2->ParentColor   = false;
		lblAppName2->Color         = clBlack;
		lblAppName2->ParentFont    = false;
		lblAppName2->Font->Charset = DEFAULT_CHARSET;
		lblAppName2->Font->Color   = clWhite;
		lblAppName2->Font->Height  = -51;
		lblAppName2->Font->Name    = "Courier New";
		lblAppName2->Font->Style   = TFontStyles() << fsBold << fsItalic;
		lblAppName2->Font->Size    = iFontSize;
		lblAppName2->Transparent   = true;
		lblAppName2->Layout        = tlCenter;
		lblAppName2->WordWrap      = true;
	} // pPicture == NULL
	else {
		TImage *imgPicture = new TImage(Form);
		imgPicture->Parent = pnlName;
		imgPicture->Align  = alClient;
		imgPicture->Picture->Assign(pPicture);
	}

	TLabel *lblDate = new TLabel(Form); // Date
	lblDate->Parent  = pnlName;
	lblDate->Caption = sDate;
	lblDate->Font->Assign(Form->Font);
	lblDate->Font->Style = TFontStyles() << fsBold;
	lblDate->Font->Color = clWhite;
	lblDate->Font->Size  = 8;
	lblDate->Alignment   = taRightJustify;

	switch (3) {
	case 0:
		lblDate->SetBounds(2, 2, lblDate->Width, lblDate->Height);
		break;
	case 1:
		lblDate->SetBounds(2, pnlName->ClientHeight - lblDate->Height - 2,
			lblDate->Width, lblDate->Height);
		break;
	case 2:
		lblDate->SetBounds(pnlName->ClientWidth - lblDate->Width - 2, 2,
			lblDate->Width, lblDate->Height);
		break;
	default:
		lblDate->SetBounds(pnlName->ClientWidth - lblDate->Width - 2,
			pnlName->ClientHeight - lblDate->Height - 2, lblDate->Width,
			lblDate->Height);
	}
	lblDate->Transparent = true;

	TLabel *lblVerion  = new TLabel(Form); // Version
	lblVerion->Parent  = pnlName;
	lblVerion->Caption = sVersion;
	lblVerion->Font->Assign(Form->Font);
	lblVerion->Font->Style = TFontStyles() << fsBold;
	lblVerion->Font->Color = clWhite;
	lblVerion->Font->Size  = 8;

	switch (2) {
	case 0:
		lblVerion->SetBounds(2, 2, lblVerion->Width, lblVerion->Height);
		break;
	case 1:
		lblVerion->SetBounds(2, pnlName->ClientHeight - lblVerion->Height - 2,
			lblVerion->Width, lblVerion->Height);
		break;
	case 2:
		lblVerion->SetBounds(pnlName->ClientWidth - lblVerion->Width - 2, 2,
			lblVerion->Width, lblVerion->Height);
		break;
	default:
		lblVerion->SetBounds(pnlName->ClientWidth - lblVerion->Width - 2,
			pnlName->ClientHeight - lblVerion->Height - 2, lblVerion->Width,
			lblVerion->Height);
	}
	lblVerion->Transparent = true;

	TButton *btnClose     = new TButton(Form);
	btnClose->Parent      = Form;
	btnClose->Caption     = "OK";
	btnClose->ModalResult = mrCancel;
	btnClose->Cancel      = true;
	btnClose->SetBounds(Form->ClientWidth - 83, Form->ClientHeight - 34,
		75, 26);
	btnClose->TabOrder = 0;

	TTimer *timer   = new TTimer(Form);
	timer->OnTimer  = AboutObject->TimerTimer;
	timer->Interval = 1;
	timer->Enabled  = true;

	RestoreCursor();

	Form->Left = (Screen->Width - Form->Width) / 2;
	Form->Top  = (Screen->Height - Form->Height) / 2;

	SetCurPosToCenter(btnClose);

	Form->ShowModal();

	Form->Free();
	AboutObject->Free();

	lblMemory      = NULL;
	lblProc        = NULL;
	lblMemoryValue = NULL;
	lblProcValue   = NULL;
}
Exemplo n.º 8
0
//---------------------------------------------------------------------------
void __fastcall TFileViewDlg::FormResize(TObject *Sender)
{
	if( m_DisEvent ) return;

	int WW = m_RectS.Right + 6;
	int HH = m_RectS.Bottom + 6;
	if( BorderStyle == bsNone ){
		int ch = m_Line * HH;
		int cw = m_Col * WW;
		m_DisEvent++;
		ClientHeight = GetCH(ch);
		ClientWidth = cw;
		m_DisEvent--;
		return;
	}
	int OldMax = m_Max;
	int h = (pTabS != NULL) ? ClientHeight - pTabS->TabHeight - 6 : ClientHeight;
	h = int((double(h - Panel->Height)/ HH) + 0.5);
	if( !h ) h = 1;
	int w = int((double(ClientWidth)/ WW) + 0.5);
	if( !w ) w = 1;
	while( (h * w) > AHDMAX ){
		if( w > 1 ){
			w--;
		}
		else if( h > 1 ){
			h--;
		}
	}
	int ch = h * HH;
	int cw = w * WW;
	if( cw < (UD->Left + UD->Width) ){
		w++;
		cw += WW;
	}
	m_Col = w;
	m_Line = h;
	m_Max = h * w;
	SetBitmapSize();
	TWinControl *pCtr = this;
	if( (m_MaxPage > 1) && (pTabS == NULL) ){
		Panel->Align = alNone;
		RemoveControl(Panel);
		pTabS = new TTabControl(this);
		pTabS->Width = ClientWidth;
		pTabS->Height = ClientHeight;
		pTabS->TabPosition = KBP->Checked ? tpBottom : tpTop;
		InsertControl(pTabS);
		pTabS->Parent = this;
		pTabS->Align = alClient;
		for( int j = 0; j < m_MaxPage; j++ ){
			AnsiString as;
			GetPageName(as, j);
			pTabS->Tabs->Add(as);
		}
		pTabS->Font->Height = -16;
		pTabS->TabHeight = 20;
		pTabS->InsertControl(Panel);
		Panel->Parent = pTabS;
		if( KBP->Checked ){
			Panel->Top = 0;
		}
		else {
			Panel->Top = pTabS->TabHeight + 3;
		}
		pTabS->TabIndex = m_CurPage;
		pTabS->OnChange = TabSChange;
		pCtr = pTabS;
	}
	pCurPage = pFileV[m_CurPage];
	if( UD->Max < pCurPage->m_CurPage ) UD->Max = SHORT(pCurPage->m_CurPage + 1);
	UD->Position = SHORT(pCurPage->m_CurPage);
	int i;
	for( i = 0; i < m_Max; i++ ){
		if( pPanel[i] == NULL ){
			pPanel[i] = new TPanel(this);
			TPanel *pn = pPanel[i];
			pn->BorderStyle = bsSingle;
			pn->Width = WW;
			pn->Height = HH;
			pCtr->InsertControl(pn);
			pn->Parent = pCtr;
			pBox[i] = new TPaintBox(this);
			TPaintBox *pb = pBox[i];
			pn->InsertControl(pb);
			pb->Parent = pn;
			pb->Align = alClient;
			pb->OnPaint = PBPaint;
			pb->OnMouseDown = PBMouseDown;
			pb->OnMouseMove = PBMouseMove;
			pb->OnDblClick = PBDblClick;
			pb->OnDragOver = PanelDragOver;
			pb->OnDragDrop = PanelDragDrop;
			pb->PopupMenu = pPopup;
		}
		else {
			pPanel[i]->Visible = FALSE;
			pPanel[i]->Width = WW;
			pPanel[i]->Height = HH;
		}
		MultProc();
	}
	for( ; i < AHDMAX; i++ ){
		if( pPanel[i] != NULL ){
			pPanel[i]->Visible = FALSE;
		}
		MultProc();
	}
	m_DisEvent++;
	ClientHeight = GetCH(ch);
	ClientWidth = cw;
	for( i = 0; i < m_Max; i++ ){
		pPanel[i]->Left = (i % m_Col) * WW;
		pPanel[i]->Top = Panel->Top + Panel->Height + (i / m_Col) * HH;
		pPanel[i]->Visible = TRUE;
	}
	if( pTabS != NULL ) Panel->Width = pTabS->ClientWidth;
	m_DisEvent--;
	if( m_Max != OldMax ){
		for( i = 0; i < m_MaxPage; i++ ){
			if( i != m_CurPage ){
				delete pFileV[i]->pList;
				pFileV[i]->pList = NULL;
			}
		}
		LoadImage();
	}
	SetPopup(Popup);
}
Exemplo n.º 9
0
void NetMonitor::build()
{
    if(parentWidget)
    {
        TIndicator* pIndicator;
        string pre_caption="",post_caption="";
        string mode_str[]={"in/out","in","out"};
        QVector<int> src_id(2);

        int io_mode;
        if(dashBoard!=nullptr)
            delete dashBoard;
        if(layout!=nullptr)
            delete layout;
        panels.clear();

        loadCaptions();

        dashBoard = new TPanel(this);

        layout= new QHBoxLayout(parentWidget);
        layout->setSpacing(0);
        layout->setMargin(0);

        TPanel* subPanel;
        const NetModule* pModule;
        TIndicator::IndType indType;

        int mCount(client->getNetDevice()->getLPModulesCount());
        dashBoard->setLineCount(lineCount);
        dashBoard->setTitle(title);
        for(int m=0;m<mCount;m++)
        {
            getNextCaption();
            pModule=client->getNetDevice()->getLPModule(m);
            subPanel=dynamic_cast<TPanel*>(dashBoard->addElement(new TPanel()));
            subPanel->setLineCount(subLineCount);
            io_mode=pModule->getMode();
            subPanel->setTitle(QString().fromStdString("Module:"+pModule->getName()+"("+mode_str[io_mode]+")"));
            switch(io_mode)
            {
                case MDL_MODE_IN:
                    if(pModule->getType()==MDL_TYPE_DIGITAL)
                        indType=TIndicator::IndType::Led;
                    else
                        indType=TIndicator::IndType::Label;
                break;
                case MDL_MODE_OUT:
                    if(pModule->getType()==MDL_TYPE_DIGITAL)
                        indType=TIndicator::IndType::Switch;
                    else
                        indType=TIndicator::IndType::Spin;
                break;
                default:
                case MDL_MODE_INOUT:
                    if(pModule->getType()==MDL_TYPE_DIGITAL)
                        indType=TIndicator::IndType::Button;
                    else
                        indType=TIndicator::IndType::Spin;
                break;
            }

            src_id[0]=m;
            for(int i=0;i<pModule->getIOValuesCount();i++)
            {
                if(captions.empty())
                    post_caption="port"+QString().number(i).toStdString();
                else
                    post_caption=getNextCaption();
                src_id[1]=i;
                pIndicator=dynamic_cast<TIndicator*>(subPanel->addElement(new TIndicator(indType,QString().fromStdString(pre_caption),QString().fromStdString(post_caption),TIndicator::Orientation::LeftToRight,QSize(24,24),pModule->getIOValue(i),src_id)));
                connect(pIndicator,SIGNAL(signalValueChanged(QVector<int>,int)),this,SLOT(slotApply(QVector<int>,int)));
            }

            panels.push_back(subPanel);
        }

        layout->addWidget(dashBoard);
    }
}
Exemplo n.º 10
0
Int32 TCommentDetailForm::_OnCommentDetailControl(TApplication * pApp)
{
	Int32 bnRetCod = 0;	
	TPanel* pTPanel;	
	TRectangle obBtnRec(100,50,150,30);	//初始(left, top, w, h)
	TFont tFont;

	Int32 nShowItemNum = 0;
	Int32 itemHeight = 150;

	m_nTitleReplyBtnID = SetTilteButton(pApp); 
	m_nTitleLblID = SetFormTilte(pApp); 

	//创建TPanel: CommentForm_CommentDetailPanel
	m_obContrl[m_nCtlIDCount] =new TPanel;	
	obBtnRec.SetRect(0, TITLEBAR_H, SCR_W, 370);
	if(m_obContrl[m_nCtlIDCount]->Create(this))
	{		
		m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);	
		m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();
		m_iaTPanelID[0] = m_obContrl[m_nCtlIDCount]->GetId();//Save TPanel ID

		m_obContrl[m_nCtlIDCount]->SetTransparent(TRUE);//设置透明
		m_obContrl[m_nCtlIDCount]->SetFrameWidth(0);//设置边框	
		m_obContrl[m_nCtlIDCount]->SetEnabled(TRUE);
		m_obContrl[m_nCtlIDCount]->Show(TRUE);	
	}
	else
	{
		bnRetCod++;
	}
	m_nCtlIDCount++;


	//创建普通button: 回复
	m_obContrl[m_nCtlIDCount] =new TButton ;
	obBtnRec.SetRect(80,420,50,30);
	if(m_obContrl[m_nCtlIDCount]->Create(this))
	{
		m_obContrl[m_nCtlIDCount]->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_Reply),TRUE);
		m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);
		tFont = m_obContrl[m_nCtlIDCount]->GetFont();
		tFont.Create(14, 14);
		m_obContrl[m_nCtlIDCount]->SetFont(tFont);
		// 保存控件ID,以便处理消息
		m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();
		m_nReplyBtnID = m_obContrl[m_nCtlIDCount]->GetId();//save reply button ID
		m_obContrl[m_nCtlIDCount]->Show(TRUE);		
	}
	else
	{
		bnRetCod++;
	}
	// 增加生成控件数量
	m_nCtlIDCount++;

	//创建普通button: 删除
	m_obContrl[m_nCtlIDCount] =new TButton ;
	obBtnRec.SetRect(160,420,50,30);
	if(m_obContrl[m_nCtlIDCount]->Create(this))
	{
		m_obContrl[m_nCtlIDCount]->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_Delete),TRUE);
		m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);
		tFont = m_obContrl[m_nCtlIDCount]->GetFont();
		tFont.Create(14, 14);
		m_obContrl[m_nCtlIDCount]->SetFont(tFont);
		// 保存控件ID,以便处理消息
		m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();
		m_nDeleteBtnID = m_obContrl[m_nCtlIDCount]->GetId();//save delete button ID
		m_obContrl[m_nCtlIDCount]->Show(TRUE);		
	}
	else
	{
		bnRetCod++;
	}
	// 增加生成控件数量
	m_nCtlIDCount++;



	//一下的控件都在TPanel中
	//创建Label 悄悄话		

	pTPanel = static_cast< TPanel* >(this->GetControlPtr(m_iaTPanelID[0]));

	if(pTPanel)
	{	
		CreateDetailItemControl(0,itemHeight, pTPanel, 0);	

		nShowItemNum = (this->m_nCommentDetailItemNum>COMMENTDETAIL_MAXITEM)?(COMMENTDETAIL_MAXITEM-1):(m_nCommentDetailItemNum-1);
		int startItem = (this->m_nCommentDetailItemNum>COMMENTDETAIL_MAXITEM)?(this->m_nCommentDetailItemNum-COMMENTDETAIL_MAXITEM):1;
		//历史留言详情
		int ctrlGroupIndex = 1;
		for(int i=startItem; i< this->m_nCommentDetailItemNum; i++)
		{			
			CreateDetailItemControl(i,itemHeight, pTPanel, ctrlGroupIndex);
			ctrlGroupIndex++;
		}

		pTPanel->Show(TRUE);
	}

	return bnRetCod;

}
Exemplo n.º 11
0
 TPanel *createPanel(QWidget *parent) override {
   TPanel *panel = new FlipbookPanel(parent);
   panel->setObjectName(getPanelType());
   panel->setWindowTitle(QObject::tr("FlipBook"));
   return panel;
 }
TPanel *OpenFloatingPanel::getOrOpenFloatingPanel(
    const std::string &panelType) {
  TMainWindow *currentRoom = TApp::instance()->getCurrentRoom();
  QList<TPanel *> list     = currentRoom->findChildren<TPanel *>();
  QPoint lastFloatingPos   = QPoint(0, 0);
  for (int i = 0; i < list.size(); i++) {
    TPanel *panel = list.at(i);

    // we want floating panel (possibly hidden) with the correct name
    if (panel->getPanelType() == panelType && panel->isFloating()) {
      // if there is already a floating panel and MultipleInstances are
      // not allowed we must use it
      if (!panel->areMultipleInstancesAllowed() && !panel->isHidden()) {
        activateWidget(panel);
        return panel;
      }

      // If there is a hidden panel we can show and use it
      if (panel->isHidden()) {
        // Alcuni pannelli devono essere resettati (Es.: il paletteViewerPanel)
        panel->reset();
        // Devo porre il pannello sotto il controllo del layout della stanza
        currentRoom->addDockWidget(panel);
        panel->show();
        panel->raise();
        return panel;
      } else
        lastFloatingPos = panel->pos();
    }
  }

  // No panel found. We must create a new pane
  TPanel *panel = TPanelFactory::createPanel(currentRoom,
                                             QString::fromStdString(panelType));
  if (!panel) return 0;  // it should never happen
  // panel->setWindowTitle(QObject::tr(m_title.toStdString().c_str()));
  panel->setFloating(true);
  panel->show();
  panel->raise();
  if (!lastFloatingPos.isNull())
    panel->move(QPoint(lastFloatingPos.x() + 30, lastFloatingPos.y() + 30));

  return panel;
}
Exemplo n.º 13
0
// 窗口初始化
Boolean TPhotosGetAlbumsForm::_OnWinInitEvent(TApplication * pApp, EventType * pEvent)
{
	int nErrorCode = eFailed;
	Int32 Height_Panel = 0;		//Panel高度		

	//m_TitleBtnLeft = SetAppTitleButton(this, APP_RE_ID_STRING_Comment,TITLE_BUTTON_LEFT);

	//显示不同的title
	if(m_FormMode == FORM_MODE_NORMAL)
	{
		SetAppTilte(this, APP_RE_ID_STRING_Album);
		m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT);

		char* uid = NULL;
		uid = Get_Url_Params(RR_PhotosGetAlbums, "uid");
		if( strcmp(uid, RenRenUserInfo.szuid) == 0)
		{
			m_TitleBtnLeft = SetAppBitmapButton(this, APP_RE_ID_BITMAP_take_photo, APP_RE_ID_BITMAP_take_photo);
		}
	}
	else if(m_FormMode == FORM_MODE_MYHOME)
	{
		tResponseProfile* ResponseProfile;
		nErrorCode = RenRenAPI_JsonParse(RR_ProfileGetInfo, (void **)&ResponseProfile);
		if(ResponseProfile != NULL)
		{
			if(ResponseProfile->uid == RenRenUserInfo.uid)
			{
				SetAppTilte(this, APP_RE_ID_STRING_MyNews);
				m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Home, TITLE_BUTTON_RIGHT);
				m_TitleBtnLeft = SetAppBitmapButton(this, APP_RE_ID_BITMAP_take_photo, APP_RE_ID_BITMAP_take_photo);
			}
			else
			{
				//姓名
				TUChar  pszFName[64] = {0};
				TUString::StrUtf8ToStrUnicode(pszFName , (const Char *)ResponseProfile->name);
				SetAppTilte(this, 0, pszFName);
				m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT);
			}
			delete ResponseProfile;
			ResponseProfile = NULL;
		}		
		
	}

	//设置panel高度
	TPanel* pTPanel = static_cast<TPanel*>(GetControlPtr(APP_RE_ID_CommonListForm_CommonPanel));	
	TCoolBarList* pCoolBarList = static_cast<TCoolBarList*>(GetControlPtr(APP_RE_ID_CommonListForm_CommonCoolBarList));	
	
	if(pTPanel)
	{
		TRectangle rect;
		
		Height_Panel = SCR_H - STATUSBAR_H - TITLEBAR_H;
		if(m_FormMode == FORM_MODE_MYHOME)
			Height_Panel -= BOTTOM_TAB_H;
			
		pTPanel->GetBounds(&rect);
		rect.SetHeight(Height_Panel);
		pTPanel->SetBounds(&rect);
	}

	if(m_FormMode == FORM_MODE_MYHOME)
		CreateProfileBottomTab(this, &BottomTabCtrID, 2);

	//显示个人信息
	if(m_FormMode == FORM_MODE_MYHOME)
	{
		Int32 Height_Top = 0;			//CoolBarList上面信息的高度
		Int32 Height_CoolBarList = 0;	//CoolBarList高度	
		tResponseProfile* ResponseProfile;
		nErrorCode = RenRenAPI_JsonParse(RR_ProfileGetInfo, (void **)&ResponseProfile);
		if(ResponseProfile != NULL)
		{
			//头像
			TBitmap* pDownLoadBitmap = NULL;
			pDownLoadBitmap = LoadImgByUrl(ResponseProfile->headurl);			
			//pProfileImage = LoadImgByUrl(ResponseProfile->headurl);
			const TBitmap * pImageDeault = TResource::LoadConstBitmap(APP_RE_ID_BITMAP_DefaultLarge);
			const TBitmap * pBackImage = TResource::LoadConstBitmap(APP_RE_ID_BITMAP_headmask_large);
			if(pDownLoadBitmap == NULL)
			{
				//RenRenAPICommon_DownloadPhoto(ResponseProfile->headurl, this->GetWindowHwndId(), FEED_PROFILE_IMAGE_INDEX);	
				m_ProfileImageID = CtrlAddItemToPanel_MaskButton(this, pTPanel, RR_HEAD_X, RR_HEAD_Y, RR_HEAD_W, RR_HEAD_H, (TBitmap*)pImageDeault, (TBitmap*)pImageDeault, (TBitmap*)pBackImage );	
				this->DisableControl(m_ProfileImageID);
			}
			else
			{
				//需要做放大
				pProfileImage = TBitmap::Create(RR_HEAD_W, RR_HEAD_W, pDownLoadBitmap->GetDepth());
				pProfileImage->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));				
				m_ProfileImageID = CtrlAddItemToPanel_MaskButton(this, pTPanel, RR_HEAD_X, RR_HEAD_Y, RR_HEAD_W, RR_HEAD_H, (TBitmap*)pProfileImage, (TBitmap*)pProfileImage, (TBitmap*)pBackImage );	
				this->DisableControl(m_ProfileImageID);
				
				//释放图片
				pDownLoadBitmap->Destroy();
				pDownLoadBitmap = NULL; 						
			}
			//下载大头像
			tResponseUsersGetInfo* ResponseUserInfoPhoto = NULL;
			RenRenAPI_JsonParse(RR_UsersGetInfoPhoto, (void **)&ResponseUserInfoPhoto);
			if(ResponseUserInfoPhoto)
			{
				if( (ResponseUserInfoPhoto->nArraySize > 0) && (ResponseUserInfoPhoto->Array[0].uid == ResponseProfile->uid) )
				{
					_UpdateProfilePhoto(pApp, ResponseUserInfoPhoto);
				}
				else
				{
					Set_Url_Params(RR_UsersGetInfoPhoto, "uids", m_uid);
					RenRenAPICommon_Download(RR_UsersGetInfoPhoto, this->GetWindowHwndId(), 0, 0); 
				}					
							
				delete ResponseUserInfoPhoto;
				ResponseUserInfoPhoto = NULL;							
			}
			else
			{
				Set_Url_Params(RR_UsersGetInfoPhoto, "uids", m_uid);
				RenRenAPICommon_Download(RR_UsersGetInfoPhoto, this->GetWindowHwndId(), 0, 0); 
			}
			
			//姓名
			TUChar  pszFName[64] = {0};
			TUString::StrUtf8ToStrUnicode(pszFName , (const Char *)ResponseProfile->name);
			CtrlAddItemToPanel_Label(this, pTPanel, RR_NAME_X, RR_NAME_Y, 0, FONT_NORMAL, pszFName, RGB_COLOR_BLACK);
			Height_Top += (RR_NAME_Y+RR_NAME_H);
			//状态
			TUChar  pszStatus[1024] = {0};
			Coord nHeight_RichView = 0;
			if(ResponseProfile->nSize_status>0)
			{
				TUString::StrUtf8ToStrUnicode(pszStatus, (const Char *)ResponseProfile->status[0].content);
				CtrlAddItemToPanel_RichView(this, pTPanel, RR_STATUS_X, RR_STATUS_Y, RR_STATUS_W, &nHeight_RichView, FONT_MIDDLE, pszStatus, RGB_COLOR_BLACK);
			}

			//位置容错调整
			if(nHeight_RichView > (RR_HEAD_H-RR_NAME_H) )
				Height_Top += nHeight_RichView;
			else
				Height_Top += (RR_HEAD_H- RR_NAME_H);

			//调整间隔
			Height_Top += 4;
			//设置CoolBarList高度
			if(pCoolBarList)
			{
				TRectangle rect;
				Int32 nY = Height_Top;
					
				pCoolBarList->GetBounds(&rect);
				rect.SetY(nY);
				pCoolBarList->SetBounds(&rect);
			}
		
			delete ResponseProfile;
			ResponseProfile = NULL;
		}
	}

	//从对应Json中获取数据,用于更新UI
	nErrorCode = RenRenAPI_JsonParse(RR_PhotosGetAlbums, (void **)&Response);		
	if (Response )
	{
		_SetAlbumCoolBarList(pApp);
		delete Response;
		Response = NULL;
	}
	else
	{
		//显示无权限操作的情况(用户设置了阅读权限)
		if(nErrorCode == 200)
		{
			TUChar ErrorInfo[ERROR_INFO_LEN] = {0};
			if(RenRenAPI_JsonParse_bSuccess(RR_PhotosGetAlbums, ErrorInfo) != 0)	
			{
				if(TUString::StrLen(ErrorInfo) > 0)
				{

					//动态添加列表数据
					TBarRowList* pRowList = NULL;
					TBarRow* pBarRow = NULL;
					
					pRowList = pCoolBarList->Rows();
					pRowList->Clear();
					pBarRow = pRowList->AppendRow();
					//显示错误提示
					TBarListItem* lpItem = NULL;
					lpItem = pBarRow->AppendItem();
					if (lpItem)  
					{
						CtrlAddItemToCoolBarList_Lable(this, lpItem, RR_INFO_X,  RR_INFO_Y, RR_INFO_W, FONT_NORMAL, (TUChar*)ErrorInfo);
						lpItem->SetHeight(RR_INFO_H);
						lpItem->SetEnabled(FALSE);
					}
				}
			}
		}
	}

	return TRUE;
}
Exemplo n.º 14
0
// 窗口初始化
Boolean TGuestbookGetForm::_OnWinInitEvent(TApplication * pApp, EventType * pEvent)
{	
	m_TitleBtnLeft = SetAppBitmapButton(this, APP_RE_ID_BITMAP_write_but, APP_RE_ID_BITMAP_write_but_over);
	//m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT);
	//SetAppTilte(this, APP_RE_ID_STRING_Guestbook);

	//显示不同的title
	if(m_FormMode == FORM_MODE_NORMAL)
	{
		SetAppTilte(this, APP_RE_ID_STRING_Guestbook);
		m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT);
	}
	else if(m_FormMode == FORM_MODE_MYHOME)
	{
		tResponseProfile* ResponseProfile;
		RenRenAPI_JsonParse(RR_ProfileGetInfo, (void **)&ResponseProfile);	
		if(ResponseProfile)
		{
			if(ResponseProfile->uid == RenRenUserInfo.uid)
			{
				SetAppTilte(this, APP_RE_ID_STRING_MyNews);
				m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Home,TITLE_BUTTON_RIGHT);
			}
			else
			{
				TUChar  pszFName[64] = {0};
				TUString::StrUtf8ToStrUnicode(pszFName , (const Char *)ResponseProfile->name);			
				SetAppTilte(this, 0, pszFName);
				m_TitleBtnRight = SetAppTitleButton(this, APP_RE_ID_STRING_Back,TITLE_BUTTON_RIGHT);
			}

			delete ResponseProfile;
			ResponseProfile = NULL;	
		}
	}
	
	//设置panel高度
	TPanel* pTPanel = static_cast<TPanel*>(GetControlPtr(APP_RE_ID_CommonListForm_CommonPanel));	
	TCoolBarList* pCoolBarList = static_cast<TCoolBarList*>(GetControlPtr(APP_RE_ID_CommonListForm_CommonCoolBarList));

	if( (pTPanel == NULL) || (pCoolBarList == NULL) )
		return FALSE;
	
	//调整Panel高度
	{
		TRectangle rect;
		Int32 Height_Panel = 0;		//Panel高度		
		
		Height_Panel = SCR_H - STATUSBAR_H - TITLEBAR_H;
		if(m_FormMode == FORM_MODE_MYHOME)
			Height_Panel -= BOTTOM_TAB_H;
			
		pTPanel->GetBounds(&rect);
		rect.SetHeight(Height_Panel);
		pTPanel->SetBounds(&rect);
	}

	if(m_FormMode == FORM_MODE_MYHOME)
		CreateProfileBottomTab(this, &BottomTabCtrID, 4);
	
	//:TODO:

	//显示个人信息
	if(m_FormMode == FORM_MODE_MYHOME)
	{
		Int32 Height_Top = 0;			//CoolBarList上面信息的高度
		tResponseProfile* ResponseProfile;
		RenRenAPI_JsonParse(RR_ProfileGetInfo, (void **)&ResponseProfile);
		if(ResponseProfile != NULL)
		{
			//头像
			TBitmap* pDownLoadBitmap = NULL;
			pDownLoadBitmap = LoadImgByUrl(ResponseProfile->headurl);			
			//pProfileImage = LoadImgByUrl(ResponseProfile->headurl);
			const TBitmap * pImageDeault = TResource::LoadConstBitmap(APP_RE_ID_BITMAP_DefaultLarge);
			const TBitmap * pBackImage = TResource::LoadConstBitmap(APP_RE_ID_BITMAP_headmask_large);
			if(pDownLoadBitmap == NULL)
			{
				//RenRenAPICommon_DownloadPhoto(ResponseProfile->headurl, this->GetWindowHwndId(), FEED_PROFILE_IMAGE_INDEX);	
				m_ProfileImageID = CtrlAddItemToPanel_MaskButton(this, pTPanel, RR_HEAD_X, RR_HEAD_Y, RR_HEAD_W, RR_HEAD_H, (TBitmap*)pImageDeault, (TBitmap*)pImageDeault, (TBitmap*)pBackImage );	
				this->DisableControl(m_ProfileImageID);
			}
			else
			{
				//需要做放大
				pProfileImage = TBitmap::Create(RR_HEAD_W, RR_HEAD_W, pDownLoadBitmap->GetDepth());
				pProfileImage->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));				
				m_ProfileImageID = CtrlAddItemToPanel_MaskButton(this, pTPanel, RR_HEAD_X, RR_HEAD_Y, RR_HEAD_W, RR_HEAD_H, (TBitmap*)pProfileImage, (TBitmap*)pProfileImage, (TBitmap*)pBackImage );	
				this->DisableControl(m_ProfileImageID);
				
				//释放图片
				pDownLoadBitmap->Destroy();
				pDownLoadBitmap = NULL; 						
			}
			//下载大头像
			tResponseUsersGetInfo* ResponseUserInfoPhoto = NULL;
			RenRenAPI_JsonParse(RR_UsersGetInfoPhoto, (void **)&ResponseUserInfoPhoto);
			if(ResponseUserInfoPhoto)
			{
				if( (ResponseUserInfoPhoto->nArraySize > 0) && (ResponseUserInfoPhoto->Array[0].uid == ResponseProfile->uid) )
				{
					_UpdateProfilePhoto(pApp, ResponseUserInfoPhoto);
				}
				else
				{
					Set_Url_Params(RR_UsersGetInfoPhoto, "uids", m_uid);
					RenRenAPICommon_Download(RR_UsersGetInfoPhoto, this->GetWindowHwndId(), 0, 0); 
				}					
							
				delete ResponseUserInfoPhoto;
				ResponseUserInfoPhoto = NULL;							
			}
			else
			{
				Set_Url_Params(RR_UsersGetInfoPhoto, "uids", m_uid);
				RenRenAPICommon_Download(RR_UsersGetInfoPhoto, this->GetWindowHwndId(), 0, 0); 
			}
			
			//姓名
			TUChar  pszFName[64] = {0};
			TUString::StrUtf8ToStrUnicode(pszFName , (const Char *)ResponseProfile->name);
			CtrlAddItemToPanel_Label(this, pTPanel, RR_NAME_X, RR_NAME_Y, 0, FONT_NORMAL, pszFName, RGB_COLOR_BLACK);
			Height_Top += (RR_NAME_Y+RR_NAME_H);
			//状态
			TUChar  pszStatus[1024] = {0};
			Coord nHeight_RichView = 0;
			if(ResponseProfile->nSize_status>0)
			{
				TUString::StrUtf8ToStrUnicode(pszStatus, (const Char *)ResponseProfile->status[0].content);
				CtrlAddItemToPanel_RichView(this, pTPanel, RR_STATUS_X, RR_STATUS_Y, RR_STATUS_W, &nHeight_RichView, FONT_MIDDLE, pszStatus, RGB_COLOR_BLACK);
			}

			//位置容错调整
			if(nHeight_RichView > (RR_HEAD_H-RR_NAME_H) )
				Height_Top += nHeight_RichView;
			else
				Height_Top += (RR_HEAD_H- RR_NAME_H);

			//调整间隔
			Height_Top += 4;
			//设置CoolBarList高度
			if(pCoolBarList)
			{
				TRectangle rect;
				Int32 nY = Height_Top;
					
				pCoolBarList->GetBounds(&rect);
				rect.SetY(nY);
				pCoolBarList->SetBounds(&rect);
			}
		
			delete ResponseProfile;
			ResponseProfile = NULL;
		}
	}

	//从对应Json中获取数据,用于更新UI
	int nErrorCode = eFailed;
	tResponseGuestbookGet* Response = NULL;
	nErrorCode = RenRenAPI_JsonParse(RR_GuestbookGet, (void **)&Response);	

	//动态添加列表数据
	TBarRowList* pRowList = NULL;
	TBarRow* pBarRow = NULL;
	
	pRowList = pCoolBarList->Rows();
	pRowList->Clear();
	pBarRow = pRowList->AppendRow();
	if(Response != NULL)
	{
		TBarListItem* pListItem = NULL;
		//背景设置为白色底色
		pCoolBarList->SetColor(CTL_COLOR_TYPE_FOCUS_BACK, RGB_COLOR_WHITE);
		pRowList->BeginUpdate();

		if(Response->nArraySize == 0)
		{
			TUChar pszCount[64] = {0};
			TUString::StrPrintF(pszCount, TResource::LoadConstString(APP_RE_ID_STRING_GuestbookCount), Response->nArraySize);
					
			TBarListItem* lpItem = NULL;
			lpItem = pBarRow->AppendItem();
			lpItem->SetCaption(pszCount);
			lpItem->SetEnabled(FALSE);
		}
		//以下为增加列表项
		for (int i = 0; i < Response->nArraySize; i++)
		{
			TUChar pszString[4096] = {0};
			Coord nHeigh = 0;
		
			pListItem = pBarRow->AppendItem();
			if (pListItem)
			{
				//属性设置
				pListItem->SetTitle(NULL);
				pListItem->SetCaption(NULL);       
				pListItem->SetIndicatorType(itNone);

				//先读取磁盘cache, 无文件再下载
				 gItemData[i].pBmp = LoadImgByUrl(Response->Array[i].headurl);
				if(  gItemData[i].pBmp != NULL)
				{
					//头像,需要做缩放
					gItemData[i].pBmpZoom = gItemData[i].pBmp->Create(HEADPHOTO_W, HEADPHOTO_H, 32);
					gItemData[i].pBmpZoom->QuickSpecialZoom(gItemData[i].pBmp, 0, 0);
					gItemData[i].HeadMaskButtonID = CtrlAddItemToCoolBarList_MaskButton(this, pListItem, HEADMASK_X, HEADMASK_Y, HEADMASKBUTTON_W, HEADMASKBUTTON_H, gItemData[i].pBmpZoom, (TBitmap*)TBitmap::LoadResBitmap(APP_RE_ID_BITMAP_head1));					
				}
				else
				{
					gItemData[i].HeadMaskButtonID = CtrlAddItemToCoolBarList_MaskButton(this, pListItem, HEADMASK_X, HEADMASK_Y, HEADMASKBUTTON_W, HEADMASKBUTTON_H, (TBitmap*)TBitmap::LoadResBitmap(APP_RE_ID_BITMAP_Default), (TBitmap*)TBitmap::LoadResBitmap(APP_RE_ID_BITMAP_head1));
					RenRenAPICommon_DownloadPhoto(Response->Array[i].headurl, this->GetWindowHwndId(), i );
				}
				
				//姓名
				TUString::StrUtf8ToStrUnicode(pszString , (const Char *)Response->Array[i].name);
				CtrlAddItemToCoolBarList_Lable(this, pListItem, NAME_X, NAME_Y, 0, NAME_FONT, pszString, RGB_COLOR_LIGHTBLUE);

				//悄悄话
				if(Response->Array[i].is_whisper != 0)
				{
					gItemData[i].bWhisper = TRUE;
					CtrlAddItemToCoolBarList_Image(this,  pListItem, WHISPER_X, WHISPER_Y , 49, 15, (TBitmap*)TResource::LoadConstBitmap(APP_RE_ID_BITMAP_whisper));
				}
				//内容,去掉html格式化内容
				StrRemoveAtoB(Response->Array[i].content, strlen(Response->Array[i].content), "<", ">");
				TUString::StrUtf8ToStrUnicode(pszString , (const Char *)Response->Array[i].content);
				CtrlAddItemToCoolBarList_RichView(this, pListItem, CONTENT_X, CONTENT_Y, CONTENT_W, &nHeigh, CONTENT_FONT, pszString);
				//时间
				TUString::StrUtf8ToStrUnicode(pszString , (const Char *)Response->Array[i].time);
				CtrlAddItemToCoolBarList_Lable(this, pListItem, TIME_X, CONTENT_Y+nHeigh, 0, TIME_FONT, pszString, RGB_COLOR_GRAY);	

				//回复
				if(Response->Array[i].uid != RenRenUserInfo.uid)
				{
					TUString::StrCopy(pszString,TResource::LoadConstString(APP_RE_ID_STRING_Reply));
					gItemData[i].TButtonReplyID = CtrlAddItemToCoolBarList_Button(this,  pListItem, BUTTON_REPLY_X, BUTTON_REPLY_Y, BUTTON_REPLY_W, BUTTON_REPLY_H, pszString);
				}
				//设置CoolBarList Item的高度
				pListItem->SetHeight(60 + nHeigh);
				//保存id
				gItemData[i].id = Response->Array[i].id;
				gItemData[i].uid = Response->Array[i].uid;
			}
		}
		
		pRowList->EndUpdate();

		delete Response;
		Response = NULL;
	}
	else
	{
		//显示无权限操作的情况(用户设置了阅读权限)
		if(nErrorCode == 200)
		{
			TUChar ErrorInfo[ERROR_INFO_LEN] = {0};
			int iResult = RenRenAPI_JsonParse_bSuccess(RR_GuestbookGet, ErrorInfo);
			if(iResult != 0)	
			{
				if(TUString::StrLen(ErrorInfo) > 0)
				{
					//显示错误提示
					TBarListItem* lpItem = NULL;
					lpItem = pBarRow->AppendItem();
					if (lpItem)  
					{
						CtrlAddItemToCoolBarList_Lable(this, lpItem, RR_INFO_X,  RR_INFO_Y, RR_INFO_W, FONT_NORMAL, (TUChar*)ErrorInfo);
						lpItem->SetHeight(RR_INFO_H);
						lpItem->SetEnabled(FALSE);
					}
				}
			}
		}
	}
	return TRUE;
}