Home |
Class PegTitle HMI (Human-Machine Interface) Classes |
Class PegTitlePegTitle is a window decoration that automatically sizes and positions itself at the top of the client area of its parent. PegTitle automatically adds various common control buttons to itself depending on the title style flags. PegTitle also add the functionality of dragging the parent window. PegTitle checks the parent window PSF_MOVEABLE status flag in order to provide this capability. A pointer to the title added to a PegDecoratedWindow can be obtained at any time by calling the PegDecoratedWindow::Title() function. class PegTitle : public PegThing, public PegTextThing { public: PegTitle(const PEGCHAR * Title, PEGUINT wStyle = TF_SYSBUTTON | TF_MINMAXBUTTON | TF_CLOSEBUTTON); virtual void Draw(void); virtual PEGINT Message(const PegMessage &Mesg); void AssignMenu(PegMenuDescription * pMenu); }; Demo programs Table, TreeView, PegDemo, Spread, and Notebook uses this class. Style FlagsTT_COPY, TF_SYSBUTTON, TF_MINMAXBUTTON, TF_CLOSEBUTTON. SignalsPegTitle does not send signals, however the system menu associated with the title bar will send signals to the parent window. ConstructorThe constructor creates a PegTitle. The default style is to include all available title buttons, and not to copy the title bar text string. Method AssignMenuAssigns 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). Method DrawDraws the title background and title text. Method MessagePegTitle catches various mouse message, the title button messages, and focus alteration messages. ExamplesThe following is a PegTitle added to a PegDialog window: The following function creates a PegTitle, 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); }
|