Adding a tooltip for the popup button widget

This commit is contained in:
Hombre
2010-11-05 01:57:15 +01:00
parent 0d60fb4028
commit 791622c3a0
7 changed files with 12 additions and 2 deletions

View File

@@ -732,3 +732,4 @@
!ZOOMPANEL_ZOOMFITSCREEN;Fit to screen <b>F</b>
!ZOOMPANEL_ZOOMIN;Zoom In <b>+</b>
!ZOOMPANEL_ZOOMOUT;Zoom Out <b>-</b>
!POPUPBUTTON_SELECTOPTIONHINT;RMB to change option

View File

@@ -728,3 +728,4 @@ TP_HLREC_COLOR;Colour Propagation
!ZOOMPANEL_ZOOMFITSCREEN;Fit to screen <b>F</b>
!ZOOMPANEL_ZOOMIN;Zoom In <b>+</b>
!ZOOMPANEL_ZOOMOUT;Zoom Out <b>-</b>
!POPUPBUTTON_SELECTOPTIONHINT;RMB to change option

View File

@@ -732,3 +732,4 @@
!ZOOMPANEL_ZOOMFITSCREEN;Fit to screen <b>F</b>
!ZOOMPANEL_ZOOMIN;Zoom In <b>+</b>
!ZOOMPANEL_ZOOMOUT;Zoom Out <b>-</b>
!POPUPBUTTON_SELECTOPTIONHINT;RMB to change option

View File

@@ -713,7 +713,7 @@ ZOOMPANEL_ZOOM100;Zoom à 100% <b>1</b>
ZOOMPANEL_ZOOMFITSCREEN;Ajuster à la fenêtre <b>F</b>
ZOOMPANEL_ZOOMIN;Zoom <b>+</b>
ZOOMPANEL_ZOOMOUT;Zoom <b>-</b>
POPUPBUTTON_SELECTOPTIONHINT;'Menu contextuel' pour changer d'option
!!!!!!!!!!!!!!!!!!!!!!!!!
! Untranslated keys follow; remove the ! prefix after an entry is translated.

View File

@@ -725,3 +725,4 @@ ZOOMPANEL_ZOOM100;Zoom to 100% <b>1</b>
ZOOMPANEL_ZOOMFITSCREEN;Fit to screen <b>F</b>
ZOOMPANEL_ZOOMIN;Zoom In <b>+</b>
ZOOMPANEL_ZOOMOUT;Zoom Out <b>-</b>
POPUPBUTTON_SELECTOPTIONHINT;RMB to change option

View File

@@ -19,11 +19,13 @@
* Class created by Jean-Christophe FRISCH, aka 'Hombre'
*/
#include <multilangmgr.h>
#include <popupcommon.h>
#include <safegtk.h>
PopUpCommon::PopUpCommon (Gtk::Button* thisButton, const Glib::ustring& label, bool imgRight) {
button = thisButton;
hasMenu = false;
if (label.size()) {
hasText = true;
button->set_label(label + " ");
@@ -91,6 +93,7 @@ bool PopUpCommon::addEntry (Glib::ustring imagePath, Glib::ustring label) {
// When there is at least 2 choice, we add the RMB connector
if (images.size() == 2) {
button->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &PopUpCommon::showMenu) );
hasMenu = true;
}
// The item has been created
added = true;
@@ -129,7 +132,9 @@ void PopUpCommon::show() {
}
void PopUpCommon::setButtonHint() {
button->set_tooltip_text(buttonHint.size() ? buttonHint + " : " + sItems.at(selected) : sItems.at(selected));
Glib::ustring hint = buttonHint.size() ? buttonHint + " : " + sItems.at(selected) : sItems.at(selected);
if (hasMenu) hint += "\n(" + M("POPUPBUTTON_SELECTOPTIONHINT") + ")";
button->set_tooltip_text(hint);
}
void PopUpCommon::showMenu(GdkEventButton* event) {

View File

@@ -59,6 +59,7 @@ private:
int selected;
bool hasText;
bool imageRight;
bool hasMenu;
void showMenu(GdkEventButton* event);
void entrySelected (int i);