KwikPeg Manuals
Home
PegTitle
Examples
Examples
Index
Index


Members
Styles
Signals
Overview Derived from class PegThing
and PegTextThing

The PegTitle class provides a title bar window decoration that automatically sizes and positions itself at the top of the client area of its parent. A PegTitle object automatically adds various common control buttons to itself according to specifications provided by the title's style flags.

The PegTitle class also allows a title object to drag its parent window, provided that the parent window has its PSF_MOVEABLE system flag set.

If a PegTitle object is added to a PegDecoratedWindow object, the title string can be found by calling the latter's Title() function.



 See Also

PegDecoratedWindow

PegDialog



 Styles

The PegTitle class supports the following style flags:

TT_COPY  Keep separate copy of text with the object. This flag should be used when the string value used to assign text to an object is located in temporary storage such as a local variable on the stack.
TF_SYSBUTTON  A system button is to be included near the left edge of the title bar. The system button activates the system menu associated with the title bar.
TF_MINMAXBUTTON  The minimize and maximize control buttons are to be included near the right edge of the title bar.
TF_CLOSEBUTTON  A window close button is to be included at the right edge of the title bar.


 Signals

The PegTitle class does not generate signals. However, if a PegTitle object includes a system menu, the signals generated by the system menu will be passed to the title bar's parent window.


Top of page


 Members

Constructors:

PegTitle(const PEGCHAR *Title,
  WORD wStyle =
    TF_SYSBUTTON|TF_MINMAXBUTTON|TF_CLOSEBUTTON)

This constructor creates a PegTitle object with the title specified by parameter Title. The default style is to include all available title buttons. Since most titles static, the default title bar does not keep a copy of the title bar text string.

 

Public Functions:

void AssignMenu(PegMenuDescription *pDesc)

This function assigns an alternate system menu to the PegTitle system button. The default system menu includes the commands "Close" (PM_CLOSE), "Maximize" (PM_MAXIMIZE) and "Minimize" (PM_MINIMIZE).

virtual void Draw(void)

The PegTitle class overrides the Draw() function to draw the title background and title text.

virtual SIGNED Message(const PegMessage &Mesg)

The PegTitle class catches various screen pointer messages, title button messages and focus altering messages.


Top of page


 Examples

The following example illustrates a PegTitle object added to a PegDialog window:



The following code fragment creates a PegTitle object, assigns an alternate system menu to the title and adds the title to the parent window.

static PegMenuDescription SystemMenu[] =
{
    {"Exit",     IDB_DEMO_EXIT, AF_ENABLED,   NULL},
    {"Close",    IDB_CLOSE,     AF_ENABLED,   NULL},
    {"Save",     0,             0,            NULL},
    {"",         0,             BF_SEPARATOR, NULL},
    {"Restore",  IDB_RESTORE,   AF_ENABLED,   NULL},
    {"Minimize", IDB_MINIMIZE,  AF_ENABLED,   NULL},
    {"Maximize", IDB_MAXIMIZE,  AF_ENABLED,   NULL},
    {"",         0,             0,            NULL}
};

void MyWindow::AddTitle(void)
{
    PegTitle *pTitle =
        new PegTitle("Hello World",
            TF_SYSBUTTON|TF_CLOSEBUTTON);
    pTitle->AssignMenu(SystemMenu);
    Add(pTitle);
}



Top of page
KwikPeg Manuals
Home
Index
Index

 
Copyright © 2000-2003