Browse CVS Repository
Contents of /tombo/Tombo/Src/StatusBar.cpp
Parent Directory
| Revision Log
| Revision Graph
Revision 1.1 -
( show annotations)
( download)
( as text)
Mon May 31 15:35:29 2004 UTC
(19 years, 10 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, B136, B134, B135, 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, B138, B139, HEAD
Branch point for: Tombo_2_0alpha_branch, Tombo_1_17_1_branch
File MIME type: text/x-c++src
* add SetCurrentNote when saving notes.
* refactoring around platform dependent routines (especially toolbar, menu etc..)
| 1 |
#include <windows.h> |
| 2 |
#include <commctrl.h> |
| 3 |
#include "resource.h" |
| 4 |
#include "StatusBar.h" |
| 5 |
|
| 6 |
#if defined(PLATFORM_WIN32) || defined(PLATFORM_HPC) |
| 7 |
|
| 8 |
BOOL StatusBar::Create(HWND hWnd, BOOL bNew) |
| 9 |
{ |
| 10 |
#if defined(PLATFORM_HPC) |
| 11 |
hStatusBar = CreateStatusWindow(WS_CHILD , TEXT(""), |
| 12 |
hWnd, IDC_STATUS); |
| 13 |
#endif |
| 14 |
#if defined(PLATFORM_WIN32) |
| 15 |
hStatusBar = CreateStatusWindow(WS_CHILD | SBARS_SIZEGRIP, "", |
| 16 |
hWnd, IDC_STATUS); |
| 17 |
#endif |
| 18 |
|
| 19 |
ResizeStatusBar(); |
| 20 |
SendMessage(hStatusBar, SB_SETTEXT, 0 | SBT_NOBORDERS , (LPARAM)""); |
| 21 |
return TRUE; |
| 22 |
} |
| 23 |
|
| 24 |
void StatusBar::ResizeStatusBar() |
| 25 |
{ |
| 26 |
RECT r; |
| 27 |
GetClientRect(hStatusBar, &r); |
| 28 |
DWORD nHeight = r.bottom - r.top; |
| 29 |
DWORD nWidth = r.right - r.left; |
| 30 |
|
| 31 |
int nSep[4]; |
| 32 |
|
| 33 |
DWORD nWndSize = nHeight * 2; |
| 34 |
nSep[0] = nWidth - nWndSize*3 - nHeight; |
| 35 |
nSep[1] = nSep[0] + nWndSize; |
| 36 |
nSep[2] = nSep[1] + nWndSize; |
| 37 |
nSep[3] = nSep[2] + nWndSize; |
| 38 |
SendMessage(hStatusBar, SB_SETPARTS, (WPARAM)4, (LPARAM)nSep); |
| 39 |
} |
| 40 |
|
| 41 |
void StatusBar::Show(BOOL bShow) |
| 42 |
{ |
| 43 |
if (bShow) { |
| 44 |
ShowWindow(hStatusBar, SW_SHOW); |
| 45 |
} else { |
| 46 |
ShowWindow(hStatusBar, SW_HIDE); |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
void StatusBar::SetStatusIndicator(DWORD nPos, LPCTSTR pText, BOOL bDisp) |
| 51 |
{ |
| 52 |
LPCTSTR p; |
| 53 |
if (bDisp) { |
| 54 |
p = pText; |
| 55 |
} else { |
| 56 |
p = TEXT(""); |
| 57 |
} |
| 58 |
SendMessage(hStatusBar, SB_SETTEXT, nPos, (LPARAM)p); |
| 59 |
} |
| 60 |
|
| 61 |
WORD StatusBar::GetHeight() |
| 62 |
{ |
| 63 |
RECT rStatus; |
| 64 |
GetWindowRect(&rStatus); |
| 65 |
return (WORD)(rStatus.bottom - rStatus.top); |
| 66 |
} |
| 67 |
|
| 68 |
void StatusBar::SendSize(WPARAM wParam, LPARAM lParam) |
| 69 |
{ |
| 70 |
SendMessage(hStatusBar, WM_SIZE, wParam, lParam); |
| 71 |
} |
| 72 |
|
| 73 |
void StatusBar::GetWindowRect(RECT *p) |
| 74 |
{ |
| 75 |
::GetWindowRect(hStatusBar, p); |
| 76 |
} |
| 77 |
|
| 78 |
#else |
| 79 |
/////////////////////////////////////////////////// |
| 80 |
// non support platform |
| 81 |
/////////////////////////////////////////////////// |
| 82 |
|
| 83 |
BOOL StatusBar::Create(HWND hWnd, BOOL bNew) { return TRUE; } |
| 84 |
void StatusBar::ResizeStatusBar() {} |
| 85 |
void StatusBar::Show(BOOL bShow) {} |
| 86 |
void StatusBar::SetStatusIndicator(DWORD nPos, LPCTSTR pText, BOOL bDisp) {} |
| 87 |
WORD StatusBar::GetHeight() { return 0; } |
| 88 |
void StatusBar::SendSize(WPARAM wParam, LPARAM lParam) {} |
| 89 |
void StatusBar::GetWindowRect(RECT *p) {} |
| 90 |
|
| 91 |
#endif |
| |