Gdk::RGBA rgbcolour_to_gdkcolor(const fwk::RgbColour & colour) { Gdk::RGBA gdkcolour; gdkcolour.set_rgba_u(fwk_rgbcolour_component(&colour, 0), fwk_rgbcolour_component(&colour, 1), fwk_rgbcolour_component(&colour, 2)); return gdkcolour; }
void EmblemCellRenderer::do_render(const Cairo::RefPtr<Cairo::Context>& context, int widget, int background_area, Gdk::Rectangle &cell_area, int flags) { context->translate(cell_area.get_x(), cell_area.get_y()); context->rectangle(0, 0, cell_area.get_width(), cell_area.get_height()); context->clip(); // TODO: Incorporate padding context->push_group(); if (!this->_icon_name.empty()) { Glib::RefPtr<Gdk::Pixbuf> pixbuf = this->_get_pixbuf(this->_icon_name, this->_icon_size); context->set_operator(Cairo::OPERATOR_SOURCE); // Assumes square icons; may break if we don't get the requested size int height_offset = int((cell_area.get_height() - pixbuf->get_height())/2); Gdk::Cairo::set_source_pixbuf(context, pixbuf, 0, height_offset); context->rectangle(0, height_offset, pixbuf->get_width(), pixbuf->get_height()); context->fill(); if (this->_tint_color) { Gdk::RGBA* c = this->_tint_color; gushort r = c->get_red(); gushort g = c->get_green(); gushort b = c->get_blue(); // Figure out the difference between our tint colour and an // empirically determined (i.e., guessed) satisfying luma and // adjust the base colours accordingly double luma = (r + r + b + g + g + g) / 6.; double extra_luma = (1.2 - luma) / 3.; r = std::min(r + extra_luma, 1.); g = std::min(g + extra_luma, 1.); b = std::min(b + extra_luma, 1.); context->set_source_rgba(r, g, b, 0.4); context->set_operator(Cairo::OPERATOR_ATOP); context->paint(); } if (!this->_emblem_name.empty()) { Glib::RefPtr<Gdk::Pixbuf> pixbuf = this->_get_pixbuf(this->_emblem_name, this->_emblem_size); int x_offset = this->_icon_size - this->_emblem_size; context->set_operator(Cairo::OPERATOR_OVER); Gdk::Cairo::set_source_pixbuf(context, pixbuf, x_offset, 0); context->rectangle(x_offset, 0, cell_area.get_width(), this->_emblem_size); context->fill(); } } context->pop_group_to_source(); context->set_operator(Cairo::OPERATOR_OVER); context->paint(); }
void GridWindow::on_button_solve_clicked() { // Attempt to solve the puzzle // Read the contents of the entries sudoku sudokuPuzzle; sudokuPuzzle.initPuzzle(m_entry); bool result = sudokuPuzzle.SolvePuzzle(); if(result) { Glib::ustring finalValue; Gdk::RGBA solutionColor; solutionColor.set_rgba(1.0,0.0,0.0,1.0); // red for the solution for(unsigned int ii=0;ii<9;ii++) { for(unsigned int jj=0;jj<9;jj++) { // Fill in the remaining cells if( m_entry[ii][jj].get_text().empty() ) { Glib::ustring finalValue = IntToUString(sudokuPuzzle.getPuzzleValue(jj,ii)); m_entry[ii][jj].override_color(solutionColor); m_entry[ii][jj].set_text(finalValue); m_entry[ii][jj].set_editable(false); } } } } else { // Input is not solvable // Inform the user of the error Gtk::MessageDialog dlg("Puzzle cannot be solved. Check the input."); dlg.run(); } }
UnEncodersDialog::UnEncodersDialog(const Glib::RefPtr<Gtk::Builder>& refGlade, MediaElement::ElementsDB& elementsDB) : elementsDB(elementsDB){ refGlade->get_widget("unEncodersDialog", unEncodersDialog); refGlade->get_widget("unEncodersText", unEncodersText); refGlade->get_widget("unEncoderCheck", unEncodersCheck); refGlade->get_widget("showUnEncMenuItem", showUnEncMenuItem); changed = false; unEncodersDialog->add_button(Gtk::Stock::OK, 0); Gdk::RGBA green; green.set_rgba(0, 0.5, 0, 1); Gdk::RGBA orange; orange.set_rgba(1, 0.4, 0, 1); Gdk::RGBA red; red.set_rgba(0.5, 0, 0, 1); greenTag = Gtk::TextBuffer::Tag::create(); greenTag->property_foreground_rgba() = green; greenTag->set_property("size-points", 12); orangeTag = Gtk::TextBuffer::Tag::create(); orangeTag->property_foreground_rgba() = orange; orangeTag->set_property("size-points", 12); redTag = Gtk::TextBuffer::Tag::create(); redTag->property_foreground_rgba() = red; redTag->set_property("size-points", 12); tagTable = Gtk::TextBuffer::TagTable::create(); tagTable->add(greenTag); tagTable->add(orangeTag); tagTable->add(redTag); unEncodersText->set_buffer(Gtk::TextBuffer::create(tagTable)); unEncodersCheck->signal_clicked().connect(sigc::mem_fun(*this, &UnEncodersDialog::checkClicked)); showUnEncMenuItem->signal_activate().connect(sigc::mem_fun(*this, &UnEncodersDialog::show)); }
bool InfoWidget::drawChart(const::Cairo::RefPtr<Cairo::Context> &context) { context->save(); const double width = m_chartDrawingArea.get_allocation().get_width(); const double height = m_chartDrawingArea.get_allocation().get_height(); context->set_source_rgb(m_data.color.get_red(), m_data.color.get_green(), m_data.color.get_blue()); context->rectangle(0, 0, width, height); context->fill(); const Gdk::RGBA color = get_style_context()->get_color(); context->set_source_rgb(color.get_red(), color.get_green(), color.get_blue()); const double titleX = width / 2.0; const double titleY = height / 2.0; auto layout = Pango::Layout::create(context); layout->set_justify(true); layout->set_alignment(Pango::ALIGN_CENTER); if (m_data.subtitle.empty()) layout->set_markup(m_data.title); else layout->set_markup(m_data.title + "\n<span size=\"x-small\">" + m_data.subtitle + "</span>"); auto fontDescription = get_style_context()->get_font(); fontDescription.set_size(2 * fontDescription.get_size()); layout->set_font_description(fontDescription); const auto rectangle = layout->get_pixel_logical_extents(); context->translate(titleX - rectangle.get_width() / 2.0, titleY - rectangle.get_height() / 2.0); layout->show_in_cairo_context(context); context->restore(); return true; }
void PaletteItemGroup::draw(DrawContext dc) { Glib::RefPtr<StyleContext> style = parent->get_style_context(); Gdk::RGBA dark = style->get_border_color(STATE_FLAG_NORMAL); Gdk::RGBA light = style->get_color(STATE_FLAG_NORMAL); dc->set_line_width(0.5); dc->set_source_rgb(dark.get_red() + 0.2, dark.get_green() + 0.2, dark.get_blue() + 0.2); dc->rectangle(x + 1, y, width, minHeight); dc->fill(); dc->set_source_rgb(light.get_red(), light.get_green(), light.get_blue()); dc->rectangle(x + 1, y, width, minHeight); dc->stroke(); // if(select) // Gdk::Cairo::set_source_color(dc, style->get_text(Gtk::STATE_NORMAL)); // else // Gdk::Cairo::set_source_color(dc, style->get_text(Gtk::STATE_SELECTED)); dc->move_to(x + 10,y + 11); dc->set_font_size(GROUP_FONT_SIZE); dc->show_text(caption); PaletteItem::draw(dc); }
fwk::RgbColour gdkcolor_to_rgbcolour(const Gdk::RGBA & colour) { fwk::RgbColour rgbcolour(colour.get_red_u(), colour.get_green_u(), colour.get_blue_u()); return rgbcolour; }
Gdk::RGBA rgbcolour_to_gdkcolor(const fwk::RgbColour & colour) { Gdk::RGBA gdkcolour; gdkcolour.set_rgba_u(colour[0], colour[1], colour[2]); return gdkcolour; }
void PaletteItemButton::draw(DrawContext dc) { Glib::RefPtr<StyleContext> style = parent->get_style_context(); Gdk::RGBA dark = style->get_border_color(STATE_FLAG_NORMAL); Gdk::RGBA light = style->get_color(STATE_FLAG_NORMAL); dc->set_antialias(Cairo::ANTIALIAS_NONE); if(select) { dc->set_source_rgb(dark.get_red(), dark.get_green(), dark.get_blue()); } else if(opened) { Gdk::RGBA sel = style->get_color(STATE_FLAG_SELECTED); dc->set_source_rgb(sel.get_red(), sel.get_green(), sel.get_blue()); } if(select || opened) { dc->rectangle(x, y, width, height); dc->fill(); dc->set_line_width(1.0); dc->set_source_rgb(light.get_red(), light.get_green(), light.get_blue()); dc->rectangle(x, y, width, height); dc->stroke(); } dc->set_antialias(Cairo::ANTIALIAS_DEFAULT); /* if(select) style->paint_box(parent->get_window(), Gtk::STATE_ACTIVE, down ? Gtk::SHADOW_IN : Gtk::SHADOW_OUT, Gdk::Rectangle(x, y, width, height), *parent, ustring(), x, y, width, height); else if(opened) style->paint_box(parent->get_window(), Gtk::STATE_SELECTED, Gtk::SHADOW_IN, Gdk::Rectangle(x, y, width, height), *parent, ustring(), x, y, width, height); */ dc->save(); dc->translate(x + 3, y + 3); Gdk::Cairo::set_source_pixbuf(dc, icon, 0.0, 0.0); dc->rectangle (0, 0, 24, 24); dc->clip(); dc->paint(); dc->restore(); }
void PaletteItemTab::draw(DrawContext dc) { Glib::RefPtr<StyleContext> style = parent->get_style_context(); Gdk::RGBA dark = style->get_border_color(STATE_FLAG_NORMAL); Gdk::RGBA light = style->get_color(STATE_FLAG_NORMAL); dc->set_line_width(0.5); if(select || opened) { if(select) { Gdk::RGBA norm = style->get_background_color(STATE_FLAG_NORMAL); //TypeColor sel = style->get_base(Gtk::STATE_SELECTED); Cairo::RefPtr<Cairo::LinearGradient> lin_grad = Cairo::LinearGradient::create(0, y, width, y + minHeight); //Cairo::RefPtr<Cairo::LinearGradient> lin_grad = Cairo::LinearGradient::create(width / 2, y, width / 2, y + minHeight); lin_grad->add_color_stop_rgb(0, dark.get_red(), dark.get_green(), dark.get_blue()); lin_grad->add_color_stop_rgb(1, light.get_red(), light.get_green(), light.get_blue()); dc->set_source(lin_grad); } else if(opened) { Gdk::RGBA sel = style->get_color(STATE_FLAG_SELECTED); dc->set_source_rgb(sel.get_red(), sel.get_green(), sel.get_blue()); } dc->rectangle(x, y, width + 2, minHeight); dc->fill(); /* tabRoundRect(dc, x + 1, y, width, minHeight); dc->fill(); dc->set_source_rgb(light.get_red_p(), light.get_green_p(), light.get_blue_p()); tabRoundRect(dc, x + 1, y, width, minHeight); dc->stroke(); */ } //dc->rectangle(x, y, width, height); //dc->stroke(); /* style->paint_box(parent->get_window(), opened ? Gtk::STATE_SELECTED : (select ? Gtk::STATE_ACTIVE : Gtk::STATE_NORMAL), Gtk::SHADOW_IN, Gdk::Rectangle(x + 1, y, width, 20), *parent, ustring(), x + 1, y, width, 20); */ if(select) dc->set_source_rgb(1.0, 1.0, 1.0); else dc->set_source_rgb(0.0, 0.0, 0.0); dc->move_to(x + 20,y + 14); dc->set_font_size(TAB_FONT_SIZE); dc->show_text(caption); dc->set_line_width(1); if(opened) { Cairo::Antialias a = dc->get_antialias(); dc->set_antialias(Cairo::ANTIALIAS_NONE); dc->set_source_rgb(dark.get_red(), dark.get_green(), dark.get_blue()); dc->move_to(x + 3, y + height); dc->rel_line_to(width - 6, 0); dc->stroke(); dc->set_antialias(a); } dc->set_source_rgb(0.3, 0.3, 0.3); dc->arc(x + 10, y + 10, 4, 0, 2*3.1415); dc->fill(); PaletteItem::draw(dc); }
cGtkmmMainWindow::cGtkmmMainWindow(int argc, char** argv) : updateChecker(*this), notifyMainThread(*this), pMenuPopup(nullptr), comboBoxFolder(true), statusBar("0 photos"), photoBrowser(*this) { settings.Load(); set_title(BUILD_APPLICATION_NAME); set_size_request(400, 400); set_default_size(800, 800); // Restore the window size size_t width = 800; size_t height = 800; settings.GetMainWindowSize(width, height); resize(width, height); if (settings.IsMainWindowMaximised()) maximize(); // Set icon list std::vector<Glib::RefPtr<Gdk::Pixbuf> > icons; icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_16x16.png")); icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_32x32.png")); icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_48x48.png")); icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_64x64.png")); icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_128x128.png")); icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_256x256.png")); // GTK complains if we pass icons larger than 256x256 //icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_512x512.png")); set_icon_list(icons); // Menu and toolbar // void Gtk::Application::set_app_menu(const Glib::RefPtr< Gio::MenuModel > & app_menu) // Sets or unsets the application menu for application. // The application menu is a single menu containing items that typically impact the application as a whole, rather than acting on a specific window or document. For example, you would expect to see "Preferences" or "Quit" in an application menu, but not "Save" or "Print". // If supported, the application menu will be rendered by the desktop environment. // You might call this method in your Application::property_startup() signal handler. // Use the base ActionMap interface to add actions, to respond to the user selecting these menu items. // Since gtkmm 3.4: // Create actions for menus and toolbars m_refActionGroup = Gtk::ActionGroup::create(); // File menu m_refActionGroup->add(Gtk::Action::create("FileMenu", "File")); m_refActionGroup->add(Gtk::Action::create("FileAddFiles", "Add Files"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileBrowseFiles)); m_refActionGroup->add(Gtk::Action::create("FileAddFolder", "Add Folder"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileBrowseFolder)); m_refActionGroup->add(Gtk::Action::create("FileAddFilesFromPicturesFolder", "Add Files From Pictures Folder"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionAddFilesFromPicturesFolder)); m_refActionGroup->add(Gtk::Action::create("FileImportFolder", "Import Folder From Removable Media"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileImportFolder)); //m_refActionGroup->add(Gtk::Action::create("FileRemove", "Remove"), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionRemoveTrack)); //m_refActionGroup->add(Gtk::Action::create("FileMoveToFolderMenu", "Move to Folder")); //m_refActionGroup->add(Gtk::Action::create("FileMoveToFolderBrowse", "Browse..."), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToFolderBrowse)); //m_refActionGroup->add(Gtk::Action::create("FileMoveToRubbishBin", "Move to the Rubbish Bin"), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToRubbishBin)); //m_refActionGroup->add(Gtk::Action::create("FileShowInFileManager", "Show in the File Manager"), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackShowInFileManager)); //m_refActionGroup->add(Gtk::Action::create("FileProperties", "Properties"), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackProperties)); m_refActionGroup->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileQuit)); // Edit menu m_refActionGroup->add(Gtk::Action::create("EditMenu", "Edit")); //Edit Tags -> edits each track separately //Batch Edit Tags -> edits all tracks at the same time m_refActionGroup->add(Gtk::Action::create("EditPreferences", Gtk::Stock::PREFERENCES), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuEditPreferences)); // Playback menu m_refActionGroup->add(Gtk::Action::create("PlaybackMenu", "Playback")); //m_refActionGroup->add(Gtk::Action::create("PlaybackPrevious", Gtk::Stock::MEDIA_PREVIOUS), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackPreviousClicked)); //pPlayPauseAction = Gtk::ToggleAction::create("PlaybackPlayPause", Gtk::Stock::MEDIA_PLAY, "Play/Pause"); //m_refActionGroup->add(pPlayPauseAction, sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackPlayPauseMenuToggled)); //m_refActionGroup->add(Gtk::Action::create("PlaybackNext", Gtk::Stock::MEDIA_NEXT), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackNextClicked)); //m_refActionGroup->add(Gtk::Action::create("JumpToPlaying", "Jump to Playing"), // Gtk::AccelKey("<control>J"), // sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionJumpToPlaying)); //pRepeatAction = Gtk::ToggleAction::create("PlaybackRepeatToggle", Gtk::Stock::GOTO_TOP, "Repeat"); //m_refActionGroup->add(pRepeatAction, sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackRepeatMenuToggled)); // Help menu m_refActionGroup->add( Gtk::Action::create("HelpMenu", "Help") ); m_refActionGroup->add( Gtk::Action::create("HelpAbout", Gtk::Stock::ABOUT), sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuHelpAbout) ); m_refUIManager = Gtk::UIManager::create(); m_refUIManager->insert_action_group(m_refActionGroup); add_accel_group(m_refUIManager->get_accel_group()); // Layout the actions in a menubar and toolbar { Glib::ustring ui_info = "<ui>" " <menubar name='MenuBar'>" " <menu action='FileMenu'>" " <menuitem action='FileAddFiles'/>" " <menuitem action='FileAddFolder'/>" " <menuitem action='FileAddFilesFromPicturesFolder'/>" " <menuitem action='FileImportFolder'/>" //" <menuitem action='FileRemove'/>" //" <menu action='FileMoveToFolderMenu'>" //" <menuitem action='FileMoveToFolderBrowse'/>" //" </menu>" //" <menuitem action='FileMoveToRubbishBin'/>" //" <menuitem action='FileShowInFileManager'/>" //" <menuitem action='FileProperties'/>" //" <separator/>" " <menuitem action='FileQuit'/>" " </menu>" " <menu action='EditMenu'>" " <menuitem action='EditPreferences'/>" " </menu>" " <menu action='PlaybackMenu'>" //" <menuitem action='PlaybackPrevious'/>" //" <menuitem action='PlaybackPlayPause'/>" //" <menuitem action='PlaybackNext'/>" //" <menuitem action='JumpToPlaying'/>" //" <separator/>" //" <menuitem action='PlaybackRepeatToggle'/>" " </menu>" " <menu action='HelpMenu'>" " <menuitem action='HelpAbout'/>" " </menu>" " </menubar>" " <toolbar name='ToolBar'>" //" <toolitem action='PlaybackPrevious'/>" //" <toolitem action='PlaybackPlayPause'/>" //" <toolitem action='PlaybackNext'/>" //" <toolitem action='PlaybackRepeatToggle'/>" " </toolbar>" "</ui>"; try { m_refUIManager->add_ui_from_string(ui_info); } catch(const Glib::Error& ex) { std::cerr<<"building menus failed: "<<ex.what(); } } // Get the menubar and toolbar widgets, and add them to a container widget Gtk::Widget* pMenubar = m_refUIManager->get_widget("/MenuBar"); if (pMenubar != nullptr) boxMainWindow.pack_start(*pMenubar, Gtk::PACK_SHRINK); // Photo browser right click menu Glib::RefPtr<Gtk::ActionGroup> popupActionGroupRef; // Right click menu popupActionGroupRef = Gtk::ActionGroup::create(); // File|New sub menu: // These menu actions would normally already exist for a main menu, because a context menu should // not normally contain menu items that are only available via a context menu. popupActionGroupRef->add(Gtk::Action::create("ContextMenu", "Context Menu")); popupActionGroupRef->add(Gtk::Action::create("ContextAddFiles", "Add Files"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFiles)); popupActionGroupRef->add(Gtk::Action::create("ContextAddFolder", "Add Folder"), Gtk::AccelKey("<control>P"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFolder)); popupActionGroupRef->add(Gtk::Action::create("ContextRemove", "Remove"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionRemovePhoto)); //Edit Tags -> edits each track separately //Batch Edit Tags -> edits all tracks at the same time /*/popupActionGroupRef->add(Gtk::Action::create("ContextMoveToFolderMenu", "Move to Folder")); popupActionGroupRef->add(Gtk::Action::create("ContextTrackMoveToFolderBrowse", "Browse..."), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToFolderBrowse)); popupActionGroupRef->add(Gtk::Action::create("ContextTrackMoveToRubbishBin", "Move to the Rubbish Bin"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToRubbishBin)); popupActionGroupRef->add(Gtk::Action::create("ContextShowInFileManager", "Show in the File Manager"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackShowInFileManager)); popupActionGroupRef->add(Gtk::Action::create("ContextProperties", "Properties"), sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackProperties));*/ popupUIManagerRef = Gtk::UIManager::create(); popupUIManagerRef->insert_action_group(popupActionGroupRef); add_accel_group(popupUIManagerRef->get_accel_group()); // Layout the actions in our popup menu { Glib::ustring ui_info = "<ui>" " <popup name='PopupMenu'>" " <menuitem action='ContextAddFiles'/>" " <menuitem action='ContextAddFolder'/>" " <menuitem action='ContextRemove'/>" /*" <menu action='ContextMoveToFolderMenu'>" " <menuitem action='ContextTrackMoveToFolderBrowse'/>" " </menu>" " <menuitem action='ContextTrackMoveToRubbishBin'/>" " <menuitem action='ContextShowInFileManager'/>" " <menuitem action='ContextProperties'/>"*/ " </popup>" "</ui>"; try { popupUIManagerRef->add_ui_from_string(ui_info); } catch(const Glib::Error& ex) { std::cerr<<"building menus failed: "<<ex.what(); } } // Get the menu pMenuPopup = dynamic_cast<Gtk::Menu*>(popupUIManagerRef->get_widget("/PopupMenu")); if (pMenuPopup == nullptr) g_warning("Popup menu not found"); assert(pMenuPopup != nullptr); // In gtkmm 3 set_orientation is not supported so we create our own toolbar out of plain old buttons //Gtk::Toolbar* pToolbar = dynamic_cast<Gtk::Toolbar*>(m_refUIManager->get_widget("/ToolBar")); //if (pToolbar != nullptr) { // pToolbar->property_orientation() = Gtk::ORIENTATION_VERTICAL; // //pToolbar->set_orientation(Gtk::ORIENTATION_VERTICAL); // pToolbar->set_toolbar_style(Gtk::TOOLBAR_ICONS); // boxToolbar.pack_start(*pToolbar); //} buttonAddFiles.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFiles)); buttonAddFolder.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFolder)); boxToolbar.pack_start(buttonFolderUp, Gtk::PACK_SHRINK); boxToolbar.pack_start(buttonFolderShowInFileManager, Gtk::PACK_SHRINK); boxToolbar.pack_start(buttonAddFiles, Gtk::PACK_SHRINK); boxToolbar.pack_start(buttonAddFolder, Gtk::PACK_SHRINK); boxToolbar.pack_start(*Gtk::manage(new Gtk::Separator()), Gtk::PACK_SHRINK); // Controls comboBoxFolder.get_entry()->signal_changed().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionChangeFolder)); buttonFolderUp.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionFolderUp)); buttonFolderUp.set_tooltip_text("Move up"); buttonFolderShowInFileManager.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionFolderShowInFileManager)); buttonFolderShowInFileManager.set_tooltip_text("Show folder in file manager"); buttonStopLoading.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionStopLoading)); photoBrowser.Init(argc, argv); boxControls.pack_start(comboBoxFolder, Gtk::PACK_SHRINK); boxControls.pack_start(photoBrowser.GetWidget(), Gtk::PACK_EXPAND_WIDGET); boxControlsAndToolbar.pack_start(boxControls, Gtk::PACK_EXPAND_WIDGET); boxControlsAndToolbar.pack_start(boxToolbar, Gtk::PACK_SHRINK); // Hide the stop button until we start loading some files buttonStopLoading.hide(); boxStatusBar.pack_start(statusBar, Gtk::PACK_SHRINK); boxStatusBar.pack_start(buttonStopLoading, Gtk::PACK_SHRINK); //... show progress bar indeterminate when we are loading any files or playlists boxMainWindow.pack_start(boxControlsAndToolbar, Gtk::PACK_EXPAND_WIDGET); boxMainWindow.pack_start(boxStatusBar, Gtk::PACK_SHRINK); // Add the box layout to the main window add(boxMainWindow); { // Get a typical selection colour for the selections on our photo browser Gtk::Table table; Glib::RefPtr<Gtk::StyleContext> pStyleContext = table.get_style_context(); ASSERT(pStyleContext); const Gdk::RGBA colour = pStyleContext->get_background_color(Gtk::STATE_FLAG_SELECTED); const spitfire::math::cColour colourSelected(colour.get_red(), colour.get_green(), colour.get_blue(), colour.get_alpha()); photoBrowser.SetSelectionColour(colourSelected); } // Register our icon theme and update our icons iconTheme.RegisterThemeChangedListener(*this); UpdateIcons(); ApplySettings(); show_all_children(); // Start the update checker now that we have finished doing the serious work updateChecker.Run(); notifyMainThread.Create(); }
fwk::RgbColourPtr gdkcolor_to_rgbcolour(const Gdk::RGBA & colour) { return fwk::rgbcolour_new(colour.get_red_u(), colour.get_green_u(), colour.get_blue_u()); }