//--------------------------------------------------------------------------- // // Copyright (C) Geoworks 1997. All rights reserved. // GEOWORKS CONFIDENTIAL // // ファイル: helloapp.cpp // // 解説: // // 簡単なサンプル アプリケーション "Hello World!" です。このアプリケー // ションでスケルトンの構成と実行方法を理解できます。 // //--------------------------------------------------------------------------- #include #include #include #include #include #include #include #include "resource.h" #include "helloapp.h" // ResidentApplication のサブクラス。このアプリケーションをシステムに // 登録し、AppBase の作成方法を提供します。 class HelloResidentApplication : public ResidentApplication { public: HelloResidentApplication() : ResidentApplication(_TEXT("helloUI")) {}; virtual AppBase *CreateAppBase(void) {return new HelloApp;} }; static HelloResidentApplication helloApp; // アプリケーションの指定属性。ここでは名前を指定していますが、 // 標準以外のスタック サイズやスレッド優先順位なども指定できます。 // static AppNameAttribute helloName(&helloApp, HELLOAPP_APP_TEXT); //--------------------------------------------------------------------------- // HelloApp::SetAppContext() //--------------------------------------------------------------------------- // // 概要: アプリケーションのユーザー インターフェイスの初期化 // スコープ: public // 戻り値: void // //--------------------------------------------------------------------------- void HelloApp::SetAppContext(const TCHAR *) { FlexFrame *mainWindow; FlexLabel *helloLabel; // // FlexFrame を作成し、アプリケーションのアウトラインとして使用します // mainWindow = theUIFactory->CreateFlexFrame(HINT_FRAME_WITH_NO_CLOSE_BUTTON, HELLOAPP_APP_TEXT); // // エラー チェック。オブジェクト ポインタが有効かどうかに注意。 // ASSERT(mainWindow != NULL); // // ラベルを作成し、テキストを表示します // helloLabel = theUIFactory->CreateFlexLabel(); ASSERT(helloLabel != NULL); // // ラベルのテキストを設定します // helloLabel->SetText(HELLOAPP_TEXT); // // ラベルをメイン ウィンドウに追加します // mainWindow->Add(helloLabel); // // フロー レイアウトを作成します。コンポーネントを水平方向の中央に配置し、 // コンポーネント間の間隔を 0 にします // HorizontalFlowLayout *mainWindowLayout = new HorizontalFlowLayout(0); ASSERT(mainWindowLayout != NULL); // // レイアウトをメイン ウィンドウにアタッチします // mainWindow->SetLayout(mainWindowLayout); // // メイン ウィンドウをアプリケーションに追加します // this->Add(mainWindow); // // メイン ウィンドウを可視にして表示します // mainWindow->SetVisible(TRUE); } /* End of HelloApp::SetAppContext() */