void BaseRadioButton::Init() { InitIcon(false, false); InitIcon(false, true); InitIcon(true, false); InitIcon(true, true); }
BOOL CMsgBoxDlg::OnInitDialog() { CStringLoaderDlg<CBCGPDialog>::OnInitDialog(); GetDlgItem(IDC_STATIC_INFO)->SetWindowText(m_strText); if(m_nType == (MB_OK|MB_ICONQUESTION|MB_SYSTEMMODAL)) { SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE);//保持窗口在最前 } InitWindow(); InitIcon(); InitButton(); CenterWindow(); if (m_bAutoClose) { SetTimer(10, 1000,NULL); } return FALSE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
bool VirtualWifiNotifyIcon::Show() { v_log->write_log_come_to("VirtualWifiNotifyIcon::Show()"); InitIcon(m_hwnd); set_notify_tip(); return VirtualWifiNotifyIconBase::Show(); }
AlertView::AlertView(BRect frame, const char *name) : BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED), // we will wait 12 seconds until we send a message fSeconds(12) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fBitmap = InitIcon(); BRect rect(60, 8, 400, 36); BStringView *stringView = new BStringView(rect, NULL, "Do you wish to keep these settings?"); stringView->SetFont(be_bold_font); stringView->ResizeToPreferred(); AddChild(stringView); rect = stringView->Frame(); rect.OffsetBy(0, rect.Height()); fCountdownView = new BStringView(rect, "countdown", NULL); UpdateCountdownView(); fCountdownView->ResizeToPreferred(); AddChild(fCountdownView); BButton* keepButton = new BButton(rect, "keep", "Keep", new BMessage(BUTTON_KEEP_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); keepButton->ResizeToPreferred(); AddChild(keepButton); BButton* button = new BButton(rect, "undo", "Undo", new BMessage(BUTTON_UNDO_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); button->ResizeToPreferred(); AddChild(button); // we're resizing ourselves to the right size // (but we're not implementing GetPreferredSize(), bad style!) float width = stringView->Frame().right; if (fCountdownView->Frame().right > width) width = fCountdownView->Frame().right; if (width < Bounds().Width()) width = Bounds().Width(); float height = fCountdownView->Frame().bottom + 24 + button->Bounds().Height(); ResizeTo(width, height); keepButton->MoveTo(Bounds().Width() - 8 - keepButton->Bounds().Width(), Bounds().Height() - 8 - keepButton->Bounds().Height()); button->MoveTo(keepButton->Frame().left - button->Bounds().Width() - 8, keepButton->Frame().top); keepButton->MakeDefault(true); }
void InitCommonPage ( HWND hDlg ) { DlgTxt ( hDlg, IDC_LOCATION_STATIC, T_DLG_LOCATION ); DlgTxt ( hDlg, IDC_SIZE_STATIC, T_DLG_SIZE ); DlgTxt ( hDlg, IDC_CONTAINS_STATIC, T_DLG_CONTAINS ); InitIcon ( hDlg ); if ( m_tList.OneFile () ) { const WIN32_FIND_DATA & tData = m_tList.m_dFiles [0]->m_tData; SHFILEINFO tShFileInfo; SHGetFileInfo ( m_tList.m_sRootDir + tData.cFileName, tData.dwFileAttributes, &tShFileInfo, sizeof (SHFILEINFO), SHGFI_TYPENAME ); SetDlgItemText ( hDlg, IDC_TYPE, tShFileInfo.szTypeName ); SetDlgItemText ( hDlg, IDC_FILENAME_STATIC, tData.cFileName ); SetDlgItemText ( hDlg, IDC_LOCATION, m_tList.m_sRootDir + tData.cFileName ); } else { wchar_t szBuf [128]; wsprintf ( szBuf, Txt ( T_DLG_FILESFOLDERS ), m_nFiles, m_nFolders ); SetDlgItemText ( hDlg, IDC_TYPE, Txt ( T_DLG_MULTIFILES ) ); SetDlgItemText ( hDlg, IDC_FILENAME_STATIC, szBuf ); SetDlgItemText ( hDlg, IDC_LOCATION, m_tList.m_sRootDir ); } SendMessage ( GetDlgItem ( hDlg, IDC_FILENAME_STATIC ), WM_SETFONT, (WPARAM)g_tResources.m_hBoldSystemFont, TRUE ); const WIN32_FIND_DATA & tData = m_tList.m_dFiles [0]->m_tData; wchar_t szSize [FILESIZE_BUFFER_SIZE*2 + 64]; wchar_t szSize1 [FILESIZE_BUFFER_SIZE]; wchar_t szSize2 [FILESIZE_BUFFER_SIZE]; if ( tData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) { wsprintf ( szSize, Txt ( T_DLG_SIZE_DETAILED ), FileSizeToString ( m_uSize, szSize1, true ), FileSizeToStringByte ( m_uSize, szSize2 ) ); SetDlgItemText ( hDlg, IDC_FILE_SIZE, szSize ); wsprintf ( szSize, Txt ( T_DLG_FILESFOLDERS ), m_nFiles, m_nFolders - 1 ); SetDlgItemText ( hDlg, IDC_CONTAINS, szSize ); } else { ShowWindow ( GetDlgItem ( hDlg, IDC_CONTAINS_STATIC ), SW_HIDE ); ShowWindow ( GetDlgItem ( hDlg, IDC_CONTAINS ), SW_HIDE ); wsprintf ( szSize, Txt ( T_DLG_SIZE_DETAILED ), FileSizeToString ( m_uSize, szSize1, true ), FileSizeToStringByte ( m_uSize, szSize2 ) ); SetDlgItemText ( hDlg, IDC_FILE_SIZE, szSize ); } }
MediaAlert::MediaAlert(BRect _rect, const char* title, const char* text) : BWindow(_rect, title, B_MODAL_WINDOW, B_NOT_CLOSABLE | B_NOT_RESIZABLE) { fTextView = NULL; // Set up the "_master_" view TAlertView* masterView = new TAlertView(Bounds()); masterView->SetBitmap(InitIcon()); AddChild(masterView); // Set up the text view BRect textViewRect(kTextIconOffset, kTextTopOffset, Bounds().right, Bounds().bottom); BRect rect = textViewRect; rect.OffsetTo(B_ORIGIN); rect.InsetBy(4, 2); fTextView = new BTextView(textViewRect, "_tv_", rect, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); fTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fTextView->SetText(text, strlen(text)); fTextView->MakeEditable(false); fTextView->MakeSelectable(false); fTextView->SetWordWrap(true); fTextView->SetFontAndColor(be_bold_font); masterView->AddChild(fTextView); BRect screenFrame = BScreen(B_MAIN_SCREEN_ID).Frame(); BPoint pt; pt.x = screenFrame.Width() / 2 - Bounds().Width() / 2; pt.y = screenFrame.Height() / 2 - Bounds().Height() / 2; if (screenFrame.Contains(pt)) MoveTo(pt); }
void HUD2::InitWidgets( void ) { QPalette p; QFont f; bOil = false; Oil = InitIcon( 270, 25, ":/images/icons/oil_gray.png" ); bTemp = false; Temp = InitIcon( 350, 25, ":/images/icons/temp_gray.png" ); bBreak = false; Break = InitIcon( 410, 25, ":/images/icons/break_gray.png" ); bFuel = false; Fuel = InitIcon( 280, 88, ":/images/icons/fuel_red.png" ); bBattery = false; Battery = InitIcon( 375, 75, ":/images/icons/battery_red.png" ); FuelLevel = InitLabel( 270, 140, 22, tr("--%"), Qt::white ); BatteryLevel = InitLabel( 375, 140, 22, tr("--.-V"), Qt::white ); bBNAP = false; BNAP = InitLabel( 15, 65, 20, tr("БНАП"), Qt::red ); bMPIOVD = false; MPIOVD = InitLabel( 15, 95, 20, tr("МПИОВД"), Qt::red ); bCC = false; CC = InitLabel( 15, 125, 20, tr("ДЦ"), Qt::red ); Time = InitLabel( 15, 155, 16, tr("--:--:--"), Qt::white ); Date = InitLabel( 15, 185, 16, tr("--------"), Qt::white ); N = InitLabel( 15, 15, 14, tr("N:--,-----"), Qt::white ); E = InitLabel( 15, 35, 14, tr("E:--,-----"), Qt::white ); H = InitLabel ( 145, 15, 14, tr("H :---"), Qt::white ); Vel = InitLabel( 145, 35, 14, tr("Vel:---"), Qt::white ); Cog = InitLabel( 145, 55, 14, tr("Cog:---"), Qt::white ); Fix = InitLabel( 145, 75, 14, tr("Fix:---"), Qt::white ); Sat = InitLabel( 145, 95, 14, tr("Sat:---"), Qt::white ); Eph = InitLabel( 145, 115, 14, tr("Eph:---"), Qt::white ); GSM = InitLabel( 145, 185, 14, tr("GSM:---"), Qt::white ); Message = new Clickable( "", this ); f = QFont( "Arial", 16 ); f.setBold( true ); Message->setAutoFillBackground( true ); p = Message->palette(); //p.setColor( QPalette::Window, Qt::black); p.setColor( QPalette::WindowText, QColor( 255, 0, 0 )); Message->setAlignment( Qt::AlignCenter ); Message->setFont( f ); Message->setPalette( p ); Message->setGeometry( 10, 225, 460, 30 ); Timer = new QTimer(); btnClose = new QPushButton( this ); btnClose->setGeometry( 430, 180, 40, 40 ); btnClose->setText( tr( "X" ) ); connect( Message, SIGNAL( clicked() ), this, SLOT( MessageClicked() ) ); connect( Timer, SIGNAL( timeout() ), this, SLOT( Timeout() ) ); connect( btnClose, SIGNAL( clicked() ), this, SLOT( CloseClicked( ) ) ); Timer->start( 1000 ); }