//------------------------------------------------------------------------------ // void OnCustomView(wxCommandEvent& event) //------------------------------------------------------------------------------ void MissionTreeToolBar::OnCustomView(wxCommandEvent& event) { #ifdef DEBUG_MORE_VIEW_OPTIONS MessageInterface::ShowMessage("MissionTreeToolBar::OnCustomView() entered\n"); #endif int grandpX = 0, grandpY = 0, grandpW = 0, grandpH = 0; int parentX = 0, parentY = 0, parentW = 0, parentH = 0; int x = 0, y = 0; if (mParent->GetParent() != NULL) { mParent->GetParent()->GetScreenPosition(&grandpX, &grandpY); mParent->GetParent()->GetSize(&grandpW, &grandpH); } mParent->GetScreenPosition(&parentX, &parentY); mParent->GetSize(&parentW, &parentH); #ifdef DEBUG_MORE_VIEW_OPTIONS MessageInterface::ShowMessage (" grandpX = %3d, grandpY = %3d, grandpW = %3d, grandpH = %3d\n", grandpX, grandpY, grandpW, grandpH); MessageInterface::ShowMessage (" parentX = %3d, parentY = %3d, parentW = %3d, parentH = %3d\n", parentX, parentY, parentW, parentH); #endif if (parentX == grandpX) { x = parentX + parentW + 9; y = parentY - 30; } else { x = parentX + grandpW; y = grandpY; } #ifdef DEBUG_MORE_VIEW_OPTIONS MessageInterface::ShowMessage(" x = %3d, y = %3d\n", x, y); #endif ResetMissionTreeTools(); TreeViewOptionDialog optionDlg(this, mMissionTree, "MissionTree Customize View", wxPoint(x, y), wxDefaultSize, wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE); optionDlg.ShowModal(); }
Korn::Korn(QWidget *parent, KornSettings *settings, WFlags f) : QFrame(parent, "korn", f) { int count=0; KornButton *button; QBoxLayout::Direction dir= QBoxLayout::TopToBottom; _optionsDialog = 0; _noConfig = false; // popup menu menu = new QPopupMenu(); menu->insertItem(i18n("&Setup"), this, SLOT( optionDlg() )); menu->insertSeparator(); menu->insertItem(i18n("&Help"), this, SLOT( help() )); menu->insertItem(i18n("&About"), this, SLOT( about() )); menu->insertSeparator(); menu->insertItem(i18n("E&xit"), qApp, SLOT( quit() )); // widget decorations if(settings->layout() == KornSettings::horizontal ) dir = QBoxLayout::LeftToRight; QBoxLayout *layout = new QBoxLayout(this, dir, 2); setFrameStyle(Panel | Raised); setLineWidth(1); // read settings and create boxes options = new QList<KornBox>; options->setAutoDelete( true ); while( !settings->done() ) { // create a new button with these settings button = new KornButton(this, settings); button->resize(20,20); layout->addWidget(button); connect( button, SIGNAL( rightClick() ), this, SLOT( popupMenu() )); button->show(); /// keep track of settings locally KornBox *thisBox = new KornBox; thisBox->name = settings->name().data(); thisBox->caption = settings->caption().data(); thisBox->path = settings->file().data(); thisBox->poll = settings->pollTime(); thisBox->notify = settings->audioCmd().data(); thisBox->click = settings->clickCmd().data(); options->append( thisBox ); count++; settings->nextBox(); } // dont layout or resize if no buttons were created // This should be changed, perhaps to a default single button if( !settings->valid() || count == 0 ) { // no valid config _noConfig = true; int result = KMsgBox::yesNo(0, i18n("korn: configure now?"), i18n("you have not yet configured korn.\n" "would you like to do this now?"), KMsgBox::QUESTION, i18n("Yes"), i18n("No - Quit")); if( result == 1 ) { // create a list with the default mailbox in it. KornBox *box = new KornBox; box->name = i18n("personal"); box->caption = i18n("Inbox"); box->path = (const char *)getenv("MAIL"); box->poll = 240; options->append( box ); optionDlg(); } else { qApp->quit(); } return; } if( dir == QBoxLayout::LeftToRight ) resize(count*(2+20)+2,4+20); else resize(4+20, count*(2+20)+2); // move to the saved position if a position was saved if( settings->geomSet() ) { setGeometry( settings->geom().x(), settings->geom().y(), width(), height() ); } else { // save position KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup("Korn"); config->writeEntry("PosX", frameGeometry().x(), true); config->writeEntry("PosY", frameGeometry().y(), true); config->writeEntry("winHeight", frameGeometry().height(), true); } if( settings->noMouse() ) { XSelectInput( x11Display(), handle(), ExposureMask | StructureNotifyMask ); } }