diff -r cf4e83cecdb5 -r dcd472be9ae8 src/analog/widgetwithbackground.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/analog/widgetwithbackground.h Wed Jun 29 21:28:13 2022 +0200 @@ -0,0 +1,80 @@ +/*************************************************************************** + * 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 + +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 +