Back to index

texmacs  1.0.7.15
Public Member Functions | Protected Attributes
QTMStyle Class Reference
Inheritance diagram for QTMStyle:
Inheritance graph
[legend]
Collaboration diagram for QTMStyle:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 QTMStyle (QStyle *_style=NULL)
 ~QTMStyle ()
void drawComplexControl (ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget=0) const
void drawPrimitive (PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
int pixelMetric (PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const
QSize sizeFromContents (ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget=0) const
void drawControl (ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=0) const
int styleHint (StyleHint hint, const QStyleOption *option=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
QStyle * baseStyle () const
const QStyle * proxy () const
void drawItemPixmap (QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
void drawItemText (QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
QPixmap generatedIconPixmap (QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
SubControl hitTestComplexControl (ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget=0) const
QRect itemPixmapRect (const QRect &rect, int alignment, const QPixmap &pixmap) const
QRect itemTextRect (const QFontMetrics &metrics, const QRect &rect, int alignment, bool enabled, const QString &text) const
void polish (QWidget *widget)
void polish (QApplication *app)
void polish (QPalette &pal)
QIcon standardIcon (StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
QPalette standardPalette () const
QPixmap standardPixmap (StandardPixmap standardPixmap, const QStyleOption *option=0, const QWidget *widget=0) const
QRect subControlRect (ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget=0) const
QRect subElementRect (SubElement element, const QStyleOption *option, const QWidget *widget=0) const
void unpolish (QWidget *widget)
void unpolish (QApplication *app)

Protected Attributes

QStyle * base

Detailed Description

Definition at line 68 of file QTMStyle.cpp.


Constructor & Destructor Documentation

QTMStyle::QTMStyle ( QStyle *  _style = NULL) [inline]

Definition at line 72 of file QTMStyle.cpp.

: QTMProxyStyle (_style) {}
QTMStyle::~QTMStyle ( ) [inline]

Definition at line 73 of file QTMStyle.cpp.

{}

Member Function Documentation

QStyle * QTMProxyStyle::baseStyle ( ) const [inline, inherited]

Definition at line 94 of file QTMStyle.cpp.

                                               {
  return ( base ? base : qApp->style() );
}

Here is the caller graph for this function:

void QTMStyle::drawComplexControl ( ComplexControl  control,
const QStyleOptionComplex *  option,
QPainter *  painter,
const QWidget *  widget = 0 
) const

Reimplemented from QTMProxyStyle.

Definition at line 348 of file QTMStyle.cpp.

                                                                                                                         {
  switch (cc) {
    case CC_ToolButton:
      if (const QStyleOptionToolButton *toolbutton
          = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
        QRect button, menuarea;
        button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget);
        menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
        
        State bflags = toolbutton->state & ~State_Sunken;
        
        if (bflags & State_AutoRaise) {
          if (!(bflags & State_MouseOver) || !(bflags & State_Enabled)) {
            bflags &= ~State_Raised;
          }
        }
        State mflags = bflags;
        if (toolbutton->state & State_Sunken) {
          if (toolbutton->activeSubControls & SC_ToolButton)
            bflags |= State_Sunken;
          mflags |= State_Sunken;
        }
        
        QStyleOption tool(0);
        tool.palette = toolbutton->palette;
        if (toolbutton->subControls & SC_ToolButton) {
          if (bflags & (State_Sunken | State_On | State_Raised)) {
            tool.rect = button;
            tool.state = bflags;
            proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
          }
        }
        
        if (toolbutton->state & State_HasFocus) {
          QStyleOptionFocusRect fr;
          fr.QStyleOption::operator=(*toolbutton);
          fr.rect.adjust(3, 3, -3, -3);
          if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)
            fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator,
                                                       toolbutton, widget), 0);
          proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
        }
        QStyleOptionToolButton label = *toolbutton;
        label.state = bflags;
        int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
        label.rect = button.adjusted(fw, fw, -fw, -fw);
        proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
        
        if (toolbutton->subControls & SC_ToolButtonMenu) {
          tool.rect = menuarea;
          tool.state = mflags;
          if (mflags & (State_Sunken | State_On | State_Raised))
            proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
          proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
        } else if ((toolbutton->features & QStyleOptionToolButton::HasMenu) 
                   && (mflags & State_MouseOver))
        {
          int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
          QRect ir = toolbutton->rect;
          QStyleOptionToolButton newBtn = *toolbutton;
          newBtn.rect = QRect(ir.right() + 5 - mbi, ir.y() + ir.height() - mbi + 4, mbi - 6, mbi - 6);
          proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
        }
      }
      break;
    default:
      baseStyle()->drawComplexControl (cc, opt, p, widget);
  }
}

Here is the call graph for this function:

void QTMStyle::drawControl ( ControlElement  element,
const QStyleOption *  option,
QPainter *  painter,
const QWidget *  widget = 0 
) const

Reimplemented from QTMProxyStyle.

Definition at line 456 of file QTMStyle.cpp.

                                                                                                                         {
  switch (element) {
#if 0
    case CE_MenuItem:
      if (const QStyleOptionMenuItem *mi =
          qstyleoption_cast<const QStyleOptionMenuItem *> (option)) {
        QStyleOptionMenuItem mi2(*mi);
        mi2.text= QString ("pippo");
        baseStyle()->drawControl (element, &mi2, painter, widget);
        break;
      }
#endif

    case CE_ToolBar: {
#ifdef UNIFIED_TOOLBAR
      if ((widget) &&  (widget->windowTitle() == "mode toolbar"))  {

          // For unified tool bars, draw nothing.
          if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->window())) {
            if ((mainWindow->unifiedTitleAndToolBarOnMac()) && 
                (widget->parent()->objectName() != "central widget"))
              break;
          }

          //QColor mainWindowGradientBeginActive (150, 150, 150);
          //QColor mainWindowGradientBegin (200, 200, 200);
          //QColor mainWindowGradientEnd (232, 232, 232);

          QColor mainWindowGradientBeginActive (222, 222, 222);
          QColor mainWindowGradientEndActive (202, 202, 202);
          QColor mainWindowGradientBegin (236, 236, 236);
          QColor mainWindowGradientEnd (226, 226, 226);
  
          if (widget->window()->isActiveWindow())
            mainWindowGradientBegin = mainWindowGradientBeginActive;
          if (widget->window()->isActiveWindow())
            mainWindowGradientEnd = mainWindowGradientEndActive;

          // draw background gradient
          QLinearGradient linearGrad;
          if (option->state & State_Horizontal)
            linearGrad = QLinearGradient(0, option->rect.top(), 0, option->rect.bottom());
          else
            linearGrad = QLinearGradient(option->rect.left(), 0,  option->rect.right(), 0);
          
          linearGrad.setColorAt(0, mainWindowGradientBegin);
          linearGrad.setColorAt(1, mainWindowGradientEnd);
          painter->fillRect(option->rect, linearGrad);
        }
#endif // UNIFIED_TOOLBAR
    } break;
      
    default:
      baseStyle()->drawControl (element, option, painter, widget);
  }
}

Here is the call graph for this function:

void QTMProxyStyle::drawItemPixmap ( QPainter *  painter,
const QRect &  rect,
int  alignment,
const QPixmap &  pixmap 
) const [inherited]

Definition at line 110 of file QTMStyle.cpp.

                                                                                                               {
  baseStyle()->drawItemPixmap (painter, rect, alignment, pixmap);
}

Here is the call graph for this function:

void QTMProxyStyle::drawItemText ( QPainter *  painter,
const QRect &  rect,
int  alignment,
const QPalette &  pal,
bool  enabled,
const QString &  text,
QPalette::ColorRole  textRole = QPalette::NoRole 
) const [inherited]

Definition at line 115 of file QTMStyle.cpp.

                                                                                                                                                                          {
  baseStyle()->drawItemText (painter, rect, alignment, pal, enabled, text, textRole);
}

Here is the call graph for this function:

void QTMStyle::drawPrimitive ( PrimitiveElement  element,
const QStyleOption *  option,
QPainter *  painter,
const QWidget *  widget 
) const

Reimplemented from QTMProxyStyle.

Definition at line 324 of file QTMStyle.cpp.

                                                                                                                    {
  //  if (element == QStyle::PE_FrameStatusBarItem) return;
  switch (element) {
    case PE_FrameStatusBar : 
      return;
    case PE_PanelButtonTool:
      if ((opt->state & (State_Sunken | State_On))) {
        qtmDrawShadeRoundPanel(p, opt->rect,  QPalette(opt->palette.color(QPalette::Mid)),//opt->palette,
                        (opt->state & (State_Sunken | State_On)), 2,
                        &opt->palette.brush(QPalette::Mid));
      } else {
        qtmDrawShadeRoundPanel(p, opt->rect, opt->palette, //QPalette(opt->palette.color(QPalette::Mid)),//opt->palette,
                        (opt->state & (State_Sunken | State_On)), 0,
                        &opt->palette.brush(QPalette::Mid));
      }
      return;
    default:
      ;
  }
  baseStyle()->drawPrimitive(element,opt,p,widget);  
}

Here is the call graph for this function:

QPixmap QTMProxyStyle::generatedIconPixmap ( QIcon::Mode  iconMode,
const QPixmap &  pixmap,
const QStyleOption *  option 
) const [inherited]

Definition at line 125 of file QTMStyle.cpp.

                                                                                                               {
  return baseStyle()->generatedIconPixmap (iconMode, pixmap, option);
}

Here is the call graph for this function:

QStyle::SubControl QTMProxyStyle::hitTestComplexControl ( ComplexControl  control,
const QStyleOptionComplex *  option,
const QPoint &  pos,
const QWidget *  widget = 0 
) const [inherited]

Definition at line 130 of file QTMStyle.cpp.

                                                                                                                                               {
  return baseStyle()->hitTestComplexControl (control, option, pos, widget);
}

Here is the call graph for this function:

QRect QTMProxyStyle::itemPixmapRect ( const QRect &  rect,
int  alignment,
const QPixmap &  pixmap 
) const [inherited]

Definition at line 135 of file QTMStyle.cpp.

                                                                                            {
  return baseStyle()->itemPixmapRect (rect, alignment, pixmap);
}

Here is the call graph for this function:

QRect QTMProxyStyle::itemTextRect ( const QFontMetrics &  metrics,
const QRect &  rect,
int  alignment,
bool  enabled,
const QString &  text 
) const [inherited]

Definition at line 140 of file QTMStyle.cpp.

                                                                                                                                   {
  return baseStyle()->itemTextRect (metrics, rect, alignment, enabled, text);
}

Here is the call graph for this function:

int QTMStyle::pixelMetric ( PixelMetric  metric,
const QStyleOption *  opt,
const QWidget *  widget 
) const

Reimplemented from QTMProxyStyle.

Definition at line 441 of file QTMStyle.cpp.

                                                                                               {
  switch (metric) {
    case PM_ToolBarItemSpacing:
      return 0;
    case PM_ToolBarIconSize:
      return 17;
  //  case PM_ToolBarFrameWidth:
  //    return 2;
    default:
      ;
  }
  return baseStyle()->pixelMetric(metric,opt,widget);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QTMProxyStyle::polish ( QWidget *  widget) [inherited]

Definition at line 150 of file QTMStyle.cpp.

                                      {
  baseStyle()->polish (widget);
}

Here is the call graph for this function:

void QTMProxyStyle::polish ( QApplication *  app) [inherited]

Definition at line 155 of file QTMStyle.cpp.

                                        {
  baseStyle()->polish (app);
}

Here is the call graph for this function:

void QTMProxyStyle::polish ( QPalette &  pal) [inherited]

Definition at line 160 of file QTMStyle.cpp.

                                    {
  baseStyle()->polish (pal);
}

Here is the call graph for this function:

const QStyle* QTMProxyStyle::proxy ( ) const [inline, inherited]

Definition at line 41 of file QTMStyle.cpp.

{ return this; }

Here is the caller graph for this function:

QSize QTMStyle::sizeFromContents ( ContentsType  type,
const QStyleOption *  option,
const QSize &  contentsSize,
const QWidget *  widget = 0 
) const

Reimplemented from QTMProxyStyle.

Definition at line 422 of file QTMStyle.cpp.

                                                                                                                                 {
  QSize sz(contentsSize);
  switch (type) {
    case CT_LineEdit:
      sz = QSize(sz.width() + 2, sz.height() + 2);
      break;
      
    case CT_ToolButton:
      sz = QSize(sz.width() + 4, sz.height() + 6);
      break;
      
    default:
      sz = baseStyle()->sizeFromContents(type, option, contentsSize, widget);
  }
  return sz;
}

Here is the call graph for this function:

QIcon QTMProxyStyle::standardIcon ( StandardPixmap  standardIcon,
const QStyleOption *  option = 0,
const QWidget *  widget = 0 
) const [inherited]

Definition at line 170 of file QTMStyle.cpp.

                                                                                                                 {
  return baseStyle()->standardIcon (standardIcon, option, widget);
}

Here is the call graph for this function:

QPalette QTMProxyStyle::standardPalette ( ) const [inherited]

Definition at line 175 of file QTMStyle.cpp.

                                      {
  return baseStyle()->standardPalette ();
}

Here is the call graph for this function:

QPixmap QTMProxyStyle::standardPixmap ( StandardPixmap  standardPixmap,
const QStyleOption *  option = 0,
const QWidget *  widget = 0 
) const [inherited]

Definition at line 180 of file QTMStyle.cpp.

                                                                                                                     {
  return baseStyle()->standardPixmap (standardPixmap, option, widget);
}

Here is the call graph for this function:

int QTMStyle::styleHint ( StyleHint  hint,
const QStyleOption *  option = 0,
const QWidget *  widget = 0,
QStyleHintReturn *  returnData = 0 
) const

Reimplemented from QTMProxyStyle.

Definition at line 514 of file QTMStyle.cpp.

                                                                                                                          {
  switch (hint) {
    case SH_MenuBar_AltKeyNavigation:
      return 0;
      // Set SH_MenuBar_AltKeyNavigation to false. Typically this would be the job of the style that is selected.
      // However: That mechanism seems to be broken with some Qt versions. Furthermore, the Alt key is heavily
      // used within TeXmacs, so the menubar navigation gets in the way quite often.
    default:
      return baseStyle()->styleHint (hint, option, widget, returnData);
  }
}

Here is the call graph for this function:

QRect QTMProxyStyle::subControlRect ( ComplexControl  control,
const QStyleOptionComplex *  option,
SubControl  subControl,
const QWidget *  widget = 0 
) const [inherited]

Definition at line 190 of file QTMStyle.cpp.

                                                                                                                                            {
  return baseStyle()->subControlRect (control, option, subControl, widget);
}

Here is the call graph for this function:

QRect QTMProxyStyle::subElementRect ( SubElement  element,
const QStyleOption *  option,
const QWidget *  widget = 0 
) const [inherited]

Definition at line 195 of file QTMStyle.cpp.

                                                                                                          {
  return baseStyle()->subElementRect (element, option, widget);
}

Here is the call graph for this function:

void QTMProxyStyle::unpolish ( QWidget *  widget) [inherited]

Definition at line 200 of file QTMStyle.cpp.

                                        {
  baseStyle()->unpolish (widget);
}

Here is the call graph for this function:

void QTMProxyStyle::unpolish ( QApplication *  app) [inherited]

Definition at line 205 of file QTMStyle.cpp.

                                          {
  baseStyle()->unpolish (app);
}

Here is the call graph for this function:


Member Data Documentation

QStyle* QTMProxyStyle::base [protected, inherited]

Definition at line 32 of file QTMStyle.cpp.


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