Aros/开发者/Zune/示例/文本编辑器
外观
一个使用 TextEditor Zune (=MUI) 自定义类的简短示例程序。它将在窗口中呈现一个可用的文本编辑器。
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/muimaster.h>
#include <libraries/mui.h>
#include <mui/TextEditor_mcc.h>
int main (int argc, char **argv) {
struct Library *MUIMasterBase = NULL;
Object *mui_app = NULL;
Object *mui_win = NULL;
if (MUIMasterBase = (struct Library *) OpenLibrary("muimaster.library", 0)) {
mui_app = ApplicationObject,
SubWindow, mui_win = WindowObject,
MUIA_Window_Title, "texteditor",
WindowContents, TextEditorObject, End,
End,
End;
if (mui_app) {
// open window:
SetAttrs(mui_win, MUIA_Window_Open, TRUE, TAG_DONE);
IPTR open;
GetAttr(MUIA_Window_Open, mui_win, &open);
if (open) {
// *** INSERT LOOP CODE ASKING FOR WINDOW CLOSE EVENT HERE ***
// ... and close again:
SetAttrs(mui_win, MUIA_Window_Open, FALSE, TAG_DONE);
}
DisposeObject(mui_app);
}
CloseLibrary(MUIMasterBase);
}
return 1;
}
gcc [sourcefile] -lmui