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

📄 about.c

📁 在ecos 下mingui 的移植开发
💻 C
字号:
//// about.c: the About Dialog module.//// Copyright (C) 1999, Wei Yongming.// // Current maintainer: Wei Yongming./***  This library is free software; you can redistribute it and/or**  modify it under the terms of the GNU Library General Public**  License as published by the Free Software Foundation; either**  version 2 of the License, or (at your option) any later version.****  This library 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.  See the GNU**  Library General Public License for more details.****  You should have received a copy of the GNU Library General Public**  License along with this library; if not, write to the Free**  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,**  MA 02111-1307, USA*///// Create date: 1999/8/28//// Modify records:////  Who             When        Where       For What                Status//-----------------------------------------------------------------------------//// TODO:// #include <pthread.h>#include <semaphore.h>#include "common.h"#include "minigui.h"#include "gdi.h"#include "window.h"#include "control.h"#ifndef lintstatic char fileid[] = "$Id: about.c,v 1.6 2000/11/20 05:46:45 ymwei Exp $";#endifstatic HWND sg_AboutWnd = HWND_DESKTOP;int AboutWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){    static BITMAP bmpLogo;    static HWND   hOK;    RECT          rcClient;        switch (message) {        case MSG_CREATE:            if (!LoadSystemBitmap (&bmpLogo, "logo"))                return -1;            sg_AboutWnd = hWnd;            GetClientRect (hWnd, &rcClient);            hOK = CreateWindow ("button",                                 "Close",                                 WS_CHILD | BS_DEFPUSHBUTTON | WS_VISIBLE,                                 IDOK,                                 (RECTW(rcClient) - 80)>>1,                                 rcClient.bottom - 40,                                 80, 24, hWnd, 0);        break;                case MSG_COMMAND:            if (LOWORD (wParam) == IDOK                 && HIWORD (wParam) == BN_CLICKED)                PostMessage (hWnd, MSG_CLOSE, 0, 0);        break;               case MSG_PAINT:        {            HDC hdc;                        hdc = BeginPaint (hWnd);                        GetClientRect (hWnd, &rcClient);            FillBoxWithBitmap (hdc,                 (RECTW(rcClient) - bmpLogo.bmWidth)>>1, 10,                 0, 0, &bmpLogo);                        rcClient.top = 60;            rcClient.bottom -= 50;            SetTextColor (hdc, PIXEL_lightgray);            SetBkColor (hdc, PIXEL_black);            DrawText (hdc, "MiniGUI -- a mini pthread-based GUI support library.\n"                           "MiniGUI is free software; you can\n"                           "redistribute it and/or modify it under\n"                           "the terms of the GNU LGPL.\n"                           "About Authors to see CREDITS.\n",                           -1, &rcClient, DT_WORDBREAK | DT_CENTER);            EndPaint (hWnd, hdc);        }        return 0;        case MSG_CLOSE:            UnloadBitmap (&bmpLogo);            DestroyWindow (hOK);            DestroyMainWindow (hWnd);            sg_AboutWnd = HWND_DESKTOP;            PostQuitMessage (hWnd);        return 0;    }    return DefaultMainWinProc(hWnd, message, wParam, lParam);}static void InitAboutDialogCreateInfo (PMAINWINCREATE pCreateInfo){    pCreateInfo->dwStyle = WS_CAPTION | WS_SYSMENU | WS_VISIBLE                                       | WS_BORDER;    pCreateInfo->dwExStyle = WS_EX_NONE;    pCreateInfo->spCaption = "About MiniGUI" ;    pCreateInfo->hMenu = 0;    pCreateInfo->hCursor = GetSystemCursor(0);    pCreateInfo->hIcon = 0;    pCreateInfo->MainWindowProc = AboutWinProc;    pCreateInfo->lx = 10;     pCreateInfo->ty = 5;    if (GetSysCharWidth () == 6) {        pCreateInfo->rx = 260;        pCreateInfo->by = 215;    }    else {        pCreateInfo->rx = 340;        pCreateInfo->by = 240;    }    pCreateInfo->iBkColor = PIXEL_black;     pCreateInfo->dwAddData = 0;    pCreateInfo->hHosting = HWND_DESKTOP;}static void* AboutDialogThread (void* data){    MSG Msg;    MAINWINCREATE CreateInfo;    HWND hMainWnd;    InitAboutDialogCreateInfo (&CreateInfo);    hMainWnd = CreateMainWindow(&CreateInfo);    if (hMainWnd == HWND_INVALID)        return NULL;    ShowWindow(hMainWnd, SW_SHOWNORMAL);    while( GetMessage(&Msg, hMainWnd) ) {        DispatchMessage(&Msg);    }    MainWindowThreadCleanup(hMainWnd);    return NULL;}void OpenAboutDialog (){    pthread_t thread;        if (sg_AboutWnd != HWND_DESKTOP) {        ShowWindow (sg_AboutWnd, SW_SHOWNORMAL);        return;    }    CreateThreadForMainWindow (&thread, NULL, AboutDialogThread, 0);}

⌨️ 快捷键说明

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