[ttssh2-commit] [10368] tipwin2にAPI追加

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 11月 19日 (土) 20:20:02 JST


Revision: 10368
          https://osdn.net/projects/ttssh2/scm/svn/commits/10368
Author:   zmatsuo
Date:     2022-11-19 20:20:01 +0900 (Sat, 19 Nov 2022)
Log Message:
-----------
tipwin2にAPI追加

- tipを削除と有効/無効化
- コメント追加
- メモリリーク検出が簡単にできるよう修正

Modified Paths:
--------------
    trunk/teraterm/common/tipwin2.cpp
    trunk/teraterm/common/tipwin2.h

-------------- next part --------------
Modified: trunk/teraterm/common/tipwin2.cpp
===================================================================
--- trunk/teraterm/common/tipwin2.cpp	2022-11-19 02:28:11 UTC (rev 10367)
+++ trunk/teraterm/common/tipwin2.cpp	2022-11-19 11:20:01 UTC (rev 10368)
@@ -31,6 +31,10 @@
  */
 #include <windows.h>
 #include <commctrl.h>
+#define _CRTDBG_MAP_ALLOC
+#include <stdlib.h>
+#include <crtdbg.h>
+#include <assert.h>
 
 #include "tipwin2.h"
 
@@ -70,6 +74,10 @@
 
 void TipWin2Destroy(TipWin2 *tWin)
 {
+	if (tWin == NULL) {
+		assert(FALSE);
+		return;
+	}
 	DestroyWindow(tWin->hTip);
 	tWin->hTip = NULL;
 	free(tWin);
@@ -76,10 +84,11 @@
 }
 
 /**
- * @brief \x83c\x81[\x83\x8B\x83`\x83b\x83v\x82\xF0\x93o\x98^\x82\xB7\x82\xE9
- * @param tWin
- * @param id \x83_\x83C\x83A\x83\x8D\x83O\x82̃R\x83\x93\x83g\x83\x8D\x81[\x83\x8BID
- * @param text \x83c\x81[\x83\x8B\x83`\x83b\x83v
+ * @brief	\x83c\x81[\x83\x8B\x83`\x83b\x83v\x82\xF0\x93o\x98^\x82\xB7\x82\xE9
+ * @param	tWin
+ * @param	id \x83_\x83C\x83A\x83\x8D\x83O\x82̃R\x83\x93\x83g\x83\x8D\x81[\x83\x8BID
+ * @param	text \x83c\x81[\x83\x8B\x83`\x83b\x83v
+ *			NULL\x82̂Ƃ\xAB\x93o\x98^\x8D폜
  */
 void TipWin2SetTextW(TipWin2 *tWin, int id, const wchar_t *text)
 {
@@ -91,3 +100,32 @@
 	toolInfo.lpszText = (LPWSTR)text;	// text \x82\xCD SendMessage() \x8E\x9E\x82ɑ\xB6\x8D݂\xB7\x82\xEA\x82Ηǂ\xA2
 	SendMessageW(tWin->hTip, TTM_ADDTOOLW, 0, (LPARAM)&toolInfo);
 }
+
+/**
+ * @brief \x83c\x81[\x83\x8B\x83`\x83b\x83v\x82\xF0\x8D폜\x82\xB7\x82\xE9
+ * @param tWin
+ * @param id \x83_\x83C\x83A\x83\x8D\x83O\x82̃R\x83\x93\x83g\x83\x8D\x81[\x83\x8BID
+ *
+ *	\x8D폜\x82ł\xAB\x82Ȃ\xA2\x82\xB1\x82Ƃ\xAA\x82\xA0\x82\xE9?
+ *	TipWin2SetTextW() \x82\xCC text = NULL \x82\xF0\x8Eg\x97p\x82\xB5\x82\xBD\x82ق\xA4\x82\xAA\x82悳\x82\xBB\x82\xA4
+ */
+void TipWin2Delete(TipWin2 *tWin, int id)
+{
+	TOOLINFOW toolInfo = {};
+	toolInfo.cbSize = sizeof(toolInfo);
+	toolInfo.hwnd = tWin->hDlg;
+	toolInfo.uFlags = TTF_IDISHWND;
+	toolInfo.uId = (UINT_PTR)GetDlgItem(tWin->hDlg, id);
+	PostMessageW(tWin->hTip, TTM_DELTOOLW, 0, (LPARAM)&toolInfo);
+}
+
+/**
+ * @brief \x83c\x81[\x83\x8B\x83`\x83b\x83v\x82\xF0\x97L\x8C\xF8/\x96\xB3\x8C\x{27B0B7}\x82\xE9
+ * @param tWin
+ *
+ *	\x93\xC1\x92\xE8\x82̃R\x83\x93\x83g\x83\x8D\x81[\x83\x8B\x82ɐݒ肷\x82邱\x82Ƃ͂ł\xAB\x82Ȃ\xA2
+ */
+void TipWin2Activate(TipWin2 *tWin, BOOL active)
+{
+	PostMessageW(tWin->hTip, TTM_ACTIVATE ,active, 0);
+}

Modified: trunk/teraterm/common/tipwin2.h
===================================================================
--- trunk/teraterm/common/tipwin2.h	2022-11-19 02:28:11 UTC (rev 10367)
+++ trunk/teraterm/common/tipwin2.h	2022-11-19 11:20:01 UTC (rev 10368)
@@ -39,6 +39,8 @@
 TipWin2 *TipWin2Create(HINSTANCE hInstance, HWND hDlg);
 void TipWin2Destroy(TipWin2 *tWin);
 void TipWin2SetTextW(TipWin2 *tWin, int id, const wchar_t *text);
+void TipWin2Delete(TipWin2 *tWin, int id);
+void TipWin2Activate(TipWin2 *tWin, BOOL active);
 
 #ifdef __cplusplus
 }


ttssh2-commit メーリングリストの案内
Back to archive index