Page 2 of 2

Re: brainstorming menu customization

PostPosted: Tue Jun 19, 2018 8:01 am
by Zinn
Josef,
your idea is perfect.
- No new keyword.
- Defining the position with an existing entry and insert it behind.
- When the entry is not found, we are at the end of the list. That is the correct default position for insert it.
Helmut

Re: brainstorming menu customization

PostPosted: Tue Jun 19, 2018 4:27 pm
by Robert
Some initial menu API suggestions (not worked out in complete detail!):


TYPE
Menu = POINTER TO ABSTRACT RECORD END;
Paragraph = POINTER TO ABSTRACT RECORD END;
Item = POINTER TO ABSTRACT RECORD END;
Directory = POINTER TO ABSTRACT RECORD END;

VAR
dir-, stdDir-: Directory;

PROCEDURE SetDir (d: Directory);


PROCEDURE (dir: Directory) NewMenu (IN menuName, menuGuard: ARRAY OF CHAR): Menu;
PROCEDURE (dir: Directory) NewParagraph (): Paragraph;
PROCEDURE (dir: Directory) NewItem (IN label, shortcut, command, guard: ARRAY OF CHAR): Item;


PROCEDURE GetFirstMenu (): Menu;
PROCEDURE GetMenu (IN menuName, menuGuard: ARRAY OF CHAR): Menu;
PROCEDURE SetMenu (menu: Menu; first: BOOLEAN);

PROCEDURE (menu: Menu) GetNext (): Menu;
PROCEDURE (menu: Menu) AddPrior (newMenu: Menu);
PROCEDURE (menu: Menu) AddAfter (newMenu: Menu);
PROCEDURE (menu: Menu) Remove;
PROCEDURE (menu: Menu) Info (OUT menuName, menuGuard: ARRAY OF CHAR; OUT pNo: INTEGER);


PROCEDURE (menu: Menu) GetFirstParagraph (): Paragraph;
PROCEDURE (menu: Menu) GetParagraph (pos: INTEGER): Paragraph;
PROCEDURE (menu: Menu) SetParagraph (para: Paragrap; fist: BOOLEAN): ;
PROCEDURE (para: Paragraph) AddPrior (newPara: Paragraph);
PROCEDURE (para: Paragraph) AddAfter (newPara: Paragraph);
PROCEDURE (para: Paragraph) Remove;
PROCEDURE (para: Paragraph) Info (iNo: INTEGER);


PROCEDURE (para: Paragraph) GetFirstItem (): Item;
PROCEDURE (para: Paragraph) GetItem (pos: INTEGER): Item;
PROCEDURE (para: Paragraph) GetThisItem (IN itemName: ARRAY OF CHAR): Item;
PROCEDURE (para: Paragraph) SetItem (item: Item; first: BOOLEAN);
PROCEDURE (item: Item) AddPrior (newItem: Item);
PROCEDURE (item: Item) AddAfter (newItem: Item);
PROCEDURE (item: Item) Remove;
PROCEDURE (item: Item) Info (OUT label, shortcut, command, guard: ARRAY OF CHAR);


Most are (I think) fairly obvious. pNo is number of Paragraphs in this Menu. iNo is number of Items in this Paragraph.