Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
plugin.cpp File Reference
#include <windows.h>
#include <windowsx.h>
#include <assert.h>
#include "resource.h"
#include "plugin.h"
#include "utils.h"
#include "dialogs.h"
#include "dbg.h"
#include "nsIServiceManager.h"
#include "nsIPref.h"

Go to the source code of this file.

Functions

static LRESULT CALLBACK NP_LOADDS PluginWndProc (HWND, UINT, WPARAM, LPARAM)
BOOL RegisterNullPluginWindowClass ()
void UnregisterNullPluginWindowClass ()
static void DrawCommandMessage (HDC hDC, LPSTR szString, LPRECT lprc)

Variables

nsIServiceManagergServiceManager = NULL
static char szNullPluginWindowClassName [] = CLASS_NULL_PLUGIN
static char szDefaultPluginFinderURL [] = DEFAULT_PLUGINFINDER_URL
static char szPageUrlForJavaScript [] = PAGE_URL_FOR_JAVASCRIPT
static char szPageUrlForJVM [] = JVM_SMARTUPDATE_URL
static char szPluginFinderCommandBeginning [] = PLUGINFINDER_COMMAND_BEGINNING
static char szPluginFinderCommandEnd [] = PLUGINFINDER_COMMAND_END

Function Documentation

static void DrawCommandMessage ( HDC  hDC,
LPSTR  szString,
LPRECT  lprc 
) [static]

Definition at line 626 of file plugin.cpp.

{
  if(szString == NULL)
    return;

  HFONT hFont = GetStockFont(DEFAULT_GUI_FONT);
  if(hFont == NULL)
    return;

  HFONT hFontOld = SelectFont(hDC, hFont);
  SIZE sz;
  GetTextExtentPoint32(hDC, szString, lstrlen(szString), &sz);
  POINT pt;
  pt.x = sz.cx;
  pt.y = sz.cy;
  LPtoDP(hDC, &pt, 1);

  int iY = (lprc->bottom / 2) - ((32) / 2) + 36;
  int iX = 0;

  if(lprc->right > pt.x)
    iX = lprc->right/2 - pt.x/2;
  else
    iX = 1;

  RECT rcText;
  rcText.left   = iX;
  rcText.right  = rcText.left + pt.x;
  rcText.top    = iY;
  rcText.bottom = rcText.top + pt.y;

  int iModeOld = SetBkMode(hDC, TRANSPARENT);
  COLORREF crColorOld = SetTextColor(hDC, RGB(0,0,0));
  DrawText(hDC, szString, lstrlen(szString), &rcText, DT_CENTER|DT_VCENTER);
  SetTextColor(hDC, crColorOld);
  SetBkMode(hDC, iModeOld);
  SelectFont(hDC, hFontOld);
}

Here is the call graph for this function:

static LRESULT CALLBACK NP_LOADDS PluginWndProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
) [static]

Definition at line 737 of file plugin.cpp.

{
  CPlugin *pPlugin = (CPlugin *)GetWindowLong(hWnd, GWL_USERDATA);
                        
  switch(message)
  {
    case WM_CREATE:
      pPlugin = (CPlugin *)(((CREATESTRUCT FAR*)lParam)->lpCreateParams);
      assert(pPlugin != NULL);
      SetWindowLong(hWnd, GWL_USERDATA, (LONG)pPlugin);
      pPlugin->onCreate(hWnd);
      return 0L;
    case WM_LBUTTONUP:
      HANDLE_WM_LBUTTONUP(hWnd, wParam, lParam, pPlugin->onLButtonUp);
      return 0L;
    case WM_RBUTTONUP:
      HANDLE_WM_RBUTTONUP(hWnd, wParam, lParam, pPlugin->onRButtonUp);
      return 0L;
    case WM_PAINT:
      HANDLE_WM_PAINT(hWnd, wParam, lParam, pPlugin->onPaint);
      return 0L;
    case WM_MOUSEMOVE:
      dbgOut1("MouseMove");
      break;

    default:
      break;
  }
  return(DefWindowProc(hWnd, message, wParam, lParam));
}

Definition at line 64 of file plugin.cpp.

{
  assert(hInst != NULL);

  WNDCLASS wc;

  memset(&wc, 0, sizeof(wc));

  wc.lpfnWndProc   = (WNDPROC)PluginWndProc;
  wc.cbWndExtra    = sizeof(DWORD);
  wc.hInstance     = hInst;
  wc.hIcon         = LoadIcon(hInst, IDI_APPLICATION);
  wc.hCursor       = NULL;
  wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1);
  wc.lpszClassName = szNullPluginWindowClassName;

  ATOM aRet = RegisterClass(&wc);
  return (aRet != NULL);
}

Here is the call graph for this function:

Definition at line 84 of file plugin.cpp.

{
  assert(hInst != NULL);
  UnregisterClass(szNullPluginWindowClassName, hInst);
}

Variable Documentation

Definition at line 51 of file plugin.cpp.

Definition at line 57 of file plugin.cpp.

Definition at line 53 of file plugin.cpp.

Definition at line 58 of file plugin.cpp.

Definition at line 59 of file plugin.cpp.

Definition at line 61 of file plugin.cpp.

Definition at line 62 of file plugin.cpp.