Back to index

kdeartwork  4.3.2
Public Types | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes
RiscOS::CloseButton Class Reference

#include <CloseButton.h>

Inheritance diagram for RiscOS::CloseButton:
Inheritance graph
[legend]
Collaboration diagram for RiscOS::CloseButton:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Type {
  Lower, Close, Iconify, Maximise,
  Sticky, Help
}
enum  Alignment { Left, Right }

Signals

void closeWindow ()

Public Member Functions

 CloseButton (QWidget *parent)
void setAlignment (Alignment)
Alignment alignment () const

Protected Slots

void setActive (bool)

Protected Member Functions

void mouseReleaseEvent (QMouseEvent *)
void paintEvent (QPaintEvent *)
void mousePressEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *)
void setPixmap (const QPixmap &)

Protected Attributes

Qt::MouseButtons realizeButtons_
Qt::MouseButton lastButton_

Detailed Description

Definition at line 33 of file CloseButton.h.


Member Enumeration Documentation

enum RiscOS::Button::Alignment [inherited]
Enumerator:
Left 
Right 

Definition at line 45 of file Button.h.

{ Left, Right };
enum RiscOS::Button::Type [inherited]
Enumerator:
Lower 
Close 
Iconify 
Maximise 
Sticky 
Help 

Definition at line 43 of file Button.h.


Constructor & Destructor Documentation

RiscOS::CloseButton::CloseButton ( QWidget *  parent)

Definition at line 50 of file CloseButton.cpp.

  : Button(parent, i18n("Close"))
{
   setPixmap(QPixmap((const char **)close_xpm));
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 68 of file Button.cpp.

{
   return alignment_;
}

Here is the caller graph for this function:

void RiscOS::Button::mouseMoveEvent ( QMouseEvent *  ) [inline, protected, inherited]

Definition at line 65 of file Button.h.

{ /* Empty. */ }
void RiscOS::Button::mousePressEvent ( QMouseEvent *  e) [protected, inherited]

Definition at line 73 of file Button.cpp.

{
   down_ = true;
   lastButton_ = e->button();
   repaint();

   QMouseEvent me(e->type(), e->pos(), e->globalPos(),
                  (e->button()&realizeButtons_) ? Qt::LeftButton : Qt::NoButton,
                  e->state());
   QWidget::mousePressEvent(&me);
}
void RiscOS::CloseButton::mouseReleaseEvent ( QMouseEvent *  e) [protected]

Reimplemented from RiscOS::Button.

Definition at line 56 of file CloseButton.cpp.

{
   Button::mouseReleaseEvent(e);

   if (!rect().contains(e->pos()))
      return;

   emit(closeWindow());
}

Here is the call graph for this function:

void RiscOS::Button::paintEvent ( QPaintEvent *  ) [protected, inherited]

Definition at line 144 of file Button.cpp.

{
   bitBlt(this, alignment_ == Left ? 1 : 0, 0,
          &Static::instance()->buttonBase(active_, down_));

   int i = width() / 2 - 6;

   bitBlt(this, alignment_ == Left ? i + 1 : i,
          i + 1, active_ ? &aPixmap_ : &iPixmap_);
}

Here is the call graph for this function:

void RiscOS::Button::setActive ( bool  b) [protected, slot, inherited]

Definition at line 62 of file Button.cpp.

{
   active_ = b;
   repaint();
}
void RiscOS::Button::setAlignment ( Alignment  a) [inherited]

Definition at line 56 of file Button.cpp.

{
   alignment_ = a;
   repaint();
}
void RiscOS::Button::setPixmap ( const QPixmap &  p) [protected, inherited]

Definition at line 96 of file Button.cpp.

{
   if (QPixmap::defaultDepth() <= 8)
      aPixmap_ = iPixmap_ = p;
   else
   {
      QRgb light;
      QRgb* data = NULL;
      QRgb w = qRgb(255, 255, 255);

      QImage aTx(p.convertToImage());
      QImage iTx(aTx.copy());

      const KDecorationOptions* options = KDecoration::options();
      light = options->color(KDecoration::ColorButtonBg, true).light(150).rgb();

      if (light == qRgb(0, 0, 0))
         light = qRgb(228, 228, 228);

      data = (QRgb *)aTx.bits();

      for (int x = 0; x < 144; x++)
         if (data[x] == w)
            data[x] = light;

      light = options->color(KDecoration::ColorButtonBg, false).light(150).rgb();

      if (light == qRgb(0, 0, 0))
         light = qRgb(228, 228, 228);

      data = (QRgb *)iTx.bits();

      for (int x = 0; x < 144; x++)
         if (data[x] == w)
            data[x] = light;

      aPixmap_.convertFromImage(aTx);
      iPixmap_.convertFromImage(iTx);

      if (!p.mask().isNull())
      {
         aPixmap_.setMask(p.mask());
         iPixmap_.setMask(p.mask());
      }
   }
   repaint();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Qt::MouseButton RiscOS::Button::lastButton_ [protected, inherited]

Definition at line 70 of file Button.h.

Qt::MouseButtons RiscOS::Button::realizeButtons_ [protected, inherited]

Definition at line 69 of file Button.h.


The documentation for this class was generated from the following files: