ReactOS  0.4.13-dev-73-gcfe54aa
page1.c File Reference
#include <windows.h>
#include <commctrl.h>
#include <tchar.h>
#include <assert.h>
#include "resource.h"
#include "trace.h"
Include dependency graph for page1.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 
#define XBITMAP   80
 
#define YBITMAP   20
 
#define BUFFER_LEN   MAX_PATH
 

Functions

static void InitListCtrl (HWND hDlg)
 
static void OnDrawItem (HWND hWnd, LPARAM lParam)
 
void OnSetFont (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
void OnMeasureItem (LPMEASUREITEMSTRUCT lpMeasureItemStruct)
 
LRESULT CALLBACK PageWndProc1 (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 

Variables

HINSTANCE hInst
 
HBITMAP hbmpPicture
 
HBITMAP hbmpOld
 
static TCHARitems []
 

Macro Definition Documentation

◆ BUFFER_LEN

#define BUFFER_LEN   MAX_PATH

Definition at line 35 of file page1.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 23 of file page1.c.

◆ XBITMAP

#define XBITMAP   80

Definition at line 32 of file page1.c.

◆ YBITMAP

#define YBITMAP   20

Definition at line 33 of file page1.c.

Function Documentation

◆ InitListCtrl()

static void InitListCtrl ( HWND  hDlg)
static

Definition at line 52 of file page1.c.

53 {
54  TCHAR szBuffer[200];
55  int i;
56 
58 
59  _tcscpy(szBuffer, _T("foobar item"));
60  SendMessage(hListBox, LB_ADDSTRING, 0, (LPARAM)szBuffer);
61 
62  for (i = 0; i < sizeof(items)/sizeof(items[0]); i++) {
63  _tcscpy(szBuffer, items[i]);
64  SendMessage(hListBox, LB_ADDSTRING, 0, (LPARAM)szBuffer);
65  }
66 
69 }
#define LB_SETCURSEL
Definition: winuser.h:2024
#define LB_ADDSTRING
Definition: winuser.h:1992
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
HWND WINAPI SetFocus(_In_opt_ HWND)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG_PTR LPARAM
Definition: windef.h:208
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_LIST1
Definition: resource.h:13
#define SendMessage
Definition: winuser.h:5709
static TCHAR * items[]
Definition: page1.c:45
HWND hListBox
Definition: enumfonts.cpp:27

Referenced by PageWndProc1().

◆ OnDrawItem()

static void OnDrawItem ( HWND  hWnd,
LPARAM  lParam 
)
static

Definition at line 71 of file page1.c.

72 {
73 // int nItem;
74  TCHAR tchBuffer[BUFFER_LEN];
75 // HBITMAP hbmp;
76  TEXTMETRIC tm;
77  int y;
78  HDC hdcMem;
79  LPDRAWITEMSTRUCT lpdis;
80  RECT rcBitmap;
81 
82  lpdis = (LPDRAWITEMSTRUCT)lParam;
83  // If there are no list box items, skip this message.
84  if (lpdis->itemID != -1) {
85  // Draw the bitmap and text for the list box item. Draw a rectangle around the bitmap if it is selected.
86  switch (lpdis->itemAction) {
87  case ODA_SELECT:
88  case ODA_DRAWENTIRE:
89  // Display the bitmap associated with the item.
91  hdcMem = CreateCompatibleDC(lpdis->hDC);
93  BitBlt(lpdis->hDC,
94  lpdis->rcItem.left, lpdis->rcItem.top,
95  lpdis->rcItem.right - lpdis->rcItem.left,
96  lpdis->rcItem.bottom - lpdis->rcItem.top,
97  hdcMem, 0, 0, SRCCOPY);
98  // Display the text associated with the item.
99  SendMessage(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID, (LPARAM)tchBuffer);
100  GetTextMetrics(lpdis->hDC, &tm);
101  y = (lpdis->rcItem.bottom + lpdis->rcItem.top - tm.tmHeight) / 2;
102  TextOut(lpdis->hDC, XBITMAP + 6, y, tchBuffer, _tcslen(tchBuffer));
104  DeleteDC(hdcMem);
105  // Is the item selected?
106  if (lpdis->itemState & ODS_SELECTED) {
107  // Set RECT coordinates to surround only the bitmap.
108  rcBitmap.left = lpdis->rcItem.left;
109  rcBitmap.top = lpdis->rcItem.top;
110  rcBitmap.right = lpdis->rcItem.left + XBITMAP;
111  rcBitmap.bottom = lpdis->rcItem.top + YBITMAP;
112  // Draw a rectangle around bitmap to indicate the selection.
113  DrawFocusRect(lpdis->hDC, &rcBitmap);
114  }
115  break;
116  case ODA_FOCUS:
117  // Do not process focus changes. The focus caret (outline rectangle)
118  // indicates the selection. The IDOK button indicates the final selection.
119  break;
120  }
121  }
122 }
#define XBITMAP
Definition: page1.c:32
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define LB_GETITEMDATA
Definition: winuser.h:2002
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG left
Definition: windef.h:291
#define GetTextMetrics
Definition: wingdi.h:4452
LONG right
Definition: windef.h:293
#define ODA_FOCUS
Definition: winuser.h:2498
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:416
HBITMAP hbmpPicture
Definition: page1.c:39
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
LONG_PTR LPARAM
Definition: windef.h:208
HBITMAP hbmpOld
Definition: page1.c:40
char TCHAR
Definition: xmlstorage.h:189
#define ODA_DRAWENTIRE
Definition: winuser.h:2496
#define BUFFER_LEN
Definition: page1.c:35
#define LB_GETTEXT
Definition: winuser.h:2010
Definition: time.h:76
BOOL WINAPI DeleteDC(_In_ HDC)
#define YBITMAP
Definition: page1.c:33
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define ODS_SELECTED
Definition: winuser.h:2499
#define SendMessage
Definition: winuser.h:5709
#define TextOut
Definition: wingdi.h:4461
LONG bottom
Definition: windef.h:294
static HBITMAP
Definition: button.c:44
LPARAM lParam
Definition: combotst.c:139
#define SRCCOPY
Definition: wingdi.h:332
#define ODA_SELECT
Definition: winuser.h:2497
HDC hdcMem
Definition: welcome.c:104

Referenced by PageWndProc1().

◆ OnMeasureItem()

void OnMeasureItem ( LPMEASUREITEMSTRUCT  lpMeasureItemStruct)

Definition at line 138 of file page1.c.

139 {
140  HFONT hFont;
141  LOGFONT lf;
142 
144  GetObject(hFont, sizeof(LOGFONT), &lf);
145  if (lf.lfHeight < 0)
146  lpMeasureItemStruct->itemHeight = -lf.lfHeight;
147  else
148  lpMeasureItemStruct->itemHeight = lf.lfHeight;
149 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
HFONT hFont
Definition: main.c:53
LONG lfHeight
Definition: dimm.idl:42
#define SYSTEM_FONT
Definition: wingdi.h:910
#define GetObject
Definition: wingdi.h:4446
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)

Referenced by PageWndProc1().

◆ OnSetFont()

void OnSetFont ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 125 of file page1.c.

126 {
127  RECT rc;
128  WINDOWPOS wp;
129 
130  GetWindowRect(hWnd, &rc);
131  wp.hwnd = hWnd;
132  wp.cx = rc.right - rc.left;
133  wp.cy = rc.bottom - rc.top;
136 }
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:293
LONG_PTR LPARAM
Definition: windef.h:208
UINT flags
Definition: winuser.h:3536
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SendMessage
Definition: winuser.h:5709
LONG bottom
Definition: windef.h:294
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
HWND hwnd
Definition: winuser.h:3530
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Referenced by PageWndProc1().

◆ PageWndProc1()

LRESULT CALLBACK PageWndProc1 ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 151 of file page1.c.

152 {
153  switch (message) {
154  case WM_INITDIALOG:
155  InitListCtrl(hDlg);
156  return TRUE;
157  case WM_SETFONT:
158  OnSetFont(hDlg, wParam, lParam);
159  return TRUE;
160  case WM_MEASUREITEM:
162  return TRUE;
163  case WM_DRAWITEM:
164  OnDrawItem(hDlg, lParam);
165  return TRUE;
166  case WM_COMMAND:
167  switch (LOWORD(wParam)) {
168  case IDOK:
169  case IDCANCEL:
170  break;
171  }
172  break;
173  }
174  return 0;
175 }
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
void OnSetFont(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: page1.c:125
WPARAM wParam
Definition: combotst.c:138
static void OnDrawItem(HWND hWnd, LPARAM lParam)
Definition: page1.c:71
static void InitListCtrl(HWND hDlg)
Definition: page1.c:52
#define WM_MEASUREITEM
Definition: winuser.h:1628
#define WM_COMMAND
Definition: winuser.h:1716
void OnMeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
Definition: page1.c:138
#define WM_SETFONT
Definition: winuser.h:1632
#define WM_DRAWITEM
Definition: winuser.h:1627
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by OnCreate().

Variable Documentation

◆ hbmpOld

HBITMAP hbmpOld

Definition at line 40 of file page1.c.

Referenced by OnDrawItem().

◆ hbmpPicture

HBITMAP hbmpPicture

Definition at line 39 of file page1.c.

Referenced by OnDrawItem().

◆ hInst

HINSTANCE hInst

Definition at line 13 of file dxdiag.c.

◆ items

TCHAR* items[]
static
Initial value:
= {
_T("services"),
_T("event log"),
_T("workstation"),
}
#define _T(x)
Definition: vfdio.h:22

Definition at line 45 of file page1.c.

Referenced by _test_items_ok(), add_data_reloc(), add_metadata_reloc(), add_metadata_reloc_parent(), balance_data_chunk(), balance_metadata_chunk(), check_reg_entries(), ConfigDlgProc(), ConvExecute(), create_custom_header_control(), CRYPT_AsnDecodeAccessDescription(), CRYPT_AsnDecodeAlgorithmId(), CRYPT_AsnDecodeAttributeTypeValue(), CRYPT_AsnDecodeAuthorityKeyId(), CRYPT_AsnDecodeAuthorityKeyId2(), CRYPT_AsnDecodeBasicConstraints(), CRYPT_AsnDecodeBasicConstraints2(), CRYPT_AsnDecodeCertInfo(), CRYPT_AsnDecodeCertPolicy(), CRYPT_AsnDecodeCertPolicyConstraints(), CRYPT_AsnDecodeCertPolicyMapping(), CRYPT_AsnDecodeCertSignedContent(), CRYPT_AsnDecodeCMSSignedInfo(), CRYPT_AsnDecodeCMSSignerInfoInternal(), CRYPT_AsnDecodeCRLEntry(), CRYPT_AsnDecodeCRLInfo(), CRYPT_AsnDecodeCTL(), CRYPT_AsnDecodeCTLEntry(), CRYPT_AsnDecodeDistPoint(), CRYPT_AsnDecodeEccSignature(), CRYPT_AsnDecodeEncryptedContentInfo(), CRYPT_AsnDecodeExtension(), CRYPT_AsnDecodeIssuerSerialNumber(), CRYPT_AsnDecodeIssuingDistPoint(), CRYPT_AsnDecodeNameConstraints(), CRYPT_AsnDecodeNoticeReference(), CRYPT_AsnDecodePKCSAttributeInternal(), CRYPT_AsnDecodePKCSContentInfoInternal(), CRYPT_AsnDecodePKCSDigestedData(), CRYPT_AsnDecodePKCSEnvelopedData(), CRYPT_AsnDecodePKCSSignerInfoInternal(), CRYPT_AsnDecodePolicyQualifier(), CRYPT_AsnDecodePolicyQualifierUserNoticeInternal(), CRYPT_AsnDecodePubKeyInfoInternal(), CRYPT_AsnDecodeRdnAttr(), CRYPT_AsnDecodeRecipientInfo(), CRYPT_AsnDecodeRsaPrivKey(), CRYPT_AsnDecodeRsaPubKey(), CRYPT_AsnDecodeSequence(), CRYPT_AsnDecodeSequenceItems(), CRYPT_AsnDecodeSMIMECapability(), CRYPT_AsnDecodeSPCDigest(), CRYPT_AsnDecodeSubtree(), CRYPT_AsnDecodeUnicodeRdnAttr(), CRYPT_AsnDecodeValidity(), CRYPT_AsnEncodeAccessDescription(), CRYPT_AsnEncodeAlgorithmId(), CRYPT_AsnEncodeAlgorithmIdWithNullParams(), CRYPT_AsnEncodeAttributeTypeValue(), CRYPT_AsnEncodeAuthorityKeyId(), CRYPT_AsnEncodeAuthorityKeyId2(), CRYPT_AsnEncodeBasicConstraints(), CRYPT_AsnEncodeBasicConstraints2(), CRYPT_AsnEncodeCert(), CRYPT_AsnEncodeCertInfo(), CRYPT_AsnEncodeCertPolicy(), CRYPT_AsnEncodeCertPolicyConstraints(), CRYPT_AsnEncodeCertPolicyMapping(), CRYPT_AsnEncodeCertPolicyQualifiers(), CRYPT_AsnEncodeCMSSignedInfo(), CRYPT_AsnEncodeCMSSignerInfo(), CRYPT_AsnEncodeCRLEntry(), CRYPT_AsnEncodeCRLInfo(), CRYPT_AsnEncodeCTL(), CRYPT_AsnEncodeCTLEntry(), CRYPT_AsnEncodeCTLSubjectAlgorithm(), CRYPT_AsnEncodeDistPoint(), CRYPT_AsnEncodeEncryptedContentInfo(), CRYPT_AsnEncodeExtension(), CRYPT_AsnEncodeGeneralSubtree(), CRYPT_AsnEncodeIssuerSerialNumber(), CRYPT_AsnEncodeIssuingDistPoint(), CRYPT_AsnEncodeNameConstraints(), CRYPT_AsnEncodeNoticeReference(), CRYPT_AsnEncodePKCSAttribute(), CRYPT_AsnEncodePKCSContentInfoInternal(), CRYPT_AsnEncodePKCSDigestedData(), CRYPT_AsnEncodePKCSEnvelopedData(), CRYPT_AsnEncodePKCSSignerInfo(), CRYPT_AsnEncodePolicyQualifierUserNotice(), CRYPT_AsnEncodePubKeyInfo(), CRYPT_AsnEncodePubKeyInfoNoNull(), CRYPT_AsnEncodeRecipientInfo(), CRYPT_AsnEncodeRsaPubKey(), CRYPT_AsnEncodeSequence(), CRYPT_AsnEncodeSMIMECapability(), CRYPT_AsnEncodeSPCDigest(), CRYPT_AsnEncodeValidity(), CRYPT_EncodeDataContentInfoHeader(), default_bzalloc(), DIALOG_CreateControls32(), dictionary_Items(), DPA_Grow(), free_certs(), CDefView::GetSelectedObjects(), InitListCtrl(), itemize_para(), load_APE_metadata(), load_GCE_metadata(), load_GifComment_metadata(), load_IMD_metadata(), load_LSD_metadata(), LoadChrmMetadata(), LoadGamaMetadata(), LoadIfdMetadata(), LoadTextMetadata(), LoadUnknownMetadata(), MSZipAlloc(), OF(), CardStack::Pop(), CardRegion::Pop(), redraw_states(), CDefViewDual::SelectedItems(), test_items(), test_multiselect(), test_newlines(), test_ScriptBreak(), test_ScriptGetFontFunctions(), test_ScriptItemize(), test_ScriptItemize_surrogates(), test_ScriptPlace(), test_ScriptShape(), test_ScriptShapeOpenType(), test_ScriptXtoX(), test_TVS_SINGLEEXPAND(), test_WSASocket(), CardStack::Top(), CardRegion::Top(), BtrfsPropSheet::update_size_details_dialog(), write_metadata_items(), WVTAsn1CatMemberInfoDecode(), WVTAsn1CatMemberInfoEncode(), WVTAsn1CatNameValueDecode(), WVTAsn1CatNameValueEncode(), WVTAsn1SpcFinancialCriteriaInfoDecode(), WVTAsn1SpcFinancialCriteriaInfoEncode(), WVTAsn1SpcIndirectDataContentDecode(), WVTAsn1SpcIndirectDataContentEncode(), WVTAsn1SpcPeImageDataDecode(), WVTAsn1SpcPeImageDataEncode(), WVTAsn1SpcSpOpusInfoDecode(), WVTAsn1SpcSpOpusInfoEncode(), zcalloc(), and zlib_alloc().