home *** CD-ROM | disk | FTP | other *** search
- Save Format v1.3
- @begin Form "MainForm"
- Exported 0;
-
- @begin Object "WModelessDialog"
- WSCaption 1;
- WSSizeable 1;
- WSDlgBorder 1;
- WSSysMenu 1;
- WSSystemMenu 1;
- WSMinimizeBox 1;
- WSMaximizeBox 1;
- WSGroup 1;
- WSTabStop 1;
- WSResizeBorder 1;
- WSVisible 1;
- Font "8.MS Sans Serif";
- Icon "WIcon( WResourceID( ICON_01 ) )";
- FormPositionType "Centered";
- FormAbsTop "110";
- FormAbsLeft "19";
- FDXStructName "SystemMenusFDXStruct";
- Text "System Menu";
- @begin Event "Create"
- GencodeSrcLine 205;
- FunctionName "MainForm::MainForm_Create";
- @end;
- @begin Event "InitMenu"
- GencodeSrcLine 222;
- FunctionName "MainForm::MainForm_InitMenu";
- @end;
- @begin UserFunction "MainForm()"
- Compiler 1;
- GencodeSrcLine 234;
- FunctionName "MainForm::MainForm()";
- @end;
- @begin UserFunction "~MainForm()"
- Compiler 1;
- GencodeSrcLine 240;
- FunctionName "MainForm::~MainForm()";
- @end;
- @begin UserFunction "createSystemMenu()"
- Private 1;
- GencodeSrcLine 246;
- FunctionName "MainForm::createSystemMenu()";
- @end;
- @begin UserFunction "Prototype for createSystemMenu()"
- Private 1;
- GencodeSrcLine 75;
- FunctionName "MainForm::Prototype for createSystemMenu()";
- @end;
- @begin UserFunction "menu_system_item_1_Click( WObject * source, WEventData * event )"
- Private 1;
- GencodeSrcLine 312;
- FunctionName "MainForm::menu_system_item_1_Click( WObject * source, WEventData * event )";
- @end;
- @begin UserFunction "Prototype for menu_system_item_1_Click( WObject * source, WEventData * event )"
- Private 1;
- GencodeSrcLine 77;
- FunctionName "MainForm::Prototype for menu_system_item_1_Click( WObject * source, WEventData * event )";
- @end;
- @begin UserFunction "addEventToListview( const WString & event )"
- Private 1;
- GencodeSrcLine 321;
- FunctionName "MainForm::addEventToListview( const WString & event )";
- @end;
- @begin UserFunction "Prototype for addEventToListview( const WString & event )"
- Private 1;
- GencodeSrcLine 79;
- FunctionName "MainForm::Prototype for addEventToListview( const WString & event )";
- @end;
- @begin UserFunction "menu_system_item_1_Select( WObject * source, WEventData * event )"
- Private 1;
- GencodeSrcLine 331;
- FunctionName "MainForm::menu_system_item_1_Select( WObject * source, WEventData * event )";
- @end;
- @begin UserFunction "Prototype for menu_system_item_1_Select( WObject * source, WEventData * event )"
- Private 1;
- GencodeSrcLine 81;
- FunctionName "MainForm::Prototype for menu_system_item_1_Select( WObject * source, WEventData * event )";
- @end;
- @begin UserFunction "menu_system_item_2_Click( WObject * source, WEventData * event )"
- Private 1;
- GencodeSrcLine 338;
- FunctionName "MainForm::menu_system_item_2_Click( WObject * source, WEventData * event )";
- @end;
- @begin UserFunction "Prototype for menu_system_item_2_Click( WObject * source, WEventData * event )"
- Private 1;
- GencodeSrcLine 83;
- FunctionName "MainForm::Prototype for menu_system_item_2_Click( WObject * source, WEventData * event )";
- @end;
- @begin UserFunction "menu_system_item_2_Select( WObject * source, WEventData * event )"
- Private 1;
- GencodeSrcLine 346;
- FunctionName "MainForm::menu_system_item_2_Select( WObject * source, WEventData * event )";
- @end;
- @begin UserFunction "Prototype for menu_system_item_2_Select( WObject * source, WEventData * event )"
- Private 1;
- GencodeSrcLine 85;
- FunctionName "MainForm::Prototype for menu_system_item_2_Select( WObject * source, WEventData * event )";
- @end;
- ResID 102;
- DesignName MainForm;
- TabIndex 0;
- DesignRect 19,110,280,227;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSMinimizeBox 1;
- WSGroup 1;
- WSVisible 1;
- Text "1. Click on the system menu and navigate to see the generated events";
- AutoSize "1";
- ResID 101;
- DesignName label_Hint1;
- TabIndex 0;
- DesignRect 7,5,224,8;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- Text "2. Right click on this label to see the system menu used in SetPopup";
- AutoSize "1";
- @begin Event "InitPopupMenu"
- GencodeSrcLine 353;
- FunctionName "MainForm::label_Hint2_InitPopupMenu";
- @end;
- ResID 102;
- DesignName label_Hint2;
- TabIndex 1;
- DesignRect 7,25,217,8;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- Text "3. Click this checkbox to check Item 1";
- AutoSize "1";
- ResID 103;
- DesignName label_Hint3;
- TabIndex 2;
- DesignRect 7,45,123,8;
- @end;
-
- @begin Object "WCheckBox"
- WBSAutoCheckBox 1;
- WCCSTop 1;
- WCCSNoMoveY 1;
- WCCSBottom 1;
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSVisible 1;
- FDXFieldName "checkbox_1_data";
- FDXFieldType "WULong";
- AutoSize "1";
- Text "Check \"Item 1\"";
- Checked "0";
- @begin Event "Click"
- GencodeSrcLine 361;
- FunctionName "MainForm::checkbox_Checked_Click";
- @end;
- ResID 104;
- DesignName checkbox_Checked;
- TabIndex 3;
- DesignRect 20,55,62,11;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- Text "4. Click this checkbox to disable Item 2 in the Form and label Init... events";
- AutoSize "1";
- ResID 105;
- DesignName label_Hint4;
- TabIndex 4;
- DesignRect 5,80,233,8;
- @end;
-
- @begin Object "WCheckBox"
- WBSAutoCheckBox 1;
- WCCSTop 1;
- WCCSNoMoveY 1;
- WCCSBottom 1;
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSVisible 1;
- FDXFieldName "checkbox_1_data";
- FDXFieldType "WULong";
- AutoSize "1";
- Text "Disable \"Item 2\"";
- Checked "0";
- @begin Event "Click"
- GencodeSrcLine 369;
- FunctionName "MainForm::checkbox_Disable_Click";
- @end;
- ResID 106;
- DesignName checkbox_Disable;
- TabIndex 5;
- DesignRect 20,90,65,12;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- Text "System Menu Events:";
- ResID 107;
- DesignName label_Events_Description;
- TabIndex 6;
- DesignRect 7,118,215,8;
- @end;
-
- @begin Object "WListView"
- WLVSReport 1;
- WLVSSingleSelection 1;
- WLVSShareImageLists 1;
- WLVSAutoArrange 1;
- WCCSTop 1;
- WCCSNoResize 1;
- WCCSNoDivider 1;
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSExClientEdge 1;
- WSVisible 1;
- ResizePercentages "[ 0 0 100 100 ]";
- ResID 108;
- DesignName lv_Events;
- TabIndex 7;
- DesignRect 7,130,215,74;
- @end;
-
- @begin Object "WCommandButton"
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSVisible 1;
- Default "1";
- Pressed "0";
- ResizePercentages "[ 100 0 0 0 ]";
- Text "Clear";
- @begin Event "Click"
- GencodeSrcLine 377;
- FunctionName "MainForm::cb_Clear_Click";
- @end;
- ResID 109;
- DesignName cb_Clear;
- TabIndex 8;
- DesignRect 225,130,40,14;
- @end;
-
- @begin HPPPrefixBlock
- @begin-code HPPPrefix
-
- // Declarations added here will be included at the top of the .HPP file
-
- @end-code;
- GencodeSrcLine 10;
- @end;
-
- @begin CPPPrefixBlock
- @begin-code CPPPrefix
-
- // Include definitions for resources.
- #include "WRes.h"
-
- @end-code;
- GencodeSrcLine 10;
- @end;
-
- @begin ClassContentsBlock
- @begin-code ClassContents
-
- /* Declare a member variable for each menu item you want
- in the system menu. This makes it easier to dynamically
- modify menu properties.
-
- This sample names the items following the convention for
- popup or pull down menus: <menu_name>_item_<item name>;
- you should replace the number at the end of the variable
- with a meaningful suffix.
- */
- private:
- WSystemMenu * menu_system;
- WMenuItem * menu_system_item_1;
- WMenuItem * menu_system_item_2;
-
- @end-code;
- GencodeSrcLine 62;
- @end;
-
- @begin-code GeneratedClassContents
-
- MainForm();
- ~MainForm();
-
- @end-code;
-
- @begin-code Code "MainForm::MainForm()"
-
- @@CLASSNAME@::@CLASSNAME@()
- : menu_system_item_1( NULL )
- , menu_system_item_2( NULL )
- {
-
- }
-
- @end-code;
-
- @begin-code Code "MainForm::~MainForm()"
-
- /* the menu items were added with the autoDelete flag
- set so the system will be responsible for deleting them.
- */
- @@CLASSNAME@::~@CLASSNAME@()
- {
- }
-
- @end-code;
-
- @begin-code Code "MainForm::createSystemMenu()"
-
- /* This function, "createSystemMenu", modifies the form's system
- menu by adding a new item at the top and a new item at the
- bottom.
-
- To interface correctly with the system, you must create
- menu items that are to be placed in a system menu with
- menu IDs of the following form:
- a) all user id's must be less than 0xf000.
- the system reserves ids from 0xf000 to 0xffff.
- b) all user id's must satisfy (id & 0xfff0) == id.
-
- After constructing each menu item, you can set event handlers which
- will be called when the user tracks over the menu item (Select event),
- or chooses the menu item (Click event).
- */
- WBool @CLASSNAME@::createSystemMenu()
- {
- WUShort menuID = 0x0010;
-
- menu_system = GetSystemMenu();
- WASSERTEX( menu_system != NULL, "Could not retrieve form's system menu" );
- if( menu_system == NULL ) {
- return( FALSE );
- }
-
- /* Set menu_system as a popup menu on the second hint label
- */
- label_Hint2->SetPopup( menu_system );
-
-
- /* Add a new item at the top
- */
- menu_system_item_1 = new WMenuItem( menuID,
- WTEXT("Item 1"),
- WTEXT("Execute command 1") );
-
- menu_system_item_1->SetEventHandler( WClickEvent,
- this, (WEventHandler)&@CLASSNAME@::menu_system_item_1_Click );
- menu_system_item_1->SetEventHandler( WSelectEvent,
- this, (WEventHandler)&@CLASSNAME@::menu_system_item_1_Select );
-
- menu_system->AddItem( menu_system_item_1, 0, TRUE );
- menu_system->AddSeparator( 1 );
-
-
- /* Increment the menu ID, preserving the properties described above
- */
- menuID += 0x10;
-
-
- /* Add a new item at the bottom
- */
- menu_system_item_2 = new WMenuItem( menuID,
- WTEXT("Item 2"),
- WTEXT("Execute command 2") );
-
- menu_system_item_2->SetEventHandler( WClickEvent,
- this, (WEventHandler)&@CLASSNAME@::menu_system_item_2_Click );
- menu_system_item_2->SetEventHandler( WSelectEvent,
- this, (WEventHandler)&@CLASSNAME@::menu_system_item_2_Select );
-
- menu_system->AddSeparator();
- menu_system->AddItem( menu_system_item_2, -1, TRUE );
-
- return( TRUE );
- }
-
- @end-code;
-
- @begin-code Code "MainForm::Prototype for createSystemMenu()"
-
- private:
- WBool createSystemMenu();
-
- @end-code;
-
- @begin-code Code "MainForm::menu_system_item_1_Click( WObject * source, WEventData * event )"
-
- WBool @CLASSNAME@::menu_system_item_1_Click(
- WObject * source,
- WEventData * event )
- {
- addEventToListview( "Click item_1" );
- WMessageBox::Info( this, WTEXT("System Menu"), WTEXT("Item 1 clicked (%schecked)"),
- menu_system_item_1->GetChecked() ? "" : "not " );
- return FALSE;
- }
-
- @end-code;
-
- @begin-code Code "MainForm::Prototype for menu_system_item_1_Click( WObject * source, WEventData * event )"
-
- private:
- WBool menu_system_item_1_Click( WObject * source, WEventData * event );
-
- @end-code;
-
- @begin-code Code "MainForm::addEventToListview( const WString & event )"
-
- void @CLASSNAME@::addEventToListview( const WString & event )
- {
- static WInt EventNum = 0;
- WInt item;
-
- WString eventNumText;
- eventNumText.Sprintf("%d", EventNum++ );
- item = lv_Events->Add( eventNumText, -1, 0, -1, NULL, 1, event.GetText() );
- lv_Events->EnsureIsVisible( item );
- }
-
- @end-code;
-
- @begin-code Code "MainForm::Prototype for addEventToListview( const WString & event )"
-
- private:
- void addEventToListview( const WString & event );
-
- @end-code;
-
- @begin-code Code "MainForm::menu_system_item_1_Select( WObject * source, WEventData * event )"
-
- WBool @CLASSNAME@::menu_system_item_1_Select(
- WObject * source,
- WEventData * event )
- {
- addEventToListview( WTEXT("Select item_1") );
- return FALSE;
- }
-
- @end-code;
-
- @begin-code Code "MainForm::Prototype for menu_system_item_1_Select( WObject * source, WEventData * event )"
-
- private:
- WBool menu_system_item_1_Select( WObject * source, WEventData * event );
-
- @end-code;
-
- @begin-code Code "MainForm::menu_system_item_2_Click( WObject * source, WEventData * event )"
-
- WBool @CLASSNAME@::menu_system_item_2_Click(
- WObject * source,
- WEventData * event )
- {
- addEventToListview( WTEXT("Click item_2") );
- WMessageBox::Info( this, WTEXT("System Menu"), WTEXT("Item 2 clicked") );
- return FALSE;
- }
-
- @end-code;
-
- @begin-code Code "MainForm::Prototype for menu_system_item_2_Click( WObject * source, WEventData * event )"
-
- private:
- WBool menu_system_item_2_Click( WObject * source, WEventData * event );
-
- @end-code;
-
- @begin-code Code "MainForm::menu_system_item_2_Select( WObject * source, WEventData * event )"
-
- WBool @CLASSNAME@::menu_system_item_2_Select(
- WObject * source,
- WEventData * event )
- {
- addEventToListview( "Select item_2" );
- return FALSE;
- }
-
- @end-code;
-
- @begin-code Code "MainForm::Prototype for menu_system_item_2_Select( WObject * source, WEventData * event )"
-
- private:
- WBool menu_system_item_2_Select( WObject * source, WEventData * event );
-
- @end-code;
-
- @begin-code Code "MainForm::MainForm_Create"
-
- WBool @CLASSNAME@::MainForm_Create(
- WObject * source,
- WCreateEventData * event )
- {
- WRect cr;
-
- createSystemMenu();
-
- cr = lv_Events->GetClientRectangle();
- lv_Events->AddColumn( WTEXT("Number") );
- lv_Events->AddColumn( WTEXT("Event") );
- lv_Events->SetColumnWidth( 1, cr.w - lv_Events->GetColumnWidth( 0 ) );
-
- cr = GetRectangle();
- SetMinimumTrackingSize( WSize( cr.w, cr.h ) );
- return FALSE;
- }
-
- @end-code;
-
- @begin-code Code "MainForm::MainForm_InitMenu"
-
- /* The InitMenu event is triggered on the form before any of
- the form's menus are displayed. You can use this event to
- enable or disable any menu items.
- */
- WBool @CLASSNAME@::MainForm_InitMenu(
- WObject * source,
- WMessageEventData * event )
- {
- menu_system_item_2->SetEnabled( !checkbox_Disable->GetChecked() );
- addEventToListview( "InitMenu SystemMenus" );
- return FALSE;
- }
-
- @end-code;
-
- @begin-code Code "MainForm::label_Hint2_InitPopupMenu"
-
- WBool @CLASSNAME@::label_Hint2_InitPopupMenu(
- WObject * source,
- WMessageEventData * event )
- {
- menu_system_item_2->SetEnabled( !checkbox_Disable->GetChecked() );
- addEventToListview( "InitPopupMenu label_Hint2" );
- return FALSE;
- }
-
- @end-code;
-
- @begin-code Code "MainForm::checkbox_Checked_Click"
-
- WBool @CLASSNAME@::checkbox_Checked_Click(
- WObject * source,
- WEventData * event )
- {
- menu_system_item_1->SetChecked( checkbox_Checked->GetChecked() );
-
- return FALSE;
- }
-
- @end-code;
-
- @begin-code Code "MainForm::checkbox_Disable_Click"
-
- WBool @CLASSNAME@::checkbox_Disable_Click(
- WObject * source,
- WEventData * event )
- {
- menu_system_item_1->SetChecked( checkbox_Checked->GetChecked() );
-
- return FALSE;
- }
-
- @end-code;
-
- @begin-code Code "MainForm::cb_Clear_Click"
-
- WBool @CLASSNAME@::cb_Clear_Click(
- WObject * source,
- WEventData * event )
- {
- lv_Events->DeleteAll();
-
- return FALSE;
- }
-
- @end-code;
- @end;
-