/* * コンストラクタ。 * @return なし */ ScreenControl::ScreenControl() : mHandle(), mInfo() { // 初期ハンドルの取得 mInitHandle = GetStdHandle(STD_OUTPUT_HANDLE); // スクリーン情報設定 infoUpdate(); // カラー情報の初期値退避 mInitColor = mInfo.wAttributes; // バッファサイズの初期値退避 mInitBufferSize.X = mInfo.dwSize.X; mInitBufferSize.Y = mInfo.dwSize.Y; // 画面バッファ表示サイズの初期値退避 mInitWindow.Bottom = mInfo.srWindow.Bottom - mInfo.srWindow.Top; mInitWindow.Top = 0; mInitWindow.Left = 0; mInitWindow.Right = mInfo.srWindow.Right - mInfo.srWindow.Left; // スクリーンバッファを作成 mHandle = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); if (INVALID_HANDLE_VALUE == mHandle) { std::cerr << "Error" << std::endl; } // 対象のスクリーンバッファをアクティブ化 SetConsoleActiveScreenBuffer(mHandle); }
/* * カーソル座標値取得メソッド。 * @return なし */ void ScreenControl::getCursorPosition( long& x, // [out] X long& y // [out] Y ) { infoUpdate(); x = mInfo.dwCursorPosition.X; y = mInfo.dwCursorPosition.Y; return; }
SaveCHEAsDialog::SaveCHEAsDialog(const QString user, const CHEInfoBasic* info, const QString path) { mLastPath = path; mUserNameLabel = new QLabel(tr("User Name:")); mUserNameLineEdit = new QLineEdit(); mUserNameLineEdit->setFixedWidth(350); mUserNameLineEdit->setText(user); mUserNameLabel->setBuddy(mUserNameLineEdit); mUserNameHBox = new QHBoxLayout(); mUserNameHBox->addWidget(mUserNameLabel); mUserNameHBox->addWidget(mUserNameLineEdit, 0 , Qt::AlignRight); mProjectNameLabel = new QLabel(tr("Name: ")); mProjectNameEdit = new QLineEdit(); mProjectNameEdit->setFixedWidth(350); mProjectNameLabel->setBuddy(mProjectNameEdit); connect(mProjectNameEdit, SIGNAL(textChanged(QString)), this, SLOT(projectNameChanged(QString))); mProjectHBox = new QHBoxLayout(); mProjectHBox->addWidget(mProjectNameLabel, 0 , Qt::AlignLeft); mProjectHBox->addWidget(mProjectNameEdit, 0 , Qt::AlignRight); mLocationLabel = new QLabel(tr("Location:")); mLocationLineEdit = new QLineEdit(); mLocationLabel->setBuddy(mLocationLineEdit); connect(mLocationLineEdit, SIGNAL(textChanged(QString)), this, SLOT(projectPathChanged(QString))); mLocationLineEdit->setText(QCoreApplication::applicationDirPath()); mProjectPath = QDir::toNativeSeparators(QCoreApplication::applicationDirPath()); mLocationLineEdit->setFixedWidth(270); mLocationBrowseButton = new QPushButton("Browse"); connect(mLocationBrowseButton, SIGNAL(clicked()), this, SLOT(locationBrowse())); mLocationHBox = new QHBoxLayout(); mLocationHBox->addWidget(mLocationLabel); mLocationHBox->addWidget(mLocationLineEdit, 0 , Qt::AlignRight); mLocationHBox->addWidget(mLocationBrowseButton); mObjectContent->setText(info->object); mMeasurementContent->setText(info->measurement); mCreationContent->setText(info->creation); mMaterialContent->setText(info->material); mDescriptionContent->setText(info->description); mConservationContent->setText(info->conservation); mAnalysesContent->setText(info->analyses); mRelatedContent->setText(info->related); mAdministrationContent->setText(info->administration); mDocumentsContent->setText(info->documents); mOtherContent->setText(info->other); mButtonGridBox = new QGridLayout(); mNextButton = new QPushButton("Next"); mNextButton->setEnabled(false); connect(mNextButton, SIGNAL(clicked()), this, SLOT(next())); mCancelButton = new QPushButton("Cancel"); connect(mCancelButton, SIGNAL(clicked()), this, SLOT(cancel())); mButtonGridBox->addWidget(mNextButton, 0, 5, 1, 4, Qt::AlignVCenter | Qt::AlignRight); mButtonGridBox->addWidget(mCancelButton, 0, 5, 1, 5, Qt::AlignVCenter | Qt::AlignRight); mDialog->setWindowTitle(tr("Save Cultural Heritage As..")); mVBox->addLayout(mProjectHBox); mVBox->addLayout(mLocationHBox); mVBox->addLayout(mUserNameHBox); mVBox->addLayout(mGrid); mVBox->addLayout(mButtonGridBox); connect(this, SIGNAL(infoUpdate()), this, SLOT(enableNextButton())); mDialog->setMinimumWidth(350); //mDialog->adjustSize(); mDialog->setLayout(mVBox); }
void SaveCHEAsDialog::projectPathChanged(QString path) { mProjectPath = path; emit infoUpdate(); }
void SaveCHEAsDialog::projectNameChanged(QString name) { mProjectName = name; emit infoUpdate(); }