Label Class Reference

#include <label.h>

Inherits Rectangle.

Inheritance diagram for Label:

Inheritance graph
[legend]
Collaboration diagram for Label:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Alignment { LEFT, CENTER, RIGHT }

Public Member Functions

 Label (Monitor *monitor, Window window, Alignment align, GC gc)
 ~Label ()
void setText (string text)
string text () const
void update (unsigned long background, unsigned long text, unsigned long shine, unsigned long shadow, bool shineBorder=false, bool shadowBorder=false)
void setAlignment (const Alignment align)
unsigned int adjustWidth ()
unsigned int textWidth ()

Private Attributes

Alignment align_
GC gc_
Monitormonitor_
string text_
Window window_
WFontfont_

Detailed Description

Represents a low-level label widget implementation with alignment handling.

This widget is capable of using old style PCF fonts and new style XFT fonts.

Definition at line 28 of file label.h.


Member Enumeration Documentation

enum Label::Alignment

Enumerator:
LEFT 
CENTER 
RIGHT 

Definition at line 33 of file label.h.


Constructor & Destructor Documentation

Label::Label ( Monitor monitor,
Window  window,
Alignment  align,
GC  gc 
)

Definition at line 17 of file label.cpp.

References align_, Monitor::font(), font_, gc_, LOGDEBUG, monitor_, and window_.

Here is the call graph for this function:

Label::~Label (  ) 

Definition at line 29 of file label.cpp.


Member Function Documentation

void Label::setText ( string  text  ) 

Definition at line 100 of file label.cpp.

References text_.

Referenced by StatusBar::calculateMetersWidth(), StatusBar::calculateWorkspaceWidth(), StatusBar::illuminate(), Menu::illuminate(), InputBar::illuminate(), Frame::illuminate(), ClientBar::illuminate(), Client::illuminate(), Thing::illuminateBorder(), Menu::manage(), Box::setText(), ClientBar::updateClientInfo(), ClientBar::updateClientPager(), StatusBar::updateInputModeButton(), ClientBar::updateMenuButton(), StatusBar::updateMeters(), ClientBar::updateModeButton(), StatusBar::updateStatus(), and StatusBar::updateWorkspacePager().

string Label::text (  )  const

Definition at line 104 of file label.cpp.

References text_.

void Label::update ( unsigned long  background,
unsigned long  text,
unsigned long  shine,
unsigned long  shadow,
bool  shineBorder = false,
bool  shadowBorder = false 
)

Updates this label.

Parameters:
leftBorder if true a left border will be drawn.
rightBorder if true a right border will be drawn.

Definition at line 41 of file label.cpp.

References align_, WFont::ascent(), CENTER, Draw::drawShadowBorder(), Draw::drawShineBorder(), WFont::drawText(), font_, gc_, WFont::height(), Rectangle::height(), LEFT, LOGDEBUG, RIGHT, Util::shortenString(), text_, textWidth(), Rectangle::width(), window_, Rectangle::x(), XCORE, and Rectangle::y().

Referenced by StatusBar::illuminate(), Menu::illuminate(), InputBar::illuminate(), Frame::illuminate(), ClientBar::illuminate(), Client::illuminate(), Box::illuminate(), Thing::illuminateBorder(), ClientBar::updateClientInfo(), ClientBar::updateClientPager(), StatusBar::updateMeters(), StatusBar::updateStatus(), and StatusBar::updateWorkspacePager().

Here is the call graph for this function:

void Label::setAlignment ( const Alignment  align  ) 

Definition at line 108 of file label.cpp.

References align_.

Referenced by StatusBar::calculateMetersWidth(), StatusBar::illuminate(), InputBar::illuminate(), StatusBar::updateMeters(), and StatusBar::updateStatus().

unsigned int Label::adjustWidth (  ) 

Adjusts label width with the currently set text. Returns the adjusted width.

Definition at line 32 of file label.cpp.

References Rectangle::setWidth(), textWidth(), and Rectangle::width().

Referenced by StatusBar::calculateWorkspaceWidth(), InputBar::illuminate(), Client::illuminate(), Box::setText(), and StatusBar::updateMeters().

Here is the call graph for this function:

unsigned int Label::textWidth (  ) 

Helper method for adjustWidth, also useful for menu and bar stuff.

Definition at line 37 of file label.cpp.

References font_, WFont::height(), text_, and WFont::textWidth().

Referenced by adjustWidth(), StatusBar::calculateMetersWidth(), Menu::manage(), update(), ClientBar::updateClientInfo(), and ClientBar::updateClientPager().

Here is the call graph for this function:


Member Data Documentation

Alignment Label::align_ [private]

Definition at line 69 of file label.h.

Referenced by Label(), setAlignment(), and update().

GC Label::gc_ [private]

Definition at line 70 of file label.h.

Referenced by Label(), and update().

Monitor* Label::monitor_ [private]

Definition at line 71 of file label.h.

Referenced by Label().

string Label::text_ [private]

Definition at line 72 of file label.h.

Referenced by setText(), text(), textWidth(), and update().

Window Label::window_ [private]

Definition at line 73 of file label.h.

Referenced by Label(), and update().

WFont* Label::font_ [private]

Definition at line 74 of file label.h.

Referenced by Label(), textWidth(), and update().


The documentation for this class was generated from the following files:
Generated on Thu May 24 15:20:17 2007 for ncwm by  doxygen 1.5.1