Store buttonset tooltips in static memory, saves about 700 byte per thumbnail
This commit is contained in:
parent
2ca9f7f94d
commit
5f8799d48e
@ -27,6 +27,10 @@ Cairo::RefPtr<RTSurface> BatchQueueButtonSet::cancelIcon;
|
|||||||
Cairo::RefPtr<RTSurface> BatchQueueButtonSet::headIcon;
|
Cairo::RefPtr<RTSurface> BatchQueueButtonSet::headIcon;
|
||||||
Cairo::RefPtr<RTSurface> BatchQueueButtonSet::tailIcon;
|
Cairo::RefPtr<RTSurface> BatchQueueButtonSet::tailIcon;
|
||||||
|
|
||||||
|
Glib::ustring BatchQueueButtonSet::moveHeadToolTip;
|
||||||
|
Glib::ustring BatchQueueButtonSet::moveEndToolTip;
|
||||||
|
Glib::ustring BatchQueueButtonSet::cancelJobToolTip;
|
||||||
|
|
||||||
BatchQueueButtonSet::BatchQueueButtonSet (BatchQueueEntry* myEntry)
|
BatchQueueButtonSet::BatchQueueButtonSet (BatchQueueEntry* myEntry)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -34,10 +38,13 @@ BatchQueueButtonSet::BatchQueueButtonSet (BatchQueueEntry* myEntry)
|
|||||||
cancelIcon = Cairo::RefPtr<RTSurface>(new RTSurface("cancel-small.png"));
|
cancelIcon = Cairo::RefPtr<RTSurface>(new RTSurface("cancel-small.png"));
|
||||||
headIcon = Cairo::RefPtr<RTSurface>(new RTSurface("goto-start-small.png"));
|
headIcon = Cairo::RefPtr<RTSurface>(new RTSurface("goto-start-small.png"));
|
||||||
tailIcon = Cairo::RefPtr<RTSurface>(new RTSurface("goto-end-small.png"));
|
tailIcon = Cairo::RefPtr<RTSurface>(new RTSurface("goto-end-small.png"));
|
||||||
|
moveHeadToolTip = M("FILEBROWSER_POPUPMOVEHEAD");
|
||||||
|
moveEndToolTip = M("FILEBROWSER_POPUPMOVEEND");
|
||||||
|
cancelJobToolTip = M("FILEBROWSER_POPUPCANCELJOB");
|
||||||
iconsLoaded = true;
|
iconsLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
add (new LWButton (headIcon, 8, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPMOVEHEAD")));
|
add(new LWButton(headIcon, 8, myEntry, LWButton::Left, LWButton::Center, &moveHeadToolTip));
|
||||||
add (new LWButton (tailIcon, 9, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPMOVEEND")));
|
add(new LWButton(tailIcon, 9, myEntry, LWButton::Left, LWButton::Center, &moveEndToolTip));
|
||||||
add (new LWButton (cancelIcon, 10, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_POPUPCANCELJOB")));
|
add(new LWButton(cancelIcon, 10, myEntry, LWButton::Right, LWButton::Center, &cancelJobToolTip));
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,10 @@ public:
|
|||||||
static Cairo::RefPtr<RTSurface> headIcon;
|
static Cairo::RefPtr<RTSurface> headIcon;
|
||||||
static Cairo::RefPtr<RTSurface> tailIcon;
|
static Cairo::RefPtr<RTSurface> tailIcon;
|
||||||
|
|
||||||
|
static Glib::ustring moveHeadToolTip;
|
||||||
|
static Glib::ustring moveEndToolTip;
|
||||||
|
static Glib::ustring cancelJobToolTip;
|
||||||
|
|
||||||
explicit BatchQueueButtonSet (BatchQueueEntry* myEntry);
|
explicit BatchQueueButtonSet (BatchQueueEntry* myEntry);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,6 +38,13 @@
|
|||||||
|
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
|
|
||||||
|
bool CropWindow::initialized = false;
|
||||||
|
|
||||||
|
Glib::ustring CropWindow::zoomOuttt;
|
||||||
|
Glib::ustring CropWindow::zoomIntt;
|
||||||
|
Glib::ustring CropWindow::zoom100tt;
|
||||||
|
Glib::ustring CropWindow::closett;
|
||||||
|
|
||||||
CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDetailWindow)
|
CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDetailWindow)
|
||||||
: ObjectMOBuffer(parent), state(SNormal), press_x(0), press_y(0), action_x(0), action_y(0), pickedObject(-1), pickModifierKey(0), rot_deg(0), onResizeArea(false), deleted(false),
|
: ObjectMOBuffer(parent), state(SNormal), press_x(0), press_y(0), action_x(0), action_y(0), pickedObject(-1), pickModifierKey(0), rot_deg(0), onResizeArea(false), deleted(false),
|
||||||
fitZoomEnabled(true), fitZoom(false), cursor_type(CSArrow), /*isLowUpdatePriority(isLowUpdatePriority_),*/ hoveredPicker(nullptr), cropLabel(Glib::ustring("100%")),
|
fitZoomEnabled(true), fitZoom(false), cursor_type(CSArrow), /*isLowUpdatePriority(isLowUpdatePriority_),*/ hoveredPicker(nullptr), cropLabel(Glib::ustring("100%")),
|
||||||
@ -61,11 +68,18 @@ CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDet
|
|||||||
|
|
||||||
titleHeight = ih;
|
titleHeight = ih;
|
||||||
|
|
||||||
bZoomOut = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-minus-small.png")), 0, nullptr, LWButton::Left, LWButton::Center, "Zoom Out");
|
if (!initialized) {
|
||||||
bZoomIn = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-plus-small.png")), 1, nullptr, LWButton::Left, LWButton::Center, "Zoom In");
|
zoomOuttt = "Zoom Out";
|
||||||
bZoom100 = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-1to1-small.png")), 2, nullptr, LWButton::Left, LWButton::Center, "Zoom 100/%");
|
zoomIntt = "Zoom In";
|
||||||
|
zoom100tt = "Zoom 100/%";
|
||||||
|
closett = "Close";
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
bZoomOut = new LWButton(Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-minus-small.png")), 0, nullptr, LWButton::Left, LWButton::Center, &zoomOuttt);
|
||||||
|
bZoomIn = new LWButton(Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-plus-small.png")), 1, nullptr, LWButton::Left, LWButton::Center, &zoomIntt);
|
||||||
|
bZoom100 = new LWButton(Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-1to1-small.png")), 2, nullptr, LWButton::Left, LWButton::Center, &zoom100tt);
|
||||||
//bZoomFit = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-fit.png")), 3, NULL, LWButton::Left, LWButton::Center, "Zoom Fit");
|
//bZoomFit = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-fit.png")), 3, NULL, LWButton::Left, LWButton::Center, "Zoom Fit");
|
||||||
bClose = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("cancel-small.png")), 4, nullptr, LWButton::Right, LWButton::Center, "Close");
|
bClose = new LWButton(Cairo::RefPtr<RTSurface>(new RTSurface("cancel-small.png")), 4, nullptr, LWButton::Right, LWButton::Center, &closett);
|
||||||
|
|
||||||
buttonSet.add (bZoomOut);
|
buttonSet.add (bZoomOut);
|
||||||
buttonSet.add (bZoomIn);
|
buttonSet.add (bZoomIn);
|
||||||
|
@ -47,6 +47,12 @@ public:
|
|||||||
class ImageArea;
|
class ImageArea;
|
||||||
class CropWindow : public LWButtonListener, public CropDisplayHandler, public EditCoordSystem, public ObjectMOBuffer
|
class CropWindow : public LWButtonListener, public CropDisplayHandler, public EditCoordSystem, public ObjectMOBuffer
|
||||||
{
|
{
|
||||||
|
static bool initialized;
|
||||||
|
|
||||||
|
static Glib::ustring zoomOuttt;
|
||||||
|
static Glib::ustring zoomIntt;
|
||||||
|
static Glib::ustring zoom100tt;
|
||||||
|
static Glib::ustring closett;
|
||||||
|
|
||||||
// state management
|
// state management
|
||||||
ImgEditState state; // current state of user (see enum State)
|
ImgEditState state; // current state of user (see enum State)
|
||||||
|
@ -29,12 +29,14 @@ Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::unRankIcon;
|
|||||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::trashIcon;
|
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::trashIcon;
|
||||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::unTrashIcon;
|
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::unTrashIcon;
|
||||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::processIcon;
|
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::processIcon;
|
||||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_0;
|
std::array<Cairo::RefPtr<RTSurface>, 6> FileThumbnailButtonSet::colorLabelIcon;
|
||||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_1;
|
|
||||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_2;
|
Glib::ustring FileThumbnailButtonSet::processToolTip;
|
||||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_3;
|
Glib::ustring FileThumbnailButtonSet::unrankToolTip;
|
||||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_4;
|
Glib::ustring FileThumbnailButtonSet::trashToolTip;
|
||||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_5;
|
Glib::ustring FileThumbnailButtonSet::untrashToolTip;
|
||||||
|
Glib::ustring FileThumbnailButtonSet::colorLabelToolTip;
|
||||||
|
std::array<Glib::ustring, 5> FileThumbnailButtonSet::rankToolTip;
|
||||||
|
|
||||||
FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry)
|
FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry)
|
||||||
{
|
{
|
||||||
@ -46,73 +48,57 @@ FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry)
|
|||||||
trashIcon = Cairo::RefPtr<RTSurface>(new RTSurface("trash-small.png"));
|
trashIcon = Cairo::RefPtr<RTSurface>(new RTSurface("trash-small.png"));
|
||||||
unTrashIcon = Cairo::RefPtr<RTSurface>(new RTSurface("trash-remove-small.png"));
|
unTrashIcon = Cairo::RefPtr<RTSurface>(new RTSurface("trash-remove-small.png"));
|
||||||
processIcon = Cairo::RefPtr<RTSurface>(new RTSurface("gears-small.png"));
|
processIcon = Cairo::RefPtr<RTSurface>(new RTSurface("gears-small.png"));
|
||||||
|
colorLabelIcon[0] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-empty-gray-small.png"));
|
||||||
|
colorLabelIcon[1] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-red-small.png"));
|
||||||
|
colorLabelIcon[2] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-yellow-small.png"));
|
||||||
|
colorLabelIcon[3] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-green-small.png"));
|
||||||
|
colorLabelIcon[4] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-blue-small.png"));
|
||||||
|
colorLabelIcon[5] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-purple-small.png"));
|
||||||
|
|
||||||
|
processToolTip = M("FILEBROWSER_POPUPPROCESS");
|
||||||
|
unrankToolTip = M("FILEBROWSER_UNRANK_TOOLTIP");
|
||||||
|
trashToolTip = M("FILEBROWSER_POPUPTRASH");
|
||||||
|
untrashToolTip = M("FILEBROWSER_POPUPUNTRASH");
|
||||||
|
colorLabelToolTip = M("FILEBROWSER_COLORLABEL_TOOLTIP");
|
||||||
|
rankToolTip[0] = M("FILEBROWSER_RANK1_TOOLTIP");
|
||||||
|
rankToolTip[1] = M("FILEBROWSER_RANK2_TOOLTIP");
|
||||||
|
rankToolTip[2] = M("FILEBROWSER_RANK3_TOOLTIP");
|
||||||
|
rankToolTip[3] = M("FILEBROWSER_RANK4_TOOLTIP");
|
||||||
|
rankToolTip[4] = M("FILEBROWSER_RANK5_TOOLTIP");
|
||||||
|
|
||||||
colorLabelIcon_0 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-empty-gray-small.png"));
|
|
||||||
colorLabelIcon_1 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-red-small.png"));
|
|
||||||
colorLabelIcon_2 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-yellow-small.png"));
|
|
||||||
colorLabelIcon_3 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-green-small.png"));
|
|
||||||
colorLabelIcon_4 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-blue-small.png"));
|
|
||||||
colorLabelIcon_5 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-purple-small.png"));;
|
|
||||||
iconsLoaded = true;
|
iconsLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
add (new LWButton (processIcon, 6, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPPROCESS")));
|
add(new LWButton(processIcon, 6, myEntry, LWButton::Left, LWButton::Center, &processToolTip));
|
||||||
add (new LWButton (unRankIcon, 0, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_UNRANK_TOOLTIP")));
|
add(new LWButton(unRankIcon, 0, myEntry, LWButton::Left, LWButton::Center, &unrankToolTip));
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
add (new LWButton (rankIcon, i + 1, myEntry, LWButton::Left));
|
add(new LWButton(rankIcon, i + 1, myEntry, LWButton::Left, LWButton::Center, &rankToolTip[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
add (new LWButton (trashIcon, 7, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_POPUPTRASH")));
|
add(new LWButton(trashIcon, 7, myEntry, LWButton::Right, LWButton::Center, &trashToolTip));
|
||||||
|
add(new LWButton(colorLabelIcon[0], 8, myEntry, LWButton::Right, LWButton::Center, &colorLabelToolTip));
|
||||||
add (new LWButton (colorLabelIcon_0, 8, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_COLORLABEL_TOOLTIP")));
|
|
||||||
|
|
||||||
buttons[2]->setToolTip (M("FILEBROWSER_RANK1_TOOLTIP"));
|
|
||||||
buttons[3]->setToolTip (M("FILEBROWSER_RANK2_TOOLTIP"));
|
|
||||||
buttons[4]->setToolTip (M("FILEBROWSER_RANK3_TOOLTIP"));
|
|
||||||
buttons[5]->setToolTip (M("FILEBROWSER_RANK4_TOOLTIP"));
|
|
||||||
buttons[6]->setToolTip (M("FILEBROWSER_RANK5_TOOLTIP"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileThumbnailButtonSet::setRank (int stars)
|
void FileThumbnailButtonSet::setRank (int stars)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 1; i <= 5; i++) {
|
for (int i = 1; i <= 5; i++) {
|
||||||
buttons[i + 1]->setIcon (i <= stars ? rankIcon : gRankIcon);
|
buttons[i + 1]->setIcon(i <= stars ? rankIcon : gRankIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileThumbnailButtonSet::setColorLabel (int colorLabel)
|
void FileThumbnailButtonSet::setColorLabel (int colorLabel)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (colorLabel == 0) {
|
if (colorLabel >= 0 && colorLabel <= 5) {
|
||||||
buttons[8]->setIcon (colorLabelIcon_0); //transparent label
|
buttons[8]->setIcon(colorLabelIcon[colorLabel]);
|
||||||
}
|
|
||||||
|
|
||||||
if (colorLabel == 1) {
|
|
||||||
buttons[8]->setIcon (colorLabelIcon_1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (colorLabel == 2) {
|
|
||||||
buttons[8]->setIcon (colorLabelIcon_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (colorLabel == 3) {
|
|
||||||
buttons[8]->setIcon (colorLabelIcon_3);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (colorLabel == 4) {
|
|
||||||
buttons[8]->setIcon (colorLabelIcon_4);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (colorLabel == 5) {
|
|
||||||
buttons[8]->setIcon (colorLabelIcon_5);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileThumbnailButtonSet::setInTrash (bool inTrash)
|
void FileThumbnailButtonSet::setInTrash (bool inTrash)
|
||||||
{
|
{
|
||||||
|
|
||||||
buttons[7]->setIcon (inTrash ? unTrashIcon : trashIcon);
|
buttons[7]->setIcon(inTrash ? unTrashIcon : trashIcon);
|
||||||
buttons[7]->setToolTip (inTrash ? M("FILEBROWSER_POPUPUNTRASH") : M("FILEBROWSER_POPUPTRASH"));
|
buttons[7]->setToolTip(inTrash ? &untrashToolTip : &trashToolTip);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#ifndef _FILETHUMBNAILBUTTONSET_
|
#ifndef _FILETHUMBNAILBUTTONSET_
|
||||||
#define _FILETHUMBNAILBUTTONSET_
|
#define _FILETHUMBNAILBUTTONSET_
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "lwbuttonset.h"
|
#include "lwbuttonset.h"
|
||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
#include "filebrowserentry.h"
|
#include "filebrowserentry.h"
|
||||||
@ -38,12 +40,14 @@ public:
|
|||||||
static Cairo::RefPtr<RTSurface> unTrashIcon;
|
static Cairo::RefPtr<RTSurface> unTrashIcon;
|
||||||
static Cairo::RefPtr<RTSurface> processIcon;
|
static Cairo::RefPtr<RTSurface> processIcon;
|
||||||
|
|
||||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_0;
|
static std::array<Cairo::RefPtr<RTSurface>, 6> colorLabelIcon;
|
||||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_1;
|
|
||||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_2;
|
static Glib::ustring processToolTip;
|
||||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_3;
|
static Glib::ustring unrankToolTip;
|
||||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_4;
|
static Glib::ustring trashToolTip;
|
||||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_5;
|
static Glib::ustring untrashToolTip;
|
||||||
|
static Glib::ustring colorLabelToolTip;
|
||||||
|
static std::array<Glib::ustring, 5> rankToolTip;
|
||||||
|
|
||||||
explicit FileThumbnailButtonSet (FileBrowserEntry* myEntry);
|
explicit FileThumbnailButtonSet (FileBrowserEntry* myEntry);
|
||||||
void setRank (int stars);
|
void setRank (int stars);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "lwbutton.h"
|
#include "lwbutton.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
|
||||||
LWButton::LWButton (Cairo::RefPtr<RTSurface> i, int aCode, void* aData, Alignment ha, Alignment va, Glib::ustring tooltip)
|
LWButton::LWButton (Cairo::RefPtr<RTSurface> i, int aCode, void* aData, Alignment ha, Alignment va, Glib::ustring* tooltip)
|
||||||
: xpos(0), ypos(0), halign(ha), valign(va), icon(i), bgr(0.0), bgg(0.0), bgb(0.0), fgr(0.0), fgg(0.0), fgb(0.0), state(Normal), listener(nullptr), actionCode(aCode), actionData(aData), toolTip(tooltip)
|
: xpos(0), ypos(0), halign(ha), valign(va), icon(i), bgr(0.0), bgg(0.0), bgb(0.0), fgr(0.0), fgg(0.0), fgb(0.0), state(Normal), listener(nullptr), actionCode(aCode), actionData(aData), toolTip(tooltip)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ LWButton::LWButton (Cairo::RefPtr<RTSurface> i, int aCode, void* aData, Alignmen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LWButton::getSize (int& minw, int& minh)
|
void LWButton::getSize (int& minw, int& minh) const
|
||||||
{
|
{
|
||||||
|
|
||||||
minw = w;
|
minw = w;
|
||||||
@ -45,7 +45,7 @@ void LWButton::setPosition (int x, int y)
|
|||||||
ypos = y;
|
ypos = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LWButton::getPosition (int& x, int& y)
|
void LWButton::getPosition (int& x, int& y) const
|
||||||
{
|
{
|
||||||
|
|
||||||
x = xpos;
|
x = xpos;
|
||||||
@ -65,7 +65,7 @@ void LWButton::setIcon (Cairo::RefPtr<RTSurface> i)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cairo::RefPtr<RTSurface> LWButton::getIcon ()
|
Cairo::RefPtr<RTSurface> LWButton::getIcon () const
|
||||||
{
|
{
|
||||||
|
|
||||||
return icon;
|
return icon;
|
||||||
@ -82,7 +82,7 @@ void LWButton::setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg)
|
|||||||
fgb = fg.get_blue ();
|
fgb = fg.get_blue ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LWButton::inside (int x, int y)
|
bool LWButton::inside (int x, int y) const
|
||||||
{
|
{
|
||||||
|
|
||||||
return x > xpos && x < xpos + w && y > ypos && y < ypos + h;
|
return x > xpos && x < xpos + w && y > ypos && y < ypos + h;
|
||||||
@ -210,24 +210,27 @@ void LWButton::redraw (Cairo::RefPtr<Cairo::Context> context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LWButton::getAlignment (Alignment& ha, Alignment& va)
|
void LWButton::getAlignment (Alignment& ha, Alignment& va) const
|
||||||
{
|
{
|
||||||
|
|
||||||
ha = halign;
|
ha = halign;
|
||||||
va = valign;
|
va = valign;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::ustring LWButton::getToolTip (int x, int y)
|
Glib::ustring LWButton::getToolTip (int x, int y) const
|
||||||
{
|
{
|
||||||
|
if (inside(x, y)) {
|
||||||
if (inside (x, y)) {
|
if (toolTip) {
|
||||||
return toolTip;
|
return *toolTip;
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LWButton::setToolTip (const Glib::ustring& tooltip)
|
void LWButton::setToolTip (Glib::ustring* tooltip)
|
||||||
{
|
{
|
||||||
|
|
||||||
toolTip = tooltip;
|
toolTip = tooltip;
|
||||||
|
@ -49,26 +49,26 @@ private:
|
|||||||
LWButtonListener* listener;
|
LWButtonListener* listener;
|
||||||
int actionCode;
|
int actionCode;
|
||||||
void* actionData;
|
void* actionData;
|
||||||
Glib::ustring toolTip;
|
Glib::ustring* toolTip;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LWButton (Cairo::RefPtr<RTSurface> i, int aCode, void* aData, Alignment ha = Left, Alignment va = Center, Glib::ustring tooltip = "");
|
LWButton (Cairo::RefPtr<RTSurface> i, int aCode, void* aData, Alignment ha = Left, Alignment va = Center, Glib::ustring* tooltip = nullptr);
|
||||||
|
|
||||||
void getSize (int& minw, int& minh);
|
void getSize (int& minw, int& minh) const;
|
||||||
void getAlignment (Alignment& ha, Alignment& va);
|
void getAlignment (Alignment& ha, Alignment& va) const;
|
||||||
void setPosition (int x, int y);
|
void setPosition (int x, int y);
|
||||||
void getPosition (int& x, int& y);
|
void getPosition (int& x, int& y) const;
|
||||||
bool inside (int x, int y);
|
bool inside (int x, int y) const;
|
||||||
void setIcon (Cairo::RefPtr<RTSurface> i);
|
void setIcon (Cairo::RefPtr<RTSurface> i);
|
||||||
Cairo::RefPtr<RTSurface> getIcon ();
|
Cairo::RefPtr<RTSurface> getIcon () const;
|
||||||
void setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg);
|
void setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg);
|
||||||
void setToolTip (const Glib::ustring& tooltip);
|
void setToolTip (Glib::ustring* tooltip);
|
||||||
|
|
||||||
bool motionNotify (int x, int y);
|
bool motionNotify (int x, int y);
|
||||||
bool pressNotify (int x, int y);
|
bool pressNotify (int x, int y);
|
||||||
bool releaseNotify (int x, int y);
|
bool releaseNotify (int x, int y);
|
||||||
|
|
||||||
Glib::ustring getToolTip (int x, int y);
|
Glib::ustring getToolTip (int x, int y) const;
|
||||||
|
|
||||||
void setButtonListener (LWButtonListener* bl)
|
void setButtonListener (LWButtonListener* bl)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user