⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vdialog.cpp

📁 一个基于BREW上的电子时钟程序,通过太阳历计算当前时间,并有闹铃和日志功能.
💻 CPP
字号:
//
//      VDialog.cpp
//
//      Copyright (C) 2006 Sophia Cradle Incorporated

#include "VDialog.hpp"
#include "pclock_res.h"
#include "pclock.hpp"
#include "SGRSoftkeyWindow.hpp"
#include "SGRSoftkeyToolbox.hpp"

#define     DIALOG_HEIGHT       (192)
#define     BASE_MARGIN         (4)
#define     BUTTON_MARGIN       (5)
#define     LABEL_SOFTKEY3      ("慖戰")

VDialog::VDialog(Void) static_throws : SFRTitleDialog(SFXRectangle(0, 0, 0, 0), "僶乕僕儑儞忣曬", ALIGN_LEFT, BEHAVIOR_TITLEDIALOG, ATTRIBUTE_VDIALOG)
{
    SGRSoftkeyWindowPtr softkey;
    SFRButtonControlPtr button;
    SFXRectangle rect;

    SGRSoftkeyWindow::Initialize(this);
    if (static_try()) {
        static_throw(RegisterHandler(SREVT_RESPONDER_RENDER, SRP16_RENDER_CONTENT, HANDLER_BEFORE, HANDLER_FUNCTION(OnRender)));
        if (static_try()) {
            if ((_image = SFBShell::GetInstance()->LoadResImage(PCLOCK_RESOURCE_FILENAME, VERSION)) != null) {
                SetBaseBound(SGRSoftkeyToolbox::GetDialogPosition(GetMargin(), DIALOG_HEIGHT));
                rect = GetContentWorld();
                rect.Deflate(BASE_MARGIN, BASE_MARGIN);
                rect.AddTop(rect.GetHeight() - SFXGraphics::GetFontHeight(AEE_FONT_NORMAL) - BUTTON_MARGIN);
                if ((button = ::new SFRButtonControl(this, rect, "OK")) != null) {
                    static_throw(*button);
                    if (static_try()) {
                        static_throw(button->RegisterHandler(SREVT_CONTROL, HANDLER_BEFORE, HANDLER_FUNCTION(OnOk)));
                        if (static_try()) {
                            button->SetStatusFocus(true);
                            Select();
                            if ((softkey = SGRSoftkeyWindow::GetInstance()) != null) {
                                static_throw(softkey->Register(this, SGRSoftkeyWindow::SOFTKEY_3, LABEL_SOFTKEY3));
                                if (static_try()) {
                                    SetReference(softkey->Bind(this));
                                }
                            }
                        }
                    }
                }
                else {
                    static_throw(SFERR_NO_MEMORY);
                }
            }
            else {
                static_throw(SFERR_FAILED);
            }
        }
    }
    return;
}

VDialog::~VDialog(Void)
{
    SGRSoftkeyWindow::Terminate(this);
    return;
}

HANDLER_IMPLEMENT_VOIDRENDER(VDialog, OnRender, graphics)
{
    SFXRectangle rect(GetContentWorld());
    AEEImageInfo info;

    SFRTitleDialog::ContentHandler(graphics);
    rect.SubBottom(SFXGraphics::GetFontHeight(AEE_FONT_NORMAL) + BUTTON_MARGIN);
    _image->GetInfo(&info);
    graphics->DrawImage(_image, SFXGrid(rect.GetSize() - SFXSize(info.cx, info.cy)) / 2);
    return;
}

HANDLER_IMPLEMENT_VOIDVOID(VDialog, OnOk)
{
    Invoke(SFXEvent(SREVT_DIALOG, SRP16_OK, reinterpret_cast<UInt32>(this)));
    return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -