Browse CVS Repository
Contents of /tombo/Tombo/Src/PsPCPlatform.cpp
Parent Directory
| Revision Log
| Revision Graph
Revision 1.2 -
( show annotations)
( download)
( as text)
Sun Jun 27 10:37:52 2004 UTC
(19 years, 9 months ago)
by hirami
Branch: MAIN
CVS Tags: B155, Tombo_2_0a3, Tombo_2_0a2, Tombo_2_0a1, Tombo_1_17_1, B153, B191, B192, B193, B194, Tombo_1_9b1, B196, B197, B198, B199, B200, B201, B202, B203, B205, B206, B207, B208, SNAPSHOT_20040920, SNAPSHOT_20040925, B183, B181, B180, B187, B186, B184, B189, B188, B213, B212, B211, B217, B216, B215, B214, B219, B218, Tombo_2_0b2, Tombo_2_0b3, Tombo_2_0b1, Tombo_1_9, Tombo_2_0b4, B228, B229, B226, B227, B224, B225, B222, B223, B220, B221, B154, B172, B156, B157, B150, B151, B152, B173, B158, B159, B171, Tombo_1_10, Tombo_1_13, SNAPSHOT20051220, Tombo_1_12, B231, B230, B147, B146, B145, B144, B143, B142, B141, B140, B149, B148, Tombo_1_15, Tombo_1_14, Tombo_1_17, Tombo_1_16, Tombo_1_11, B177, B174, B175, B178, B179, B164, B169, B168, B165, SNAPSHOT_20041121, B166, B161, B160, B163, B162, B139, HEAD
Branch point for: Tombo_2_0alpha_branch, Tombo_1_17_1_branch
Changes since 1.1: +12 -0 lines
File MIME type: text/x-c++src
* support two pane and edit view style on PocketPC.
* support BE-x00
| 1 |
#if defined(PLATFORM_PSPC) |
| 2 |
#include <windows.h> |
| 3 |
#include <commctrl.h> |
| 4 |
|
| 5 |
#include "resource.h" |
| 6 |
#include "PlatformLayer.h" |
| 7 |
#include "PsPCPlatform.h" |
| 8 |
#include "SipControl.h" |
| 9 |
|
| 10 |
#define NUM_IMG_BUTTONS 12 |
| 11 |
|
| 12 |
#define BOOKMARK_MENU_POS 2 |
| 13 |
|
| 14 |
#define NUM_CMDBAR_BUTTONS 4 |
| 15 |
static TBBUTTON aCmdBarButtons[NUM_CMDBAR_BUTTONS] = { |
| 16 |
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1}, |
| 17 |
{17, IDM_NEWMEMO , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1}, |
| 18 |
// {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1}, |
| 19 |
{22, IDM_SEARCH_PREV, 0, TBSTYLE_BUTTON, 0, 0, 0, -1}, |
| 20 |
{23, IDM_SEARCH_NEXT, 0, TBSTYLE_BUTTON, 0, 0, 0, -1}, |
| 21 |
// {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1}, |
| 22 |
}; |
| 23 |
|
| 24 |
#define NUM_MD_CMDBAR_BUTTONS 7 |
| 25 |
static TBBUTTON aMDCmdBarButtons[NUM_MD_CMDBAR_BUTTONS] = { |
| 26 |
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1}, |
| 27 |
{15, IDM_RETURNLIST, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1}, |
| 28 |
{STD_FILESAVE, IDM_SAVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1}, |
| 29 |
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1}, |
| 30 |
{22, IDM_SEARCH_PREV, 0, TBSTYLE_BUTTON, 0, 0, 0, -1}, |
| 31 |
{23, IDM_SEARCH_NEXT, 0, TBSTYLE_BUTTON, 0, 0, 0, -1}, |
| 32 |
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1}, |
| 33 |
|
| 34 |
}; |
| 35 |
|
| 36 |
static HWND MakeCommandBar(HINSTANCE hInst, HWND hWnd, |
| 37 |
DWORD nCtlID, WORD nMenuID, |
| 38 |
TBBUTTON *pButtons, |
| 39 |
DWORD nButton, DWORD nImages, DWORD nBitmap) |
| 40 |
{ |
| 41 |
HWND h; |
| 42 |
h = CommandBar_Create(hInst, hWnd, nCtlID); |
| 43 |
int boffset; |
| 44 |
CommandBar_AddBitmap(h, HINST_COMMCTRL,IDB_STD_SMALL_COLOR, 15, 0, 0); |
| 45 |
boffset = CommandBar_AddBitmap(h, hInst, nBitmap, nImages, 0, 0); |
| 46 |
|
| 47 |
CommandBar_InsertMenubar(h, hInst, nMenuID, 0); |
| 48 |
CommandBar_AddButtons(h, nButton, pButtons); |
| 49 |
CommandBar_AddAdornments(h, 0, 0); |
| 50 |
return h; |
| 51 |
} |
| 52 |
|
| 53 |
void PsPCPlatform::Create(HWND hWnd, HINSTANCE hInst) |
| 54 |
{ |
| 55 |
hMSCmdBar = MakeCommandBar(hInst, hWnd, ID_CMDBAR_MAIN, |
| 56 |
IDR_MENU_MAIN, aCmdBarButtons, |
| 57 |
NUM_CMDBAR_BUTTONS, NUM_IMG_BUTTONS, |
| 58 |
IDB_TOOLBAR); |
| 59 |
hMDCmdBar = MakeCommandBar(hInst, hWnd, ID_CMDBAR_DETAILS, |
| 60 |
IDR_MENU_DETAILS, aMDCmdBarButtons, |
| 61 |
NUM_MD_CMDBAR_BUTTONS, NUM_IMG_BUTTONS, |
| 62 |
IDB_TOOLBAR); |
| 63 |
CommandBar_Show(hMSCmdBar, TRUE); |
| 64 |
} |
| 65 |
|
| 66 |
void PsPCPlatform::EnableMenu(UINT uid, BOOL bEnable) |
| 67 |
{ |
| 68 |
HMENU hMenu; |
| 69 |
BOOL bMenu = TRUE; |
| 70 |
BOOL bTB = FALSE; HWND hTB = NULL; |
| 71 |
|
| 72 |
switch (uid) { |
| 73 |
case IDM_DECRYPT: |
| 74 |
case IDM_ENCRYPT: |
| 75 |
case IDM_DELETEITEM: |
| 76 |
case IDM_RENAME: |
| 77 |
case IDM_NEWMEMO: |
| 78 |
case IDM_CUT: |
| 79 |
case IDM_COPY: |
| 80 |
case IDM_PASTE: |
| 81 |
case IDM_NEWFOLDER: |
| 82 |
case IDM_GREP: |
| 83 |
hMenu = GetMSEditMenu(); |
| 84 |
break; |
| 85 |
case IDM_SAVE: |
| 86 |
bMenu = FALSE; |
| 87 |
bTB = TRUE; |
| 88 |
hTB = hMDCmdBar; |
| 89 |
default: |
| 90 |
return; |
| 91 |
} |
| 92 |
|
| 93 |
if (bMenu) { |
| 94 |
if (bEnable) { |
| 95 |
EnableMenuItem(hMenu, uid, MF_BYCOMMAND | MF_ENABLED); |
| 96 |
} else { |
| 97 |
EnableMenuItem(hMenu, uid, MF_BYCOMMAND | MF_GRAYED); |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
if (bTB) { |
| 102 |
SendMessage(hTB, TB_ENABLEBUTTON, uid, MAKELONG(bEnable, 0)); |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
void PsPCPlatform::OpenDetailsView() |
| 107 |
{ |
| 108 |
CommandBar_Show(hMSCmdBar, SW_HIDE); |
| 109 |
CommandBar_Show(hMDCmdBar, SW_SHOW); |
| 110 |
} |
| 111 |
|
| 112 |
void PsPCPlatform::CloseDetailsView() |
| 113 |
{ |
| 114 |
CommandBar_Show(hMDCmdBar, SW_HIDE); |
| 115 |
CommandBar_Show(hMSCmdBar, SW_SHOW); |
| 116 |
} |
| 117 |
|
| 118 |
void PsPCPlatform::EnableSearchNext() |
| 119 |
{ |
| 120 |
SendMessage(hMSCmdBar, TB_SETSTATE, IDM_SEARCH_PREV, MAKELONG(TBSTATE_ENABLED, 0)); |
| 121 |
SendMessage(hMSCmdBar, TB_SETSTATE, IDM_SEARCH_NEXT, MAKELONG(TBSTATE_ENABLED, 0)); |
| 122 |
SendMessage(hMDCmdBar, TB_SETSTATE, IDM_SEARCH_PREV, MAKELONG(TBSTATE_ENABLED, 0)); |
| 123 |
SendMessage(hMDCmdBar, TB_SETSTATE, IDM_SEARCH_NEXT, MAKELONG(TBSTATE_ENABLED, 0)); |
| 124 |
} |
| 125 |
|
| 126 |
void PsPCPlatform::AdjustUserRect(RECT *r) |
| 127 |
{ |
| 128 |
DWORD nHOffset = CommandBar_Height(hMSCmdBar); |
| 129 |
r->top += nHOffset; |
| 130 |
r->bottom -= nHOffset; |
| 131 |
|
| 132 |
// SIP |
| 133 |
BOOL bStat; |
| 134 |
SipControl sc; |
| 135 |
if (!sc.Init()) return; |
| 136 |
if (!sc.GetSipStat(&bStat)) return; |
| 137 |
|
| 138 |
if (bStat) { |
| 139 |
RECT rSip = sc.GetRect(); |
| 140 |
r->bottom -= (rSip.bottom - rSip.top); |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
#endif // PLATFORM_PSPC |
| |