clientutil.h
来自「funambol window mobile客户端源代码」· C头文件 代码 · 共 171 行
H
171 行
/*
* Funambol is a mobile platform developed by Funambol, Inc.
* Copyright (C) 2003 - 2007 Funambol, Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by
* the Free Software Foundation with the addition of the following permission
* added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
* WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program 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 Affero General Public License
* along with this program; if not, see http://www.gnu.org/licenses or write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*
* You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite
* 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Powered by Funambol" logo. If the display of the logo is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Powered by Funambol".
*/
#ifndef _INCL_UI_CLIENT_UTIL
#define _INCL_UI_CLIENT_UTIL
#define STRING_MAXLENGTH 300
#define LARGE_INT 32000
#define CLOSE_THIS_DIALOG 222
#define ADJUST_WIDTH 1
#define ADJUST_HEIGHT 2
#define ADJUST_BOTH (ADJUST_WIDTH | ADJUST_HEIGHT)
/**
* the format in which the last sync time appears in the main window,
* used by CTime::Format()
*/
//#define LAST_SYNC_TIME_FORMAT TEXT("%b %#d %#I:%M%p")
/**
* tranforms sync type notation from registry to UI, index pos in listbox
* @param sSyncType : sync type in Registry format
* @return the index where this sync type should be in listbox (starts from 0)
*/
int SynctypeReg2UI(const char* sSyncType);
/**
* tranforms sync type notation from UI to Registry, index pos in listbox
* @param pos : position in listbox (starts from 0)
*/
const char* SynctypeUI2Reg(int nPos);
/**
* checks if the sync is in progress, if yes queries the user if he wants to stop it,
* if the user chooses yes then the sync is stopped
* @param : the window handle of a window to we want to attach the timed msgbox, if NULL the msgbox will have no parent
* @return: -1 if the user chose NO, 0 if the user chose YES, 1 if the sync is not running thus the msgbox wasn't displayed
*/
int EndAppQuery(HWND);
/**
* checks if a folder exists
* @param: the folder to be checked
* @return: TRUE if dir exists, FALSE otherwise
*/
BOOL existsDirectory(wchar_t* dir);
/**
* Modify the window position and size of the specified offset.
* For any parameter, 0 means to not change the current value.
*
* @param wnd the window to modify
* @param x the orizontal offset to add to the position
* @param y the vertical offset to add to the position
* @param cx the orizontal offset to add to the size
* @param cy the vertical offset to add to the size
*
* @return non zero on error (the value returned by CWnd::MoveWindow)
*/
void modifyWindow(CWnd *wnd, int x, int y, int cx = 0, int cy = 0);
/**
* Modify the window size to fit the parent one.
*
* @param wnd the window to modify
* @param opt can be:
* ADJUST_WIDTH
* ADJUST_HEIGHT
* ADJUST_BOTH (default)
* @param lx the orizontal margin from the left border (default to 0)
* @param rx the orizontal margin from the right border (default to 0)
* @param ty the vertical margin from the top border (defaults to 0)
* @param by the vertical margin from the bottom border (defaults to 0)
*
* Examples:
*
* Fits exactly the parent window
* AdjustToParent(wnd);
*
* Fits width of the parent window, with 10 pixel of margin on each side:
* AdjustToParent(wnd, ADJUST_WIDTH, 10, 10);
*
* Fits height of the parent window, with 10 pixel of margin on each side:
* AdjustToParent(wnd, ADJUST_HEIGHT, 0, 0, 10, 10);
*
*/
void adjustToParent(CWnd *wnd, int opt = ADJUST_BOTH,
int lx = 0, int rx = 0, int ty = 0, int by = 0);
/**
* Escape the & char with &&. This is used in label.
* The Resource will have only & char even if it is not completely
* true due to a different display for pocket pc and smartphone.
* The messageBoxes don't need this translation.
* @param the CString to be escaped
* @return the CString escaped
*/
CString escapeAmpString(CString s);
/**
* Draws a line from the point 'start' to the point 'end'.
*
* @param dc the device context where the line should be drawn
* @param start the starting point (x,y)
* @param end the ending point (x,y)
* @param color [OPTIONAL] the color of the line, as a COLORREF (R,G,B) (default = black)
* @param width [OPTIONAL] the width of the line in pixels (default = 1)
* @param penStyle [OPTIONAL] the style of the line, one of:
* PS_SOLID, PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT
* (default = PS_SOLID)
*/
void drawLine(CDC *dc, CPoint& start, CPoint& end, COLORREF color = (0,0,0),
int width = 1, int penStyle = PS_SOLID);
/**
* Enables of disables a desired UI menu button, given its ID.
* @param dialog the HWND of the dialog where the button is
* @param buttonID the ID of the button to enable/disable (IDOK, IDCANCEL, ...)
* @param bEnable true to enable the button, false to disable it
*/
void EnableButton(HWND dialog, int buttonID, bool bEnable);
/**
* Starts a sync only of source "config".
* Reads the config syncmode, if "none" no sync is done. The sync is started
* in a separate process, then we wait on this process and get the exit code.
* Finally, sends a message to the window passed 'lpv' to notify the sync is ended.
*
* @param lpv pointer to the dialog window that called this method (HWND)
*/
DWORD WINAPI configWorker(LPVOID lpv);
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?