29 #include "../../idlib/precompiled.h"
32 #include "../../sys/win32/win_local.h"
77 RECT clientRect, rect;
79 dialog->GetWindowRect( &clientRect );
80 point.x += clientRect.left;
81 point.y += clientRect.top;
82 for (
int i = 0; toolTips[
i].
tip;
i++ ) {
83 wnd = dialog->GetDlgItem( toolTips[
i].
id );
84 if ( !( wnd->GetStyle() & WS_VISIBLE ) ) {
87 wnd->GetWindowRect( &rect );
88 if ( point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom ) {
89 pTI->hwnd = dialog->GetSafeHwnd();
90 pTI->uFlags |= TTF_IDISHWND;
91 pTI->uFlags &= ~TTF_CENTERTIP;
92 pTI->uId = (UINT_PTR) wnd->GetSafeHwnd();
106 TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
107 TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
111 UINT nID = pNMHDR->idFrom;
112 if ( pTTTA->uFlags & TTF_IDISHWND ) {
114 nID = ::GetDlgCtrlID((HWND)nID);
118 for ( i = 0; toolTips[
i].
tip; i++ ) {
119 if ( toolTips[i].
id == nID ) {
124 if ( !toolTips[i].tip ) {
128 if ( pNMHDR->code == TTN_NEEDTEXTA ) {
129 lstrcpyn( pTTTA->szText, toolTips[i].
tip,
sizeof(pTTTA->szText) );
131 _mbstowcsz( pTTTW->szText, toolTips[i].
tip,
sizeof(pTTTW->szText) );
155 CString strIn, strOut;
156 if ( edit->GetLineCount() > 1 ) {
157 edit->GetWindowText( strIn );
158 for (
int i = 0;
i < strIn.GetLength();
i++ ) {
159 if ( strIn[
i] >=
' ' ) {
160 strOut.AppendChar( strIn[
i] );
163 edit->SetWindowText( strOut );
164 edit->SetSel( 0, strOut.GetLength() );
177 CString strIn, strOut;
181 edit->GetSel( start, end );
182 edit->GetWindowText( strIn );
183 for (
int i = 0;
i < strIn.GetLength();
i++ ) {
185 if ( allowNegative && strOut.GetLength() == 0 && strIn[
i] ==
'-' ) {
186 strOut.AppendChar(
'-' );
189 else if ( !dot && strIn[
i] ==
'.' ) {
190 strOut.AppendChar( strIn[
i] );
193 else if ( strIn[
i] >=
'0' && strIn[
i] <=
'9' ) {
194 strOut.AppendChar( strIn[
i] );
197 edit->SetWindowText( strOut );
198 edit->SetSel( start, end );
200 return atof(strOut.GetBuffer(0));
210 int i, dotIndex = -1, digitIndex = -1;
212 for ( i = 0; str[
i]; i++ ) {
213 if ( str[i] ==
'.' ) {
214 if ( dotIndex == -1 ) {
218 else if ( str[i] !=
'0' ) {
219 if ( digitIndex == -1 ) {
224 if ( digitIndex == -1 ) {
225 str.SetString(
"1" );
229 if ( dotIndex != -1 ) {
230 str.Delete( dotIndex, 1 );
231 if ( digitIndex > dotIndex ) {
240 if ( str[digitIndex] ==
'9' ) {
241 str.SetAt( digitIndex,
'0' );
242 if ( digitIndex == 0 ) {
243 str.Insert( 0,
'1' );
247 str.SetAt( digitIndex-1,
'1' );
251 str.SetAt( digitIndex, str[digitIndex] + 1 );
255 if ( str[digitIndex] ==
'1' ) {
256 if ( str[digitIndex+1] ==
'\0' ) {
257 str.SetAt( digitIndex,
'0' );
258 str.AppendChar(
'9' );
260 else if ( str[digitIndex+1] ==
'0' ) {
261 str.SetAt( digitIndex,
'0' );
262 str.SetAt( digitIndex+1,
'9' );
265 str.SetAt( digitIndex+1, str[digitIndex+1] - 1 );
269 str.SetAt( digitIndex, str[digitIndex] - 1 );
272 if ( dotIndex < str.GetLength() ) {
273 str.Insert( dotIndex,
'.' );
275 for ( i = str.GetLength()-1; i >= 0; i-- ) {
276 if ( str[i] !=
'0' && str[i] !=
'.' ) {
280 if ( i < str.GetLength() - 1 ) {
281 str.Delete( i+1, str.GetLength() -
i );
284 for ( i = 0; str[
i]; i++ ) {
285 if ( str[i] ==
'.' ) {
287 str.Delete( 0, i-1 );
291 if ( str[i] !=
'0' ) {
308 edit->GetWindowText( str );
310 edit->SetWindowText( str );
322 index = combo->FindString( -1,
string );
326 if ( combo->GetCount() != 0 ) {
327 if ( index == skip ) {
328 index = ( skip + 1 ) % combo->GetCount();
330 combo->SetCurSel( index );
344 index = combo->GetCurSel();
345 if ( index == CB_ERR ) {
348 if ( combo->GetCount() != 0 ) {
349 if ( index == skip ) {
350 index = ( skip + 1 ) % combo->GetCount();
352 combo->GetLBText( index,
string );
369 skip = combo->FindString( -1,
string );
370 index = combo->GetCurSel();
371 if ( index == CB_ERR ) {
374 if ( combo->GetCount() != 0 ) {
375 if ( index == skip ) {
376 index = ( skip + 1 ) % combo->GetCount();
378 combo->SetCurSel( index );
BOOL DefaultOnToolTipNotify(const toolTip_t *toolTips, UINT id, NMHDR *pNMHDR, LRESULT *pResult)
int SetSafeComboBoxSelection(CComboBox *combo, const char *string, int skip)
CONST PIXELFORMATDESCRIPTOR UINT
void SpinFloatString(CString &str, bool up)
int DefaultOnToolHitTest(const toolTip_t *toolTips, const CDialog *dialog, CPoint point, TOOLINFO *pTI)
int UnsetSafeComboBoxSelection(CComboBox *combo, CString &string)
bool EditControlEnterHit(CEdit *edit)
int GetSafeComboBoxSelection(CComboBox *combo, CString &string, int skip)
float EditSpinFloat(CEdit *edit, bool up)
float dot(float a[], float b[])
float EditVerifyFloat(CEdit *edit, bool allowNegative)