src/analog/widgetwithbackground.h

Wed, 29 Jun 2022 21:28:13 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 29 Jun 2022 21:28:13 +0200
changeset 316
dcd472be9ae8
child 319
d1861707054c
permissions
-rw-r--r--

Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.

/***************************************************************************
 *   Copyright (C) 2006-2008 by Tomasz Ziobrowski                          *
 *   http://www.3electrons.com                                             *
 *   e-mail: t.ziobrowski@3electrons.com                                   *
 *                                                                         *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program 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 General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef WIDGETWITHBACKGROUND_H
#define WIDGETWITHBACKGROUND_H

#include <QWidget>

class QPixmap;

class WidgetWithBackground : public QWidget
{
	Q_OBJECT
  public:
     /** Konstruktor */
     WidgetWithBackground(QWidget * parent = 0);

     /** Destruktor - usuwa bitmapkę.  */
     ~WidgetWithBackground ();

     /**
      * Operacja odmalowywania kontrolki  -
      * wkleja bitmapę z tłem na kontrolkę -
      * generująć ją wcześniej jeżeli zajdzie taka potrzeba.
      */
     void  drawBackground ();

     /** Odmalowywuje kontrolkę bezwarunkowo odmalowywując tło. */
     void  updateWithBackground ();
    
     /** 
     * Zawraca informacje czy kontrolka została zmodyfikowana
     * Ta informacja jest ustawiana gdy bitmapka tła się zmienia 
     * to znaczy zmienia się rozmiar komponentu lub istnieje 
     * potrzeba przemalowania tła. 
     */ 
     bool doRepaintBackground(); 
     
  protected:
    /** Wywołuje paintBackground - odmalowywując tło na nowo */
    void repaintBackground();

    /**
     * Odmalowywuje tło kontrolki
     * @param painter urządzenie na ktróym mamy malować.
     * @param background to tło kontrolki
     */
    virtual void  paintBackground (QPainter & painer) = 0;
    
    

  protected:
     /** Bufor na tło. */
     QPixmap * m_pixmap;
     /**
     * Ustawia tą zmienną po zmianie właściwości
     */
     bool m_modified;
};
#endif //WIDGETWITHBACKGROUND_H

mercurial