home *** CD-ROM | disk | FTP | other *** search
- /*
- MENUEDIT.HPP
- */
-
- #ifndef _MENUEDIT_HPP_INCLUDED
- #define _MENUEDIT_HPP_INCLUDED
-
- #include "propdlg.hpp"
-
- class DTWMenu;
- class DTWMenuObject;
-
- #define MENEGOTIATE_TABLE_SIZE sizeof( MENegotiateTable ) / sizeof( MENegotiate )
-
-
- class METADEF MenuEdit : public MTPropertyDialog {
- public:
- MenuEdit();
- ~MenuEdit();
-
- WBool AskApplyChanges() { return TRUE; }
- WBool Create( WWindow *prt, DTObject *obj, WBool c );
-
- WBool IsModified() { return TRUE; }
- WBool Refresh() { return TRUE; }
- WBool Validate( WString & ) { return TRUE; }
- WBool Apply() { return TRUE; }
-
- /* Event Handlers */
-
- // Events in case the dialog is closed unexpectedly.
- // If this dialog is ever moved into the property sheets
- // these callbacks will be unnecessary.
- WBool CloseEventHandler( WModelessDialog *, WEventData * );
- WBool HandleOKButton( WWindow *, WEventData * );
- WBool HandleCancelButton( WWindow *, WEventData * );
-
- // Menu hiliting
- WBool HiliteMenuItems( WObject *, WEventData * );
-
- // Buttons and moving data around
-
- WBool RefreshFields( WObject *, WEventData * );
- WBool EnableButtons( WObject *, WEventData * );
-
- WBool AddCallback( WObject *, WEventData * );
- WBool ChangeCallback( WObject *, WEventData * );
- WBool AddChildCallback( WObject *, WEventData * );
- WBool ClearCallback( WObject *, WEventData * );
-
- WBool SetSeparator( WObject *, WEventData * );
-
- WBool ShiftLeft( WObject *, WEventData * );
- WBool ShiftRight( WObject *, WEventData * );
- WBool ShiftUp( WObject *, WEventData * );
- WBool ShiftDown( WObject *, WEventData * );
-
- WBool SeeEvent( WObject *, WEventData * );
-
- // Menu functions
-
- WBool EraseAll( WObject *, WEventData * );
- WBool Exit( WObject *, WEventData * );
- WBool DeleteItem( WObject *, WEventData * );
-
- void Changed();
-
- private:
-
- // Private functions
-
- WBool initTreeView( DTWMenuObject *head, WTreeViewItemHandle parent );
- void addDefaultItem();
- void setEventHandlers();
- void setMenuFunctions();
-
- void setDataFromFields( DTWMenuObject *data );
- void setFieldsFromData( DTWMenuObject *data );
- void resetFields();
- void enableFields( WBool enable );
- WInt GetObjectWithName( WString & name,
- DTWMenuObject * head,
- DTWMenuObject * & found ) const;
-
- WTreeViewItemHandle itemFromScreenPos( WPoint &pt );
-
- WTreeViewItemHandle copyTree( WTreeViewItemHandle head,
- WTreeViewItemHandle parent,
- WTreeViewItemHandle insertAfter );
-
- // Window controls
-
- WTreeView * _editWindow;
-
- WTextBox * _captionEdit;
- WTextBox * _nameEdit;
-
- WHotKey * _acceleratorEdit;
-
- WCheckBox * _checkedBox;
- WCheckBox * _defaultBox;
- WCheckBox * _disabledBox;
- WCheckBox * _separatorBox;
-
- WComboBox * _negotiatePosition;
-
- WPictureButton * _bttnLeft;
- WPictureButton * _bttnRight;
- WPictureButton * _bttnUp;
- WPictureButton * _bttnDown;
-
- WCommandButton * _bttnEvent;
- WCommandButton * _bttnChange;
- WCommandButton * _bttnAdd;
- WCommandButton * _bttnAddChild;
- WCommandButton * _bttnClear;
- WCommandButton * _bttnEraseAll;
- WCommandButton * _bttnDelete;
-
- WCommandButton * _bttnClose;
-
- // Other window components
-
- WPopupMenu * _editMenu;
-
- // Private variables
-
- DTWMenu * _dtmenu;
-
- WBool _usingOldName;
- DTWMenuObject * _oldData;
- };
-
- #endif
-