static void addButtons(int height, int width, newtComponent form, newtComponent * okay, newtComponent * cancel, int flags) { if (flags & FLAG_NOCANCEL) { *okay = makeButton((width - 8) / 2, height - buttonHeight - 1, "Ok"); *cancel = NULL; newtFormAddComponent(form, *okay); } else { *okay = makeButton((width - 18) / 3, height - buttonHeight - 1, "Ok"); *cancel = makeButton(((width - 18) / 3) * 2 + 9, height - buttonHeight - 1, "Cancel"); newtFormAddComponents(form, *okay, *cancel, NULL); } }
void FormMultiWidget::addEditor(int idx) { FormatTextEdit *editor = new FormatTextEdit(this); m_editors.insert(idx, editor); m_minusButtons.insert(idx, makeButton(m_minusIcon, SLOT(minusButtonClicked()))); m_plusButtons.insert(idx + 1, new ButtonWrapper(makeButton(m_plusIcon, SLOT(plusButtonClicked())), editor)); connect(editor, SIGNAL(textChanged()), SLOT(slotTextChanged())); connect(editor, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged())); connect(editor, SIGNAL(cursorPositionChanged()), SIGNAL(cursorPositionChanged())); editor->installEventFilter(this); emit editorCreated(editor); }
void TipButton::make_dialog_gadgets( DialogBox* db ) { // Calculate "Tip of the Day" file and number of entries const char* oadPath = GetOadDir(); sprintf( _tipsFile, "%stips.txt", oadPath ); FILE* fp = fopen( _tipsFile, "rt" ); assert( fp ); _nTips = 0; char szTipText[ 1024 ]; while ( fgets( szTipText, sizeof( szTipText ), fp ) ) ++_nTips; fclose( fp ); _dlg = db->dlgFollow; makeButton( _dlg, "Tip", DLG_BUTTON, 0, db->y ); //_dlg->key = '?'; _dlg->x = (_dlg-1)->x + (_dlg-1)->width + 10; _dlg->width = 75; db->main_feel[ db->idxFeel ].feel = feel_button_up, db->main_feel[ db->idxFeel++ ].index = db->idxButton; SET_BUTTON_SHEET( _dlg, 0 ); // Global button SET_BUTTON_INDEX( _dlg, db->idxGlue ); ++db->idxGlue; }
void DebugGui::winCreated(void) { //slog("debuggui wincreated \n"); //wStatus = makeLabel(L"Status",3300, 40,32, 520, 24); // wUrl = makeLabel(L"Url",3301, 16,40+32, 520, 48); //wStatLine = makeLabel(L"Statusline",3302, 16,40+32+64, 520, 92); makeButton(L"Play", 3200, 16, 120, 64, 24); makeButton(L"Pause", 3201, 16+70, 120, 64, 24); makeButton(L"Stop", 3202, 16+70+70, 120, 64, 24); makeButton(L"Update", 3203, 16+70+70+70, 120, 64, 24); update(); }//wincreated
int messageBox(const char * text, int height, int width, int type, int flags) { newtComponent form, yes, tb, answer; newtComponent no = NULL; int tFlag = (flags & FLAG_SCROLL_TEXT) ? NEWT_FLAG_SCROLL : 0; form = newtForm(NULL, NULL, 0); tb = newtTextbox(1, 1, width - 2, height - 3 - buttonHeight, NEWT_FLAG_WRAP | tFlag); newtTextboxSetText(tb, text); newtFormAddComponent(form, tb); switch ( type ) { case MSGBOX_INFO: break; case MSGBOX_MSG: yes = makeButton((width - 8) / 2, height - 1 - buttonHeight, "Ok"); newtFormAddComponent(form, yes); break; default: yes = makeButton((width - 16) / 3, height - 1 - buttonHeight, "Yes"); no = makeButton(((width - 16) / 3) * 2 + 9, height - 1 - buttonHeight, "No"); newtFormAddComponents(form, yes, no, NULL); if (flags & FLAG_DEFAULT_NO) newtFormSetCurrent(form, no); } if ( type != MSGBOX_INFO ) { newtRunForm(form); answer = newtFormGetCurrent(form); if (answer == no) return DLG_CANCEL; } else { newtDrawForm(form); newtRefresh(); } return DLG_OKAY; }
FormMultiWidget::FormMultiWidget(const QString &label, QWidget *parent) : QWidget(parent), m_hideWhenEmpty(false), m_multiEnabled(false), m_plusIcon(QIcon(QLatin1String(":/images/plus.png"))), // make static m_minusIcon(QIcon(QLatin1String(":/images/minus.png"))) { m_label = new QLabel(this); QFont fnt; fnt.setBold(true); m_label->setFont(fnt); m_label->setText(label); m_plusButtons.append( new ButtonWrapper(makeButton(m_plusIcon, SLOT(plusButtonClicked())), 0)); }
LabCanvas::LabCanvas(QWidget *parent, QMenuBar *menu) : SupportCanvas3D(parent) { // default render settings m_renderTechnique = RENDER_SHADED; m_lightingEnabled = true; m_menuOffset = LABCANVAS_BUTTON_SPACING; makeRenderTechniqueButton("Points", RENDER_POINT); makeRenderTechniqueButton("Wireframe", RENDER_WIREFRAME); makeRenderTechniqueButton("Shaded", RENDER_SHADED); QPushButton* b = makeButton("Toggle Lighting"); b->setCheckable(true); b->setChecked(m_lightingEnabled); connect(b, SIGNAL(clicked()), this, SLOT(toggleLights())); }
TimelineButton::TimelineButton(float _length) : GuiButton() { totalWidth = 1400; curveRadius = 14; length = _length; if(length < 1.0) { length = 1.0; } height = 69; width = totalWidth * length / 60; curveBuffer = curveRadius * 2; widthSegment = width - curveBuffer; heightSegment = height - curveBuffer; makeDropShadow(); makeButton(); makeInnerCurve(); makeOuterCurve(); if(_length > 2.0) { img.loadImage("cuts/timeline_button_audio_big_blue.png"); } else { img.loadImage("cuts/timeline_button_saudio_small_blue.png"); } }
void LabCanvas::makeRenderTechniqueButton(QString title, int renderTechnique) { QPushButton* push = makeButton(title); push->setProperty("data", renderTechnique); connect(push, SIGNAL(clicked()), this, SLOT(pickRenderTechnique())); }
/* * This dialog is designed to unify the old word, view, and graph type dialogs * into a cohesive whole. * */ ViewDimensions::ViewDimensions(MainWindow *parent) : Dialog(parent, "Dimensions", true) { WorldDimProp::add(this); viewXMin = getUnitDoubleSpinBox(); connect(viewXMin, SIGNAL(valueChanged(double)), this, SLOT(readjXMax())); viewXMax = getUnitDoubleSpinBox(); connect(viewXMax, SIGNAL(valueChanged(double)), this, SLOT(readjXMin())); viewYMin = getUnitDoubleSpinBox(); connect(viewYMin, SIGNAL(valueChanged(double)), this, SLOT(readjYMax())); viewYMax = getUnitDoubleSpinBox(); connect(viewYMax, SIGNAL(valueChanged(double)), this, SLOT(readjYMin())); worldXMin = new QLineEdit(); connect(worldXMin, SIGNAL(textEdited(QString)), this, SLOT(updateScale())); worldXMax = new QLineEdit(); connect(worldXMax, SIGNAL(textEdited(QString)), this, SLOT(updateScale())); worldYMin = new QLineEdit(); connect(worldYMin, SIGNAL(textEdited(QString)), this, SLOT(updateScale())); worldYMax = new QLineEdit(); connect(worldYMax, SIGNAL(textEdited(QString)), this, SLOT(updateScale())); worldType = new QComboBox(); for (int k=0;k<OPTS_LEN;k++) { worldType->addItem(opts[k].iname); } connect(worldType, SIGNAL(currentIndexChanged(int)), this, SLOT(updateScale())); viewSelect = makeButton("Rect Select", SLOT(viewRect())); setButtonBold(viewSelect); rescaleAxes = makeButton("Autoscale", SLOT(rescaleTicks())); setButtonBold(rescaleAxes); autoHook(viewXMin); autoHook(viewXMax); autoHook(viewYMin); autoHook(viewYMax); autoHook(worldXMin); autoHook(worldXMax); autoHook(worldYMin); autoHook(worldYMax); autoHook(worldType); QHBoxLayout* header = new QHBoxLayout(); header->addWidget(makeLabel("Graph Type"), 0); header->addWidget(worldType, 0); header->addStretch(1); QGridLayout* wrldl = new QGridLayout(); addPair(wrldl, 0, makeLabel("X Min"), worldXMin); addPair(wrldl, 1, makeLabel("X Max"), worldXMax); addPair(wrldl, 2, makeLabel("Y Min"), worldYMin); addPair(wrldl, 3, makeLabel("Y Max"), worldYMax); wrldl->setRowMinimumHeight(4, 12); wrldl->addWidget(rescaleAxes, 5, 0, 1, 2, Qt::AlignCenter); wrldl->setColumnMinimumWidth(1, 100); wrldl->setColumnStretch(0, 0); wrldl->setColumnStretch(1, 2); QGroupBox* wrldb = makeGroupBox("World Coords"); wrldb->setLayout(wrldl); QVBoxLayout* wrld = new QVBoxLayout(); wrld->addWidget(wrldb, 0); wrld->addStretch(1); QGridLayout* viewl = new QGridLayout(); addPair(viewl, 0, makeLabel("X Min"), viewXMin); addPair(viewl, 1, makeLabel("X Max"), viewXMax); addPair(viewl, 2, makeLabel("Y Min"), viewYMin); addPair(viewl, 3, makeLabel("Y Max"), viewYMax); viewl->setRowMinimumHeight(4, 12); viewl->addWidget(viewSelect, 5, 0, 1, 2, Qt::AlignCenter); viewl->setColumnMinimumWidth(1, 120); viewl->setColumnStretch(0, 0); viewl->setColumnStretch(1, 2); QGroupBox* viewb = makeGroupBox("View Coords"); viewb->setLayout(viewl); QVBoxLayout* view = new QVBoxLayout(); view->addWidget(viewb, 0); view->addStretch(1); QHBoxLayout* bot = new QHBoxLayout(); bot->addLayout(wrld); bot->addLayout(view); QVBoxLayout* ovr = new QVBoxLayout(); ovr->addLayout(header); ovr->addStrut(12); ovr->addLayout(bot); this->setDialogLayout(ovr); }
void TrackButtons::slotUpdateTracks() { #if 0 RG_DEBUG << "TrackButtons::slotUpdateTracks()"; static QTime t; RG_DEBUG << " elapsed: " << t.restart(); #endif if (!m_doc) return; Composition &comp = m_doc->getComposition(); const int newNbTracks = comp.getNbTracks(); //RG_DEBUG << "TrackButtons::slotUpdateTracks > newNbTracks = " << newNbTracks; // If a track or tracks were deleted if (newNbTracks < m_tracks) { // For each deleted track, remove a button from the end. for (int i = m_tracks; i > newNbTracks; --i) removeButtons(i - 1); } else if (newNbTracks > m_tracks) { // if added // For each added track for (int i = m_tracks; i < newNbTracks; ++i) { Track *track = m_doc->getComposition().getTrackByPosition(i); if (track) { // Make a new button QFrame *trackHBox = makeButton(track); if (trackHBox) { trackHBox->show(); // Add the new button to the layout. m_layout->insertWidget(i, trackHBox); m_trackHBoxes.push_back(trackHBox); } } else RG_DEBUG << "TrackButtons::slotUpdateTracks - can't find TrackId for position " << i; } } m_tracks = newNbTracks; if (m_tracks != (int)m_trackHBoxes.size()) RG_DEBUG << "WARNING TrackButtons::slotUpdateTracks(): m_trackHBoxes.size() != m_tracks"; if (m_tracks != (int)m_trackLabels.size()) RG_DEBUG << "WARNING TrackButtons::slotUpdateTracks(): m_trackLabels.size() != m_tracks"; // For each track for (int i = 0; i < m_tracks; ++i) { Track *track = comp.getTrackByPosition(i); if (!track) continue; // *** Set Track Size *** // Track height can change when the user moves segments around and // they overlap. m_trackHBoxes[i]->setMinimumSize(labelWidth(), trackHeight(track->getId())); m_trackHBoxes[i]->setFixedHeight(trackHeight(track->getId())); } populateButtons(); // This is necessary to update the widgets's sizeHint to reflect any change in child widget sizes // Make the TrackButtons QFrame big enough to hold all the track buttons. // Some may have grown taller due to segments that overlap. // Note: This appears to no longer be needed. But it doesn't hurt. adjustSize(); }
wxButton *BookmarkView::addButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler) { wxButton *nButton = makeButton(parent, labelVal, handler); parent->GetSizer()->Add( nButton, 0, wxEXPAND); return nButton; }