/[svn]/gigedit/trunk/src/gigedit/wrapLabel.cc
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/wrapLabel.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1799 by persson, Sat Dec 6 13:49:26 2008 UTC revision 2169 by persson, Sun Mar 6 07:51:04 2011 UTC
# Line 51  namespace view { Line 51  namespace view {
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);
# Line 132  WrapLabel::set_markup(const Glib::ustrin Line 133  WrapLabel::set_markup(const Glib::ustrin
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   *-----------------------------------------------------------------------------   *-----------------------------------------------------------------------------
# Line 185  WrapLabel::on_size_allocate(Gtk::Allocat Line 192  WrapLabel::on_size_allocate(Gtk::Allocat
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;
# Line 197  WrapLabel::SetWrapWidth(size_t width) // Line 204  WrapLabel::SetWrapWidth(size_t width) //
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();

Legend:
Removed from v.1799  
changed lines
  Added in v.2169

  ViewVC Help
Powered by ViewVC