File indexing completed on 2024-04-28 05:51:09

0001 /*
0002  *  SPDX-FileCopyrightText: 2002-2003 Jesper K. Pedersen <blackie@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-only
0005  **/
0006 
0007 // -------------------------------- includes ------------------------------
0008 #ifndef __kmultiformlistboxfactory
0009 #define __kmultiformlistboxfactory
0010 
0011 #include "kwidgetstreamer.h"
0012 
0013 #include <QWidget>
0014 
0015 class KMultiFormListBoxEntry;
0016 //-------------------------------------------------------------------------
0017 
0018 /**
0019    Factory use to generate elements for the @ref KMultiFormListBox widget.
0020 
0021    To use an @ref KMultiFormListBox, one must inherit from the class KMultiFormListBoxFactory
0022    and override the method @ref create. This method must return an empty
0023    element for the KMultiFormListBox (that is an @ref KMultiFormListBoxEntry or a subclass of
0024    it).
0025 
0026    If you dislike the default separator between each of the elements or
0027    simply do not want a separator in the KMultiFormListBox, then you may override
0028    the method @ref separator.
0029 **/
0030 class KMultiFormListBoxFactory : public KWidgetStreamer
0031 {
0032 public:
0033     virtual ~KMultiFormListBoxFactory()
0034     {
0035     }
0036 
0037     /**
0038        This method must be overridden in subclasses and must return an
0039        ``empty'' instance of the @ref KMultiFormListBoxEntry class, or perhaps rather
0040        a subclass of this class. This instance will be owned by the caller of
0041        this function.
0042 
0043        @param parent A pointer to the parent of this KMultiFormListBoxEntry widget
0044        returned.
0045        @return A fresh @ref KMultiFormListBoxEntry to be used in an instance of the
0046        @ref KMultiFormListBox class.
0047     **/
0048     virtual KMultiFormListBoxEntry *create(QWidget *parent) = 0;
0049 
0050     /**
0051        This method is used to get a separator between the elements in an @ref
0052        KMultiFormListBox. The widget returned from this method will be owned by the
0053        caller.
0054 
0055        @param parent A pointer to the parent of the QWidget returned.
0056        @return A widget which must be used as a separator between the @ref
0057        KMultiFormListBoxEntry elements in an @ref KMultiFormListBox.
0058     **/
0059     virtual QWidget *separator(QWidget *parent);
0060 };
0061 
0062 #endif /* kmultiformlistbox */