Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

otk Namespace Reference


Detailed Description

The namespace containing a toolkit used by the Openbox window manager, and also for use by external applications that wish to present a similar visual appearance to Openbox.


Compounds

class  Application
class  AppWidget
struct  Atoms
 The atoms on the X server which this class will cache. More...

class  Button
struct  PixmapMask
struct  CacheItem
class  Display
 Manages a single X11 display. More...

class  EventDispatcher
class  EventHandler
class  FocusLabel
class  FocusWidget
class  Font
class  Label
class  Point
 The Point class is an x/y coordinate or size pair. More...

struct  PointerAssassin
class  Property
 Provides easy access to window properties. More...

class  PseudoRenderControl
class  Rect
 The Rect class defines a rectangle in the plane. More...

class  RenderColor
class  RenderControl
class  RenderStyle
class  RenderTexture
 Superclass for all the Textures. More...

struct  RGB
class  ScreenInfo
struct  Strut
 Defines a margin on 4 sides. More...

class  Surface
class  Timer
 The Timer class implements timed callbacks. More...

struct  TimerCompare
 Compares two timeval structs. More...

class  TrueRenderControl
class  ustring
 This class provides a simple wrapper to a std::string that can be encoded as UTF-8. The ustring::utf() member specifies if the given string is UTF-8 encoded. ustrings default to specifying UTF-8 encoding. More...

class  ustring_Iterator
 The iterator type for ustring. More...

class  Widget

Typedefs

typedef std::map< unsigned
int, EventHandler * > 
EventMap
typedef std::vector< RectRectList
 A list for Rect objects.

typedef u_int32_t pixel32
typedef u_int16_t pixel16
typedef u_int32_t unichar

Functions

int xerrorHandler (::Display *d, XErrorEvent *e)
Atom create (char *name)
unichar utf8_get_char (const char *p)
ustring::size_type utf8_ptr_to_offset (const char *str, const char *pos)
const char * utf8_offset_to_ptr (const char *str, ustring::size_type offset)
ustring::size_type utf8_byte_offset (const char *str, ustring::size_type offset)
ustring::size_type utf8_byte_offset (const char *str, ustring::size_type offset, ustring::size_type maxlen)
string expandTilde (const string &s)
void bexec (const string &command, const string &displaystring)
string itostring (unsigned long i)
string itostring (long i)
void putenv (const std::string &data)
string basename (const string &path)
std::string expandTilde (const std::string &s)
void bexec (const std::string &command, const std::string &displaystring)
std::string itostring (unsigned int i)
std::string itostring (int i)
std::string basename (const std::string &path)

Variables

Displaydisplay = (Display*) 0
 The display instance for the library.

const int default_red_shift = 16
const int default_green_shift = 8
const int default_blue_shift = 0
const int endian = LSBFirst
const char utf8_skip [256]


Typedef Documentation

typedef std::map<unsigned int, EventHandler *> otk::EventMap
 

Definition at line 11 of file eventdispatcher.hh.

typedef u_int16_t otk::pixel16
 

Definition at line 28 of file truerendercontrol.hh.

Referenced by otk::TrueRenderControl::reduceDepth().

typedef u_int32_t otk::pixel32
 

Definition at line 27 of file truerendercontrol.hh.

Referenced by otk::TrueRenderControl::crossDiagonalGradient(), otk::TrueRenderControl::diagonalGradient(), otk::TrueRenderControl::drawGradientBackground(), otk::TrueRenderControl::highlight(), and otk::TrueRenderControl::verticalGradient().

typedef std::vector<Rect> otk::RectList
 

A list for Rect objects.

Definition at line 252 of file rect.hh.

typedef u_int32_t otk::unichar
 

Definition at line 29 of file ustring.hh.

Referenced by utf8_get_char().


Function Documentation

std::string basename const std::string &    path
 

string basename const string &    path
 

Definition at line 99 of file util.cc.

00099                                      {
00100   string::size_type slash = path.rfind('/');
00101   if (slash == string::npos)
00102     return path;
00103   return path.substr(slash+1);
00104 }

void bexec const std::string &    command,
const std::string &    displaystring
 

void bexec const string &    command,
const string &    displaystring
 

Definition at line 54 of file util.cc.

References putenv().

Referenced by ob::execute().

00054                                                                {
00055 #ifndef    __EMX__
00056   if (! fork()) {
00057     setsid();
00058     putenv(displaystring);
00059     int ret = execl("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL);
00060     exit(ret);
00061   }
00062 #else //   __EMX__
00063   spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", command.c_str(), NULL);
00064 #endif // !__EMX__
00065 }

Atom create char *    name [static]
 

Definition at line 22 of file property.cc.

Referenced by otk::Property::initialize().

00022 { return XInternAtom(**display, name, false); }

std::string expandTilde const std::string &    s
 

string expandTilde const string &    s
 

Definition at line 44 of file util.cc.

Referenced by ob::Openbox::Openbox().

00044                                     {
00045   if (s[0] != '~') return s;
00046 
00047   const char* const home = getenv("HOME");
00048   if (home == NULL) return s;
00049 
00050   return string(home + s.substr(s.find('/')));
00051 }

std::string itostring int    i [inline]
 

Definition at line 34 of file util.hh.

References itostring().

00035   { return itostring((long) i); }

std::string itostring unsigned int    i [inline]
 

Definition at line 32 of file util.hh.

References itostring().

00033   { return itostring((unsigned long) i); }

std::string otk::itostring long    i
 

Definition at line 79 of file util.cc.

References itostring().

00079                          {
00080   std::string tmp = itostring( (unsigned long) std::abs(i));
00081   if (i < 0)
00082     tmp.insert(tmp.begin(), '-');
00083   return tmp;
00084 }

std::string otk::itostring unsigned long    i
 

Definition at line 68 of file util.cc.

Referenced by itostring(), and otk::ScreenInfo::ScreenInfo().

00068                                   {
00069   if (i == 0)
00070     return string("0");
00071   
00072   string tmp;
00073   for (; i > 0; i /= 10)
00074     tmp.insert(tmp.begin(), "0123456789"[i%10]);
00075   return tmp;
00076 }

void otk::putenv const std::string &    data
 

Definition at line 86 of file util.cc.

References _.

Referenced by bexec(), and otk::Display::Display().

00087 {
00088   char *c = new char[data.size() + 1];
00089   std::string::size_type i, max;
00090   for (i = 0, max = data.size(); i < max; ++i)
00091     c[i] = data[i];
00092   c[i] = 0;
00093   if (::putenv(c)) {
00094     printf(_("warning: couldn't set environment variable\n"));
00095     perror("putenv()");
00096   }
00097 }

ustring::size_type utf8_byte_offset const char *    str,
ustring::size_type    offset,
ustring::size_type    maxlen
 

Definition at line 91 of file ustring.cc.

References utf8_skip.

00093 {
00094   if(offset == ustring::npos)
00095     return ustring::npos;
00096 
00097   const char *const pend = str + maxlen;
00098   const char* p = str;
00099 
00100   for(; offset != 0; --offset)
00101   {
00102     if(p >= pend)
00103       return ustring::npos;
00104 
00105     p += utf8_skip[static_cast<unsigned char>(*p)];
00106   }
00107 
00108   return (p - str);
00109 }

ustring::size_type utf8_byte_offset const char *    str,
ustring::size_type    offset
 

Definition at line 72 of file ustring.cc.

References utf8_skip.

Referenced by otk::ustring::erase().

00073 {
00074   if(offset == ustring::npos)
00075     return ustring::npos;
00076 
00077   const char* p = str;
00078 
00079   for(; offset != 0; --offset)
00080   {
00081     if(*p == '\0')
00082       return ustring::npos;
00083 
00084     p += utf8_skip[static_cast<unsigned char>(*p)];
00085   }
00086 
00087   return (p - str);
00088 }

unichar utf8_get_char const char *    p
 

Definition at line 31 of file ustring.cc.

References unichar, and utf8_skip.

Referenced by otk::ustring_Iterator< T >::operator *(), and otk::ustring::operator[]().

00032 {
00033   unichar result = static_cast<unsigned char>(*p);
00034 
00035   // if its not a 7-bit ascii character
00036   if((result & 0x80) != 0) {
00037     // len is the number of bytes this character takes up in the string
00038     unsigned char len = utf8_skip[result];
00039     result &= 0x7F >> len;
00040 
00041     while(--len != 0) {
00042       result <<= 6;
00043       result |= static_cast<unsigned char>(*++p) & 0x3F;
00044     }
00045   }
00046     
00047   return result;
00048 }

const char* utf8_offset_to_ptr const char *    str,
ustring::size_type    offset
 

Definition at line 64 of file ustring.cc.

References utf8_skip.

Referenced by otk::ustring::operator[]().

00065 {
00066   while (offset--)
00067     str += utf8_skip[static_cast<unsigned char>(*str)];
00068   return str;
00069 }

ustring::size_type utf8_ptr_to_offset const char *    str,
const char *    pos
[static]
 

Definition at line 51 of file ustring.cc.

References utf8_skip.

Referenced by otk::ustring::size().

00052 {
00053   ustring::size_type offset = 0;
00054 
00055   while (str < pos) {
00056     str += utf8_skip[static_cast<unsigned char>(*str)];
00057     offset++;
00058   }
00059 
00060   return offset;
00061 }

int xerrorHandler ::Display   d,
XErrorEvent *    e
[static]
 

Definition at line 53 of file display.cc.

References display, and otk::Display::ignoreErrors().

00054 {
00055   if (!display->ignoreErrors()) {
00056 #ifdef DEBUG
00057     char errtxt[128];
00058 
00059     //if (e->error_code != BadWindow)
00060     {
00061       XGetErrorText(d, e->error_code, errtxt, 127);
00062       printf("X Error: %s\n", errtxt);
00063       if (e->error_code != BadWindow)
00064         abort();
00065     }
00066 #else
00067     (void)d;
00068     (void)e;
00069 #endif
00070   }
00071   return false;
00072 }


Variable Documentation

const int otk::default_blue_shift = 0
 

Definition at line 39 of file truerendercontrol.hh.

Referenced by otk::TrueRenderControl::crossDiagonalGradient(), otk::TrueRenderControl::diagonalGradient(), otk::TrueRenderControl::drawGradientBackground(), otk::TrueRenderControl::highlight(), otk::TrueRenderControl::reduceDepth(), and otk::TrueRenderControl::verticalGradient().

const int otk::default_green_shift = 8
 

Definition at line 38 of file truerendercontrol.hh.

Referenced by otk::TrueRenderControl::crossDiagonalGradient(), otk::TrueRenderControl::diagonalGradient(), otk::TrueRenderControl::drawGradientBackground(), otk::TrueRenderControl::highlight(), otk::TrueRenderControl::reduceDepth(), and otk::TrueRenderControl::verticalGradient().

const int otk::default_red_shift = 16
 

Definition at line 37 of file truerendercontrol.hh.

Referenced by otk::TrueRenderControl::crossDiagonalGradient(), otk::TrueRenderControl::diagonalGradient(), otk::TrueRenderControl::drawGradientBackground(), otk::TrueRenderControl::highlight(), otk::TrueRenderControl::reduceDepth(), and otk::TrueRenderControl::verticalGradient().

Display * otk::display = (Display*) 0
 

The display instance for the library.

Definition at line 51 of file display.cc.

Referenced by otk::Widget::create(), otk::RenderColor::create(), otk::Surface::createObjects(), otk::EventDispatcher::dispatch(), otk::EventDispatcher::dispatchEvents(), otk::Display::Display(), otk::TrueRenderControl::drawGradientBackground(), otk::RenderControl::drawRoot(), ob::Frame::Frame(), otk::RenderControl::getRenderControl(), otk::EventHandler::handle(), otk::Widget::render(), otk::Label::renderForeground(), otk::FocusLabel::renderForeground(), otk::RenderStyle::RenderStyle(), otk::TrueRenderControl::TrueRenderControl(), and xerrorHandler().

const int otk::endian = LSBFirst
 

Definition at line 40 of file truerendercontrol.hh.

Referenced by otk::TrueRenderControl::drawGradientBackground().

const char otk::utf8_skip[256] [static]
 

Initial value:

 {
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
  3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
}

Definition at line 18 of file ustring.cc.

Referenced by utf8_byte_offset(), utf8_get_char(), utf8_offset_to_ptr(), and utf8_ptr_to_offset().


Generated on Tue Feb 4 23:00:21 2003 for Openbox by doxygen1.3-rc2