/* $Id: aspectframe.gen_h,v 1.34 2001/07/15 13:33:38 murrayc Exp $ */ /* aspectframe.h * * Copyright (C) 1998-1999 The Gtk-- Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <gtk--/frame.h> #include <gtk/gtkaspectframe.h> namespace Gtk { //: A frame that constrains its child to a particular aspect ratio. //- The GtkAspectFrame is useful when you want pack a widget so that it can resize but always //- retains the same aspect ratio. For instance, one might be drawing a small preview of a //- larger image. GtkAspectFrame derives from GtkFrame, so it can draw a label and a frame //- around the child. The frame will be "shrink-wrapped" to the size of the child. class AspectFrame : public Frame { public: typedef AspectFrame CppObjectType; typedef GtkAspectFrame BaseObjectType; public: //: Returns the underlaying gtk+ object. GtkAspectFrame* gtkobj(); const GtkAspectFrame* gtkobj() const; //: Returns true if object is this type. static bool isA(Gtk::Object *object); virtual ~AspectFrame(); private: void construct(const char *label, gfloat xalign, gfloat yalign, gfloat ratio, bool obey_child); public: //: Constructor with label. //- label: Label text. //- //- xalign: Horizontal alignment of the child within the allocation of the GtkAspectFrame. //- This ranges from 0.0 (left aligned) to 1.0 (right aligned). //- //- yalign: Vertical alignment of the child within the allocation of the GtkAspectFrame. //- This ranges from 0.0 (left aligned) to 1.0 (right aligned). //- //- ratio: The desired aspect ratio. //- //- obey_child: If TRUE, ratio is ignored, and the aspect ratio is taken from the requistion //- of the child. AspectFrame(const string &label, gfloat xalign, gfloat yalign, gfloat ratio=1.0, bool obey_child=false); //: Constructor without a label. //- The rest of the arguments are the same as above. AspectFrame(gfloat xalign, gfloat yalign, gfloat ratio=1.0, bool obey_child=false); //: Set parameters for the GtkAspectFrame. void set(gfloat xalign,gfloat yalign,gfloat ratio,gint obey_child); protected: // impl functions }; //+ PROPERTIES(Gtk_AspectFrame) //. name: xalign //. type: gfloat //. get: //. set: //. desc: //. name: yalign //. type: gfloat //. get: //. set: //. desc: //. name: ratio //. type: gfloat //. get: //. set: //. desc: //. name: obey_child //. type: gint //. get: //. set: //. desc: //. name: center_allocation //. type: GtkAllocation //. get: //. set: //. desc: }