AG_Titlebar * AG_TitlebarNew(void *parent, Uint flags) { AG_Titlebar *tbar; tbar = Malloc(sizeof(AG_Titlebar)); AG_ObjectInit(tbar, &agTitlebarClass); tbar->flags |= flags; AG_ObjectAttach(parent, tbar); /* * Manually update the window/driver pointers since AG_TitlebarNew() * is called from the Window attach routine. */ AG_ObjectLock(tbar); tbar->win = (AG_Window *)parent; WIDGET(tbar)->window = tbar->win; WIDGET(tbar)->drv = WIDGET(parent)->drv; WIDGET(tbar)->drvOps = AGDRIVER_CLASS(WIDGET(tbar)->drv); AG_ObjectUnlock(tbar); if ((flags & AG_TITLEBAR_NO_MAXIMIZE) == 0) CreateMaximizeButton(tbar); if ((flags & AG_TITLEBAR_NO_MINIMIZE) == 0) CreateMinimizeButton(tbar); if ((flags & AG_TITLEBAR_NO_CLOSE) == 0) CreateCloseButton(tbar); return (tbar); }
void tApErrorStateWidget::ShowNotDeployed() { int margin = 15; int spacing = 15; m_pErrorIcon = new QLabel(); m_pErrorIcon->setPixmap(ErrorPixmap()); m_pErrorLabel1 = new QLabel( tr( "Trolling motor not deployed" ) ); m_pErrorLabel1->setWordWrap( true ); CreateCloseButton(); QVBoxLayout* vLayout = new QVBoxLayout; vLayout->setContentsMargins( margin, margin, margin, margin ); vLayout->setSpacing( spacing ); QHBoxLayout* hLayout = new QHBoxLayout; hLayout->setContentsMargins( 0, 0, 0, 0 ); hLayout->setSpacing( spacing ); vLayout->addStretch(); hLayout->addWidget( m_pErrorIcon, Qt::AlignLeft ); hLayout->addWidget( m_pErrorLabel1, Qt::AlignTop | Qt::AlignLeft ); vLayout->addLayout( hLayout ); vLayout->addStretch(); vLayout->addWidget( m_pCloseBtn ); setLayout( vLayout ); m_pCloseBtn->setFocus(); }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tApErrorStateWidget::ShowNoAutopilotComputer() { int margin = 15; int spacing = 15; m_pErrorIcon = new QLabel(); m_pErrorIcon->setPixmap(ErrorPixmap()); m_pErrorLabel1 = new QLabel( tr( "No autopilot computer" ) ); m_pErrorLabel1->setWordWrap(true); CreateCloseButton(); QVBoxLayout* vLayout = new QVBoxLayout; vLayout->setContentsMargins( margin, margin, margin, margin ); vLayout->setSpacing( spacing ); QHBoxLayout* hLayout = new QHBoxLayout; hLayout->setContentsMargins( 0, 0, 0, 0 ); hLayout->setSpacing( spacing ); vLayout->addStretch(); hLayout->addWidget( m_pErrorIcon, Qt::AlignLeft ); hLayout->addWidget( m_pErrorLabel1, Qt::AlignTop | Qt::AlignLeft ); vLayout->addLayout( hLayout ); vLayout->addStretch(); vLayout->addWidget( m_pCloseBtn ); setLayout( vLayout ); m_pCloseBtn->setFocus(); m_pUpdateTimer = new QTimer(this); Connect( m_pUpdateTimer, SIGNAL( timeout() ), this, SLOT( CheckHeartbeat() ) ); m_pUpdateTimer->start( 2000 ); }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tApErrorStateWidget::ShowUncommissioned() { QFont smallFont( font() ); smallFont.setPixelSize( style()->pixelMetric( NPM( tNOSStyle::NPM_FontSizeSmall ) ) ); m_pErrorIcon = new QLabel(); m_pErrorIcon->setPixmap(ErrorPixmap()); m_pErrorLabel1 = new QLabel( tr( "Autopilot has not been commissioned" ) ); m_pErrorLabel1->setFont(smallFont); m_pErrorLabel1->setWordWrap(true); QHBoxLayout* hLayout = new QHBoxLayout; hLayout->setContentsMargins( 0, 0, 0, 0 ); hLayout->setSpacing( 15 ); hLayout->addWidget( m_pErrorIcon, Qt::AlignLeft ); hLayout->addWidget( m_pErrorLabel1, Qt::AlignCenter /*Qt::AlignTop | Qt::AlignLeft*/ ); QFrame* pHSep = new QFrame(); pHSep->setFrameStyle( QFrame::HLine | QFrame::Plain ); pHSep->setLineWidth( 1 ); QLabel* pBoatLbl = new QLabel( tr( "Boat type" ) ); QLabel* pRudderCalLbl = new QLabel( tr( "Rudder calibration" ) ); QLabel* pRudderTestLbl = new QLabel( tr( "Rudder test" ) ); m_pBoatCheck = new tCheckBox(); m_pBoatCheck->setFocusPolicy( Qt::NoFocus ); m_pRudderCalCheck = new tCheckBox(); m_pRudderCalCheck->setFocusPolicy( Qt::NoFocus ); m_pRudderTestCheck = new tCheckBox(); m_pRudderTestCheck->setFocusPolicy( Qt::NoFocus ); CreateCloseButton(); QGridLayout* pLayout = new QGridLayout( this ); pLayout->setContentsMargins( 5, 5, 5, 5 ); pLayout->setSpacing( 5 ); int row = 0; pLayout->addLayout( hLayout, row++, 0, 1, 3 ); pLayout->addWidget( pHSep, row++, 0, 1, 3 ); pLayout->addWidget( pBoatLbl, row, 0, 1, 2 ); pLayout->addWidget( m_pBoatCheck, row++, 2, 1, 1, Qt::AlignRight ); pLayout->addWidget( pRudderCalLbl, row, 0, 1, 2 ); pLayout->addWidget( m_pRudderCalCheck, row++, 2, 1, 1, Qt::AlignRight ); pLayout->addWidget( pRudderTestLbl, row, 0, 1, 2 ); pLayout->addWidget( m_pRudderTestCheck, row++, 2, 1, 1, Qt::AlignRight ); pLayout->addWidget( m_pCloseBtn, row, 0, 1, 3 ); setLayout( pLayout ); m_pCloseBtn->setFocus(); UpdateCommissionedStatus(); // init values m_pUpdateTimer = new QTimer(this); Connect( m_pUpdateTimer, SIGNAL( timeout() ), this, SLOT( UpdateCommissionedStatus() ) ); m_pUpdateTimer->start( 3000 ); }
void tApErrorStateWidget::ShowCantSwitch(QString text) { int margin = 15; int spacing = 15; m_pErrorIcon = new QLabel(); m_pErrorIcon->setPixmap(ErrorPixmap()); // Turn elide off else text gets elided when it shouldn't // even though it can fit ( see NSW-24168 ) tLabel* pErrorLabel1 = new tLabel(); pErrorLabel1->setWordWrap( true ); pErrorLabel1->SetElideMode( Qt::ElideNone); pErrorLabel1->setText( text ); m_pErrorLabel1 = pErrorLabel1; CreateCloseButton(); QVBoxLayout* vLayout = new QVBoxLayout; vLayout->setContentsMargins( margin, margin, margin, margin ); vLayout->setSpacing( spacing ); QHBoxLayout* hLayout = new QHBoxLayout; hLayout->setContentsMargins( 0, 0, 0, 0 ); hLayout->setSpacing( spacing ); vLayout->addStretch(); hLayout->addWidget( m_pErrorIcon, Qt::AlignLeft ); hLayout->addWidget( m_pErrorLabel1, Qt::AlignTop | Qt::AlignLeft ); vLayout->addLayout( hLayout ); vLayout->addStretch(); vLayout->addWidget( m_pCloseBtn ); setLayout( vLayout ); m_pCloseBtn->setFocus(); }
int CStartupView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CScrollView::OnCreate(lpCreateStruct) == -1) return -1; CMainFrameA* pMainFrame = CMainFrameA::GetCurrentInstance(); if(pMainFrame!=NULL) { m_pImageManager = pMainFrame->GetCommandBars()->GetImageManager(); } WCHAR *pFontName = _T("Segoe UI"); LOGFONT logFontBtn; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontBtn.lfFaceName, pFontName); //logFontBtn.lfUnderline = true; logFontBtn.lfHeight = 12 + 2; m_btnFont.CreateFontIndirect(&logFontBtn); LOGFONT logFontBtn14; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn14); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontBtn14.lfFaceName, pFontName); logFontBtn14.lfWeight = FW_BOLD; logFontBtn14.lfHeight = 14 + 2; m_btnFont14.CreateFontIndirect(&logFontBtn14); LOGFONT logFontBtn12; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn12); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontBtn12.lfFaceName, pFontName); logFontBtn12.lfWeight = FW_BOLD; logFontBtn12.lfHeight = 12 + 2; m_btnFont12.CreateFontIndirect(&logFontBtn12); LOGFONT logFontWebBtn; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontWebBtn); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontWebBtn.lfFaceName, pFontName); logFontWebBtn.lfItalic = true; logFontWebBtn.lfWeight = FW_BOLD; logFontWebBtn.lfHeight = 12 + 2; m_webBtnFont.CreateFontIndirect(&logFontWebBtn); // Calculate width and height of tab title region LOGFONT logFont; ASSISTANT::FillLogFont(logFont, m_csTabFontFamily, m_iTabFontSize, _T("bold"), _T("roman"), false); m_iTabWidth = DrawSdk::Text::GetTextWidth(m_csStartPage, m_csStartPage.GetLength(), &logFont) + 3; m_iTabHeight = DrawSdk::Text::GetTextHeight(m_csStartPage, m_csStartPage.GetLength(), &logFont); LoadBitmaps(); CreateCloseButton(); CreateWelcomeButtons(); //CreateRecentlyOpenedButtons(); CreateShowAgainButton(); CreateToolTips(); SetScrollSizes( MM_TEXT, CSize(VIEW_DEFAULT_WIDTH, VIEW_DEFAULT_HEIGHT) ); RepositionButtons(); ShowToolTips(); return 0; }