/[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 2169 by persson, Sun Mar 6 07:51:04 2011 UTC revision 3364 by schoenebeck, Tue Nov 14 18:07:25 2017 UTC
# Line 1  Line 1 
1  /* *************************************************************************  /* *************************************************************************
2   * Copyright (c) 2005 VMware, Inc.   * Copyright (c) 2005 VMware, Inc.
3     * Copyright (c) 2011 - 2017 Andreas Persson
4   *   *
5   * Permission is hereby granted, free of charge, to any person obtaining   * Permission is hereby granted, free of charge, to any person obtaining
6   * a copy of this software and associated documentation files (the   * a copy of this software and associated documentation files (the
# Line 21  Line 22 
22   * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.   * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23   * *************************************************************************/   * *************************************************************************/
24    
25  #include <wrapLabel.hh>  #include "wrapLabel.hh"
26    #ifdef PANGOMM_HEADER_FILE
27    # include PANGOMM_HEADER_FILE(pangomm.h)
28    # include PANGOMM_HEADER_FILE(pangommconfig.h)
29    #else
30    # include <pangomm/pangomm.h>
31    # include <pangommconfig.h>
32    #endif
33    
34    // we don't need this WrapLabel helper class on GTKMM 3 and higher
35    #if GTKMM_MAJOR_VERSION < 3
36    
37  /*  /*
38   * wrapLabel.cc --   * wrapLabel.cc --
# Line 54  WrapLabel::WrapLabel(const Glib::ustring Line 64  WrapLabel::WrapLabel(const Glib::ustring
64     : mWrapWidth(0),     : mWrapWidth(0),
65       mWrapHeight(0)       mWrapHeight(0)
66  {  {
67       // pangomm >= 2.35.1
68    #if PANGOMM_MAJOR_VERSION > 2 || (PANGOMM_MAJOR_VERSION == 2 && (PANGOMM_MINOR_VERSION > 35 || (PANGOMM_MINOR_VERSION == 35 && PANGOMM_MICRO_VERSION >= 1)))
69       get_layout()->set_wrap(Pango::WrapMode::WORD_CHAR);
70    #else
71     get_layout()->set_wrap(Pango::WRAP_WORD_CHAR);     get_layout()->set_wrap(Pango::WRAP_WORD_CHAR);
72    #endif
73     set_alignment(0.0, 0.0);     set_alignment(0.0, 0.0);
74     set_text(text);     set_text(text);
75  }  }
# Line 137  WrapLabel::on_size_request(Gtk::Requisit Line 152  WrapLabel::on_size_request(Gtk::Requisit
152     req->height = mWrapHeight;     req->height = mWrapHeight;
153  }  }
154    
 // Gigedit addtion: gtk 3 compatibility  
 void WrapLabel::get_preferred_width_vfunc(int& minimum_width, int& natural_width) const  
 {  
    minimum_width = natural_width = 0;  
 }  
   
 // Gigedit addtion: gtk 3 compatibility  
 void WrapLabel::get_preferred_height_vfunc(int& minimum_height, int& natural_height) const  
 {  
    minimum_height = natural_height = mWrapHeight;  
 }  
155    
156  /*  /*
157   *-----------------------------------------------------------------------------   *-----------------------------------------------------------------------------
# Line 198  WrapLabel::SetWrapWidth(int width) // IN Line 202  WrapLabel::SetWrapWidth(int width) // IN
202        return;        return;
203     }     }
204    
205       int xPadding, yPadding;
206       get_padding(xPadding, yPadding);
207    
208       width -= 2 * xPadding;
209    
210     /*     /*
211      * We may need to reset the wrap width, so do this regardless of whether      * We may need to reset the wrap width, so do this regardless of whether
212      * or not we've changed the width.      * or not we've changed the width.
# Line 206  WrapLabel::SetWrapWidth(int width) // IN Line 215  WrapLabel::SetWrapWidth(int width) // IN
215    
216     int unused;     int unused;
217     get_layout()->get_pixel_size(unused, mWrapHeight);     get_layout()->get_pixel_size(unused, mWrapHeight);
218       mWrapHeight += 2 * yPadding;
219    
220     if (mWrapWidth != width) {     if (mWrapWidth != width) {
221        mWrapWidth = width;        mWrapWidth = width;
# Line 215  WrapLabel::SetWrapWidth(int width) // IN Line 225  WrapLabel::SetWrapWidth(int width) // IN
225    
226    
227  }; /* namespace view */  }; /* namespace view */
228    
229    #endif // GTKMM_MAJOR_VERSION < 3

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

  ViewVC Help
Powered by ViewVC