123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- {
- This file is part of the Free Pascal run time library.
- Copyright (c) 2005 Karoly Balogh
- MUI helper functions for MorphOS/PowerPC
- Based on work of Nils Sjoholm member of the Amiga RTL
- development team.
- MorphOS port was done on a free Pegasos II/G4 machine
- provided by Genesi S.a.r.l. <www.genesi.lu>
- See the file COPYING.FPC, included in this distribution,
- for details about the copyright.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- **********************************************************************}
- unit muihelper;
- interface
- uses intuition, mui, doslib, utility;
- const
- NoFrame = MUIV_Frame_None;
- ButtonFrame = MUIV_Frame_Button;
- ImageButtonFrame = MUIV_Frame_ImageButton;
- TextFrame = MUIV_Frame_Text;
- StringFrame = MUIV_Frame_String;
- ReadListFrame = MUIV_Frame_ReadList;
- InputListFrame = MUIV_Frame_InputList;
- PropFrame = MUIV_Frame_Prop;
- SliderFrame = MUIV_Frame_Slider;
- GaugeFrame = MUIV_Frame_Gauge;
- VirtualFrame = MUIV_Frame_Virtual;
- GroupFrame = MUIV_Frame_Group;
- const
- Child = MUIA_Group_Child;
- SubWindow = MUIA_Application_Window;
- WindowContents = MUIA_Window_RootObject;
- // Creates a MUI application
- function MH_Application(tags: array of LongWord): pObject_;
- function MH_Application(var app; tags: array of LongWord): pObject_;
- // Creates a MUI window
- function MH_Window(tags: array of LongWord): pObject_;
- function MH_Window(var win; tags: array of LongWord): pObject_;
- // Creates a MUI button
- function MH_MakeButton(blabel: pchar): pObject_;
- function MH_MakeButton(var button; blabel: pchar): pObject_;
- // Creates a MUI HBar
- function MH_MakeHBar(space: longword): pObject_;
- function MH_MakeHBar(var hbar; space: longword): pObject_;
- // Creates MUI V/HGroup
- function MH_VGroup(tags: array of LongWord): pObject_;
- function MH_VGroup(frame: longword; tags: array of LongWord): pObject_;
- function MH_VGroup(title: PChar; tags: array of LongWord): pObject_;
- function MH_HGroup(tags: array of LongWord): pObject_;
- function MH_HGroup(frame: longword; tags: array of LongWord): pObject_;
- function MH_HGroup(title: PChar; tags: array of LongWord): pObject_;
- // Creates MUI Col/RowGroup
- function MH_ColGroup(cols: longword; tags: array of LongWord): pObject_;
- function MH_ColGroup(cols: longword; frame: longword; tags: array of LongWord): pObject_;
- function MH_ColGroup(cols: longword; title: PChar; tags: array of LongWord): pObject_;
- function MH_RowGroup(rows: longword; tags: array of LongWord): pObject_;
- function MH_RowGroup(rows: longword; frame: longword; tags: array of LongWord): pObject_;
- function MH_RowGroup(rows: longword; title: PChar; tags: array of LongWord): pObject_;
- // Creates a MUI Text area
- function MH_Text(contents: PChar): pObject_;
- function MH_Text(contents: PChar; tags: array of LongWord): pObject_;
- function MH_Text(var text_; contents: PChar): pObject_;
- function MH_Text(var text_; contents: PChar; tags: array of LongWord): pObject_;
- implementation
- // Creates a MUI application
- // ************************************************************************
- function MH_Application(tags: array of LongWord): pObject_;
- begin
- MH_Application:=MUI_NewObject(MUIC_Application, tags);
- end;
- function MH_Application(var app; tags: array of LongWord): pObject_;
- begin
- pObject_(app):=MUI_NewObject(MUIC_Application, tags);
- MH_Application:=pObject_(app);
- end;
- // Creates a MUI window
- // ************************************************************************
- function MH_Window(tags: array of LongWord): pObject_;
- begin
- MH_Window:=MUI_NewObject(MUIC_Window, tags);
- end;
- function MH_Window(var win; tags: array of LongWord): pObject_;
- begin
- pObject_(win):=MUI_NewObject(MUIC_Window, tags);
- MH_Window:=pObject_(win);
- end;
- // Creates a MUI button
- // ************************************************************************
- function MH_MakeButton(blabel: pchar): pObject_;
- begin
- MH_MakeButton:=MUI_MakeObject(MUIO_Button, [DWord(blabel)]);
- end;
- function MH_MakeButton(var button; blabel: pchar): pObject_;
- begin
- pObject_(button):=MUI_MakeObject(MUIO_Button, [DWord(blabel)]);
- MH_MakeButton:=pObject_(button);
- end;
- // Creates a MUI HBar
- // ************************************************************************
- function MH_MakeHBar(space: longword): pObject_;
- begin
- MH_MakeHBar:=MUI_MakeObject(MUIO_HBar, [space]);
- end;
- function MH_MakeHBar(var hbar; space: longword): pObject_;
- begin
- pObject_(hbar):=MUI_MakeObject(MUIO_HBar, [space]);
- MH_MakeHBar:=pObject_(hbar);
- end;
- // Creates a MUI VGroup
- // ************************************************************************
- function MH_VGroup(tags: array of LongWord): pObject_;
- begin
- MH_VGroup:=MUI_NewObject(MUIC_Group, tags);
- end;
- function MH_VGroup(frame: longword; tags: array of LongWord): pObject_;
- begin
- MH_VGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Frame, frame, TAG_MORE, DWord(@tags) ] );
- end;
- function MH_VGroup(title: PChar; tags: array of LongWord): pObject_;
- begin
- MH_VGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Frame, MUIV_Frame_Group,
- MUIA_FrameTitle, longword(title),
- MUIA_Background, MUII_GroupBack,
- TAG_MORE, DWord(@tags) ]);
- end;
- // Creates a MUI HGroup
- // ************************************************************************
- function MH_HGroup(tags: array of LongWord): pObject_;
- begin
- MH_HGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Group_Horiz, MUI_TRUE, TAG_MORE, DWord(@tags) ]);
- end;
- function MH_HGroup(frame: longword; tags: array of LongWord): pObject_;
- begin
- MH_HGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Group_Horiz, MUI_TRUE,
- MUIA_Frame, frame,
- TAG_MORE, DWord(@tags) ] );
- end;
- function MH_HGroup(title: PChar; tags: array of LongWord): pObject_;
- begin
- MH_HGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Group_Horiz, MUI_TRUE,
- MUIA_Frame, MUIV_Frame_Group,
- MUIA_FrameTitle, longword(title),
- MUIA_Background, MUII_GroupBack,
- TAG_MORE, DWord(@tags) ]);
- end;
- // Creates MUI ColGroup
- // ************************************************************************
- function MH_ColGroup(cols: longword; tags: array of LongWord): pObject_;
- begin
- MH_ColGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Group_Columns, cols, TAG_MORE, DWord(@tags) ]);
- end;
- function MH_ColGroup(cols: longword; frame: longword; tags: array of LongWord): pObject_;
- begin
- MH_ColGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Group_Columns, cols,
- MUIA_Frame, frame,
- TAG_MORE, DWord(@tags) ]);
- end;
- function MH_ColGroup(cols: longword; title: PChar; tags: array of LongWord): pObject_;
- begin
- MH_ColGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Group_Columns, cols,
- MUIA_Frame, MUIV_Frame_Group,
- MUIA_FrameTitle, longword(title),
- MUIA_Background, MUII_GroupBack,
- TAG_MORE, DWord(@tags) ]);
- end;
- // Creates MUI RowGroup
- // ************************************************************************
- function MH_RowGroup(rows: longword; tags: array of LongWord): pObject_;
- begin
- MH_RowGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Group_Rows, rows, TAG_MORE, DWord(@tags) ]);
- end;
- function MH_RowGroup(rows: longword; frame: longword; tags: array of LongWord): pObject_;
- begin
- MH_RowGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Group_Rows, rows,
- MUIA_Frame, frame,
- TAG_MORE, DWord(@tags) ]);
- end;
- function MH_RowGroup(rows: longword; title: PChar; tags: array of LongWord): pObject_;
- begin
- MH_RowGroup:=MUI_NewObject(MUIC_Group, [ MUIA_Group_Rows, rows,
- MUIA_Frame, MUIV_Frame_Group,
- MUIA_FrameTitle, longword(title),
- MUIA_Background, MUII_GroupBack,
- TAG_MORE, DWord(@tags) ]);
- end;
- // Creates a MUI text area
- // ************************************************************************
- function MH_Text(contents: PChar): pObject_;
- begin
- MH_Text:=MUI_NewObject(MUIC_Text,[ MUIA_Text_Contents, DWord(contents), TAG_DONE ]);
- end;
- function MH_Text(contents: PChar; tags: array of LongWord): pObject_;
- begin
- MH_Text:=MUI_NewObject(MUIC_Text,[ MUIA_Text_Contents, DWord(contents),
- TAG_MORE, DWord(@tags) ]);
- end;
- function MH_Text(var text_; contents: PChar): pObject_;
- begin
- pObject_(text_):=MUI_NewObject(MUIC_Text,[ MUIA_Text_Contents, DWord(contents), TAG_DONE ]);
- MH_Text:=pObject_(text_);
- end;
- function MH_Text(var text_; contents: PChar; tags: array of LongWord): pObject_;
- begin
- pObject_(text_):=MUI_NewObject(MUIC_Text,[ MUIA_Text_Contents, DWord(contents),
- TAG_MORE, DWord(@tags) ]);
- MH_Text:=pObject_(text_);
- end;
- end.
|