Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > ca81b57b553ae75608ba0fc5e7925e4e > files > 520

libgtkmm1.2-devel-1.2.10-1mdk.ppc.rpm

/* $Id: radiobutton.gen_h,v 1.50 2001/08/04 17:36:51 murrayc Exp $ */

/* radiobutton.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--/checkbutton.h>
#include <gtk/gtkradiobutton.h>




namespace Gtk {
class RadioButton;

namespace RadioButton_Helpers {
  //: Group transfer agent for RadioButton
  //- Radio items must be grouped together to function.
  //- To set up this group, construct a Group and then pass it
  //- to the constructor of all radio items.  You do not need
  //- to keep the group beyond the initial construction.
  //- It should not be called with new.
  class Group
    {
      friend class RadioButton;
      GSList *group_;
      void* operator new(size_t);
      void add(RadioButton& item);
      public:
        Group(GSList* group) : group_(group) {}
        Group() : group_(0) {}
        operator GSList* () const { return group_; }
    };
}

//: Group of checkbuttons
//- A set of radiobuttons is placed together. They each look like a checkbutton,
//- but only one button in the group can be checked or on at a time. When one
//- is clicked, another is unclicked.
class RadioButton : public CheckButton {


public:
  typedef RadioButton          CppObjectType;
  typedef GtkRadioButton            BaseObjectType;

public:
  //: Returns the underlaying gtk+ object.
  GtkRadioButton* gtkobj();
  const GtkRadioButton* gtkobj() const;

  //: Returns true if object is this type.
  static bool isA(Gtk::Object *object);

  virtual ~RadioButton();

private:

public:
  typedef RadioButton_Helpers::Group Group;

  RadioButton();
  RadioButton(const string &label, gfloat xalign=0.5, gfloat yalign=0.5);
  //: Constructor.
  //- Create an empty button belonging to the specified group,
  //- in which you can add() a widget
  //- (e.g. a Gtk_Pixmap). If you wish to add a {\class Gtk_Label},
  //- you may want to
  //- use the {RadioButton(const string &label, Group)}
  //- ctor directly instead.
  //- Specify a 0 group if you want to create a new button group
  RadioButton(Group &groupx);

  //: Constructor with label.
  //- Create a button belonging to the specified group, with a label inside.
  //- You won't be able to add a widget in this button
  //- since it already has a {\class Gtk_Label} in it.
  //- Specify a 0 group if you want to create a new button group
  RadioButton(Group &groupx,const string &label, gfloat xalign=0.5, gfloat yalign=0.5);





  Group group();

  //: Set the group that this radiobutton belongs to.
  //- Each radiobutton is a member of a group. This determines it's
  //- relationship with other widgets, so that when this radiobutton is
  //- clicked, it knows what other buttons need to be unclicked.

  void set_group(Group p0);




protected:
  // impl functions

};


//+ PROPERTIES(gtkradiobutton)
//. name: group
//. type: GSList*
//. get: {group()}
//. set: none - this field is set on creation
//. desc: The button group to which the radio button belongs to. Only
//. one button of the group can be 'on' at a given time.
}