void Notebook::GTKAddCloseButtonAndReorderable(int idx) { MyNotebookPage *pg = (MyNotebookPage*) wxNotebook::GetNotebookPage(idx); wxWindow* page = GetPage((size_t)idx); // Place a close button if(HasCloseButton()) { GtkWidget *image; MyGtkPageInfo *pgInfo = new MyGtkPageInfo; pgInfo->m_button = gtk_button_new(); pgInfo->m_box = pg->m_box; pgInfo->m_book = this; image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); gtk_widget_set_size_request(image, 12, 12); gtk_button_set_image (GTK_BUTTON(pgInfo->m_button), image); gtk_widget_set_name (pgInfo->m_button, "tab-close-button"); gtk_button_set_relief(GTK_BUTTON(pgInfo->m_button), GTK_RELIEF_NONE); gtk_box_pack_end (GTK_BOX(pg->m_box), pgInfo->m_button, FALSE, FALSE, 0); // wxGTK has already used gtk_box_pack_end for the tab's label, so atm the close button will be on the left // so re-order it to position 0, which in a GTK_PACK_END box means the far right gtk_box_reorder_child(GTK_BOX(pg->m_box), pgInfo->m_button, 0); gtk_box_set_spacing (GTK_BOX(pg->m_box), 5); #ifdef __WXGTK3__ g_signal_connect (pgInfo->m_button, "clicked", G_CALLBACK (OnNotebookButtonClicked), pgInfo); #else gtk_signal_connect (GTK_OBJECT (pgInfo->m_button), "clicked", GTK_SIGNAL_FUNC (OnNotebookButtonClicked), pgInfo); #endif m_gtk_page_info[page] = pgInfo; GTKShowCloseButton(idx); } // Make this tab re-orderable gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(this->m_widget), page->m_widget, true); g_signal_connect(GTK_NOTEBOOK(this->m_widget), "page-reordered", G_CALLBACK(OnPageReordered), this); }
void GenericThumbnail::SetHovered(BOOL hovered) { if (hovered && !m_hovered) { m_hovered = TRUE; m_blend.HoverBlendIn(); if (HasCloseButton() && !m_locked) m_close_button->SetVisibility(TRUE); } else if (!hovered && m_hovered) { m_hovered = FALSE; m_blend.HoverBlendOut(); if (HasCloseButton()) m_close_button->SetVisibility(FALSE); } }