跳轉到內容

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;
}

AROS 原生編譯器命令列

[編輯 | 編輯原始碼]
gcc [sourcefile] -lmui

螢幕截圖

[編輯 | 編輯原始碼]

AROS 版本

[編輯 | 編輯原始碼]
華夏公益教科書