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

📄 edillo.c

📁 嵌入式下基于MiniGUI的Web Browser
💻 C
字号:
/*** $Id: edillo.c,v 1.53 2005/06/30 08:16:44 xfke Exp $**** edillo.c: The main entry of a simple eDillo test program.**** Copyright (C) 2005 Feynman Software.*//***  This source is free software; you can redistribute it and/or**  modify it under the terms of the GNU General Public**  License as published by the Free Software Foundation; either**  version 2 of the License, or (at your option) any later version.****  This software 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**  General Public License for more details.****  You should have received a copy of the GNU 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*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>#include <minigui/control.h>#include <unistd.h>#include "glib.h"#include "gtype.h"#include "interface.h"#include "edillo.h"#include "edillo-res.h"BrowserWindow* bw;/* --- variables --- */static GMemVTable minigui_mem_vtable = {  malloc,  realloc,  free,  calloc,  NULL,  NULL,};GMemVTable *mem_table = &minigui_mem_vtable;static void mem_vtable_init (void){    g_mem_set_vtable (mem_table);}static int MGDilloMainWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam){    switch (message)     {        case MSG_CREATE:        {            char start_page[256];            RECT rc;#ifdef ENABLE_TVOUTPUT            BrowserWindowType dw_style = WITH_STATUSBAR | WITH_PROGRESSBAR;#else            BrowserWindowType dw_style = WITH_TOOLBAR | WITH_LOCATION |                     WITH_STATUSBAR | WITH_PROGRESSBAR;#endif            GetClientRect (hWnd, &rc);            if (GetWindowAdditionalData (hWnd))                strncpy (start_page, (char*)GetWindowAdditionalData (hWnd),                        256);            else                snprintf (start_page, 256, "about:splash");            bw = a_Interface_browser_window_new (hWnd, RECTW(rc), RECTH(rc),                             start_page, dw_style);            break;        }        case MSG_DESTROY:            DestroyAllControls (hWnd);            a_Interface_quit (bw);            return 0;        case MSG_CLOSE:            DestroyMainWindow (hWnd);            PostQuitMessage (hWnd);            return 0;    }    return DefaultMainWinProc (hWnd, message, wParam, lParam);}static void InitCreateInfo (PMAINWINCREATE pCreateInfo){    pCreateInfo->dwStyle = WS_THINFRAME | WS_CAPTION;    pCreateInfo->dwExStyle = WS_EX_NONE;    pCreateInfo->spCaption = "eDillo on MiniGUI";    pCreateInfo->hMenu = 0;    pCreateInfo->hCursor = GetSystemCursor (IDC_ARROW);    pCreateInfo->hIcon = 0;    pCreateInfo->MainWindowProc = MGDilloMainWinProc;    pCreateInfo->lx = 0;     pCreateInfo->ty = 0;    pCreateInfo->rx = g_rcScr.right;    pCreateInfo->by = g_rcScr.bottom;    pCreateInfo->iBkColor = COLOR_lightwhite;     pCreateInfo->dwAddData = 0;    pCreateInfo->hHosting = HWND_DESKTOP;}static GMainLoop *main_loop;static gboolean pending_msg_callback (gpointer data){    HWND hwnd = (HWND) data;    MSG msg;    if (HavePendingMessage (hwnd)) {        if (!GetMessage (&msg, hwnd)) {            g_main_loop_quit (main_loop);            return FALSE;        }        TranslateMessage (&msg);        DispatchMessage (&msg);    }    else        g_usleep (10000);    return TRUE;}int MiniGUIMain (int args, const char* arg[]){    HWND hMainWnd;    MAINWINCREATE CreateInfo;#ifdef _MGRM_PROCESSES    if (JoinLayer (NAME_TOPMOST_LAYER, "edillo", 0, 0) == 				INV_LAYER_HANDLE) {        printf ("JoinLayer: invalid layer handle.\n");        exit (1);    }#elif defined(_LITE_VERSION) && !(_STAND_ALONE)    int i;    const char* layer = NULL;    RECT max_rect = {0, 0, 0, 0};    for (i = 1; i < args; i++) {        if (strcmp (arg[i], "-layer") == 0) {            layer = arg[i + 1];            break;        }    }    GetLayerInfo (layer, &max_rect, NULL, NULL, NULL);    if (JoinLayer (layer, arg[0],                 max_rect.left, max_rect.top,                 max_rect.left + 1024,                 max_rect.top + 768) == INV_LAYER_HANDLE) {        printf ("JoinLayer: invalid layer handle.\n");        exit (1);    }#else#ifdef _IME_GB2312    GBIMEWindow (HWND_DESKTOP);#endif#endif    /* initialization of glib */    //mem_vtable_init ();    g_type_init ();    main_loop = g_main_loop_new (NULL, FALSE);    if (!edillo_init ()) {        printf ("eDillo: Can not init eDillo internals.\n");        return 2;    }    InitCreateInfo (&CreateInfo);    CreateInfo.dwAddData = (DWORD) arg [1];    hMainWnd = CreateMainWindow (&CreateInfo);    if (hMainWnd == HWND_INVALID) {        printf ("eDillo: Can not create main window.\n");        return 3;    }    ShowWindow (hMainWnd, SW_SHOWNORMAL);    g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,                    (GSourceFunc)pending_msg_callback, (void*)hMainWnd, NULL);    g_main_loop_run (main_loop);    g_idle_remove_by_data ((void*)hMainWnd);    g_main_loop_unref (main_loop);    MainWindowThreadCleanup (hMainWnd);    edillo_cleanup ();    return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif

⌨️ 快捷键说明

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