51 |
*/ |
*/ |
52 |
|
|
53 |
WrapLabel::WrapLabel(const Glib::ustring &text) // IN: The label text |
WrapLabel::WrapLabel(const Glib::ustring &text) // IN: The label text |
54 |
: mWrapWidth(0) |
: mWrapWidth(0), |
55 |
|
mWrapHeight(0) |
56 |
{ |
{ |
57 |
get_layout()->set_wrap(Pango::WRAP_WORD_CHAR); |
get_layout()->set_wrap(Pango::WRAP_WORD_CHAR); |
58 |
set_alignment(0.0, 0.0); |
set_alignment(0.0, 0.0); |
133 |
void |
void |
134 |
WrapLabel::on_size_request(Gtk::Requisition *req) // OUT: Our requested size |
WrapLabel::on_size_request(Gtk::Requisition *req) // OUT: Our requested size |
135 |
{ |
{ |
|
int width; |
|
|
int height; |
|
|
|
|
|
get_layout()->get_pixel_size(width, height); |
|
|
|
|
136 |
req->width = 0; |
req->width = 0; |
137 |
req->height = height; |
req->height = mWrapHeight; |
138 |
|
} |
139 |
|
|
140 |
|
// Gigedit addtion: gtk 3 compatibility |
141 |
|
void WrapLabel::get_preferred_width_vfunc(int& minimum_width, int& natural_width) const |
142 |
|
{ |
143 |
|
minimum_width = natural_width = 0; |
144 |
} |
} |
145 |
|
|
146 |
|
// Gigedit addtion: gtk 3 compatibility |
147 |
|
void WrapLabel::get_preferred_height_vfunc(int& minimum_height, int& natural_height) const |
148 |
|
{ |
149 |
|
minimum_height = natural_height = mWrapHeight; |
150 |
|
} |
151 |
|
|
152 |
/* |
/* |
153 |
*----------------------------------------------------------------------------- |
*----------------------------------------------------------------------------- |
192 |
*/ |
*/ |
193 |
|
|
194 |
void |
void |
195 |
WrapLabel::SetWrapWidth(size_t width) // IN: The wrap width |
WrapLabel::SetWrapWidth(int width) // IN: The wrap width |
196 |
{ |
{ |
197 |
if (width == 0) { |
if (width == 0) { |
198 |
return; |
return; |
204 |
*/ |
*/ |
205 |
get_layout()->set_width(width * Pango::SCALE); |
get_layout()->set_width(width * Pango::SCALE); |
206 |
|
|
207 |
|
int unused; |
208 |
|
get_layout()->get_pixel_size(unused, mWrapHeight); |
209 |
|
|
210 |
if (mWrapWidth != width) { |
if (mWrapWidth != width) { |
211 |
mWrapWidth = width; |
mWrapWidth = width; |
212 |
queue_resize(); |
queue_resize(); |