/* Widgets */ Widgets::Widgets(QWidget* parent) : QMainWindow(parent) { m_officeStyle = Q_NULL; setWindowTitle(tr("Qtitan Widgets Sample")); m_styleName = qApp->style()->objectName(); m_mdiArea = new QMdiArea; m_mdiArea->setViewMode(QMdiArea::TabbedView); m_mdiArea->setLineWidth(3); m_mdiArea->setFrameShape(QFrame::Panel); m_mdiArea->setFrameShadow(QFrame::Sunken); setCentralWidget(m_mdiArea); setIconSize(QSize(16, 16)); createActions(); createDockWindows(); createMenubar(); createToolbar(); statusBar(); createMdiChild(); QRect geom = QApplication::desktop()->availableGeometry(); resize(2 * geom.width() / 3, 2 * geom.height() / 3); updateStyle(m_actOffice2007Style); updateTheme(m_actBlueTheme); readSettings(); }
ZLApplication::ZLApplication(const std::string &name) : ZLApplicationBase(name), RotationAngleOption(ZLCategoryKey::CONFIG, ROTATION, ANGLE, ZLView::DEGREES90), AngleStateOption(ZLCategoryKey::CONFIG, STATE, ANGLE, ZLView::DEGREES0), KeyboardControlOption(ZLCategoryKey::CONFIG, KEYBOARD, FULL_CONTROL, false), KeyDelayOption(ZLCategoryKey::CONFIG, "Options", "KeyDelay", 0, 5000, 250) { ourInstance = this; myContext = ZLibrary::createContext(); ZLOption::startAutoSave(30); myPresentWindowHandler = new PresentWindowHandler(); ZLCommunicationManager::Instance().registerHandler("present", myPresentWindowHandler); createToolbar(); createMenubar(); }
//------------------------------------------------- // Main Window //------------------------------------------------- GtkWidget* createMainWindow(void) { GtkRequisition actualSize; GtkWidget* window; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "YARP GTK Image Viewer"); gtk_window_set_default_size(GTK_WINDOW (window), _options.windWidth, _options.windHeight); gtk_window_set_resizable (GTK_WINDOW (window), TRUE); // When the window is given the "delete_event" signal (this is given // by the window manager, usually by the "close" option, or on the // titlebar), we ask it to call the delete_event () function // as defined above. The data passed to the callback // function is NULL and is ignored in the callback function. g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_event), NULL); // Box for main window GtkWidget *box; box = gtk_vbox_new (FALSE, 0); // parameters (gboolean homogeneous_space, gint spacing); gtk_container_add (GTK_CONTAINER (window), box); // MenuBar for main window menubar = createMenubar(); gtk_box_pack_start (GTK_BOX (box), menubar, FALSE, TRUE, 0); // parameters (GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, guint padding); gtk_widget_size_request(menubar, &actualSize); // Drawing Area : here the image will be drawed da = gtk_drawing_area_new (); g_signal_connect (da, "expose_event", G_CALLBACK (expose_CB), NULL); if (_options.outputEnabled == 1) { g_signal_connect (da, "button_press_event", G_CALLBACK (clickDA_CB), NULL); // Ask to receive events the drawing area doesn't normally subscribe to gtk_widget_set_events (da, gtk_widget_get_events (da) | GDK_BUTTON_PRESS_MASK); } gtk_box_pack_start(GTK_BOX(box), da, TRUE, TRUE, 0); // StatusBar for main window statusbar = gtk_statusbar_new (); updateStatusbar(GTK_STATUSBAR (statusbar)); gtk_box_pack_start (GTK_BOX (box), statusbar, FALSE, TRUE, 0); gtk_widget_size_request(statusbar, &actualSize); _occupiedHeight += 2*(actualSize.height); frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, _options.windWidth, _options.windHeight); // TimeOut used to refresh the screen timeout_ID = gtk_timeout_add (_options.refreshTime, timeout_CB, NULL); return window; }
ZLApplication::ZLApplication(const std::string &name) : ZLApplicationBase(name), RotationAngleOption(ZLCategoryKey::CONFIG, ROTATION, ANGLE, ZLView::DEGREES90), AngleStateOption(ZLCategoryKey::CONFIG, STATE, ANGLE, ZLView::DEGREES0), KeyboardControlOption(ZLCategoryKey::CONFIG, KEYBOARD, FULL_CONTROL, false), ConfigAutoSavingOption(ZLCategoryKey::CONFIG, CONFIG, AUTO_SAVE, true), ConfigAutoSaveTimeoutOption(ZLCategoryKey::CONFIG, CONFIG, TIMEOUT, 1, 6000, 30), KeyDelayOption(ZLCategoryKey::CONFIG, "Options", "KeyDelay", 0, 5000, 250) { ourInstance = this; myContext = ZLibrary::createContext(); if (ConfigAutoSavingOption.value()) { ZLOption::startAutoSave(ConfigAutoSaveTimeoutOption.value()); } myPresentWindowHandler = new PresentWindowHandler(); ZLCommunicationManager::Instance().registerHandler("present", myPresentWindowHandler); createToolbar(ZLApplicationWindow::WINDOW_TOOLBAR); createToolbar(ZLApplicationWindow::FULLSCREEN_TOOLBAR); createMenubar(); }
/* *=========================================================================== * M A I N *=========================================================================== */ int main(int argc, char **argv) { gtk_set_locale(); gtk_init(&argc, &argv); GtkWidget* mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(mainwin), "Chi Siahu"); g_signal_connect( G_OBJECT(mainwin), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect( G_OBJECT(mainwin), "destroy", G_CALLBACK(destroy), NULL); GtkWidget* menubar = createMenubar(); GtkWidget* toolbar = createToolbar(); GtkWidget* body = createBody(); GtkWidget* statusbar = createStatusbar(); GtkWidget* box = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(box), menubar, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(box), toolbar, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(box), body, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), statusbar, FALSE, FALSE, 0); //gtk_container_set_border_width(GTK_CONTAINER(mainwin), 5); gtk_container_add(GTK_CONTAINER(mainwin), box); fft_in = (double *) fftw_malloc(sizeof(double) * N); fft_out = (fftw_complex *) fftw_malloc(sizeof(fftw_complex) * M); fft_plan = fftw_plan_dft_r2c_1d(N, fft_in, fft_out, FFTW_MEASURE); gtk_widget_show_all(mainwin); gtk_main(); return 0; }