Skip to content

Commit

Permalink
Move a simple assignment to the constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Feb 23, 2024
1 parent 027e6f0 commit 90f6bfe
Show file tree
Hide file tree
Showing 12 changed files with 878 additions and 889 deletions.
5 changes: 2 additions & 3 deletions demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
int main()
{
using namespace fluent_tray ;
FluentTray tray{} ;
FluentTray tray(5, 5, 10, 5) ;
if(!tray.create_tray(
"demo", "demo/assets/icon.ico",
5, 5, 10, 5, 240, true)) {
"demo", "demo/assets/icon.ico", 240, true)) {
return 1 ;
}

Expand Down
4 changes: 2 additions & 2 deletions docs/classfluent__tray_1_1_fluent_tray-members.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@
<tr class="even"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#a9374619a46a4084eb0101648e039f553">cend</a>() const noexcept</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#a6833da7c8fb8bb3d27470aa45af6b157">change_icon</a>(const std::string &amp;icon_path)</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#a6e7ec8d9589d3b1fdb14885349f8daec">count_menus</a>() const noexcept</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#a1ce960696567087f55044e711ed4ef21">create_tray</a>(const std::string &amp;app_name, const std::string &amp;icon_path=&quot;&quot;, LONG menu_x_margin=5, LONG menu_y_margin=5, LONG menu_x_pad=10, LONG menu_y_pad=5, unsigned char opacity=255, bool round_corner=true)</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#af7428f277fb0061101367ef3d1e084ba">create_tray</a>(const std::string &amp;app_name, const std::string &amp;icon_path=&quot;&quot;, unsigned char opacity=255, bool round_corner=true)</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#a0e64e2f5bea8af804f3c38502fb20346">end</a>() noexcept</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#a63a9dd95b682b2a0ff45b4c7e3dd5877">FluentTray</a>(int message_id_offset=25, int autocolorpick_offset=5, unsigned char autofadedborder_from_backcolor=10)</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">explicit</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#af8f0e2ea4e4c511b3afbd3e7469f46aa">FluentTray</a>(LONG menu_x_margin=5, LONG menu_y_margin=5, LONG menu_x_pad=10, LONG menu_y_pad=5, unsigned char autofadedborder_from_backcolor=10, int autocolorpick_offset=5, int message_id_offset=25)</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">explicit</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#ac538f9a69ab74ead314a5004f717080f">FluentTray</a>(const FluentTray &amp;)=delete</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#adc5d4b971a378080dea22225c0a8e3a1">FluentTray</a>(FluentTray &amp;&amp;)=default</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html#acd10bcf8769e9851026dd1302323cc90">front</a>()</td><td class="entry"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">fluent_tray::FluentTray</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
Expand Down
76 changes: 38 additions & 38 deletions docs/classfluent__tray_1_1_fluent_tray.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a63a9dd95b682b2a0ff45b4c7e3dd5877" id="r_a63a9dd95b682b2a0ff45b4c7e3dd5877"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a63a9dd95b682b2a0ff45b4c7e3dd5877">FluentTray</a> (int message_id_offset=25, int autocolorpick_offset=5, unsigned char autofadedborder_from_backcolor=10)</td></tr>
<tr class="memdesc:a63a9dd95b682b2a0ff45b4c7e3dd5877"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create tray object. <br /></td></tr>
<tr class="separator:a63a9dd95b682b2a0ff45b4c7e3dd5877"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af8f0e2ea4e4c511b3afbd3e7469f46aa" id="r_af8f0e2ea4e4c511b3afbd3e7469f46aa"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af8f0e2ea4e4c511b3afbd3e7469f46aa">FluentTray</a> (LONG menu_x_margin=5, LONG menu_y_margin=5, LONG menu_x_pad=10, LONG menu_y_pad=5, unsigned char autofadedborder_from_backcolor=10, int autocolorpick_offset=5, int message_id_offset=25)</td></tr>
<tr class="memdesc:af8f0e2ea4e4c511b3afbd3e7469f46aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create tray object. <br /></td></tr>
<tr class="separator:af8f0e2ea4e4c511b3afbd3e7469f46aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac538f9a69ab74ead314a5004f717080f" id="r_ac538f9a69ab74ead314a5004f717080f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac538f9a69ab74ead314a5004f717080f">FluentTray</a> (const <a class="el" href="classfluent__tray_1_1_fluent_tray.html">FluentTray</a> &amp;)=delete</td></tr>
<tr class="separator:ac538f9a69ab74ead314a5004f717080f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1b6b94997f7fe0161e52adc583411b24" id="r_a1b6b94997f7fe0161e52adc583411b24"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classfluent__tray_1_1_fluent_tray.html">FluentTray</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a1b6b94997f7fe0161e52adc583411b24">operator=</a> (const <a class="el" href="classfluent__tray_1_1_fluent_tray.html">FluentTray</a> &amp;)=delete</td></tr>
Expand All @@ -105,9 +105,9 @@
<tr class="separator:a2c09e0d56e7b0a2100dfd1330405c449"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a08af8b2acf71cea22983b2e45151046b" id="r_a08af8b2acf71cea22983b2e45151046b"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a08af8b2acf71cea22983b2e45151046b">~FluentTray</a> () noexcept</td></tr>
<tr class="separator:a08af8b2acf71cea22983b2e45151046b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1ce960696567087f55044e711ed4ef21" id="r_a1ce960696567087f55044e711ed4ef21"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a1ce960696567087f55044e711ed4ef21">create_tray</a> (const std::string &amp;app_name, const std::string &amp;icon_path=&quot;&quot;, LONG menu_x_margin=5, LONG menu_y_margin=5, LONG menu_x_pad=10, LONG menu_y_pad=5, unsigned char opacity=255, bool round_corner=true)</td></tr>
<tr class="memdesc:a1ce960696567087f55044e711ed4ef21"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize tray and create icon on tray. <br /></td></tr>
<tr class="separator:a1ce960696567087f55044e711ed4ef21"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af7428f277fb0061101367ef3d1e084ba" id="r_af7428f277fb0061101367ef3d1e084ba"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af7428f277fb0061101367ef3d1e084ba">create_tray</a> (const std::string &amp;app_name, const std::string &amp;icon_path=&quot;&quot;, unsigned char opacity=255, bool round_corner=true)</td></tr>
<tr class="memdesc:af7428f277fb0061101367ef3d1e084ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize tray and create icon on tray. <br /></td></tr>
<tr class="separator:af7428f277fb0061101367ef3d1e084ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a32afb7010725031f3242e0c51c56a4ad" id="r_a32afb7010725031f3242e0c51c56a4ad"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a32afb7010725031f3242e0c51c56a4ad">add_menu</a> (const std::string &amp;label_text=&quot;&quot;, const std::string &amp;icon_path=&quot;&quot;, bool toggleable=false, const std::string &amp;checkmark=&quot;✓&quot;, const std::function&lt; bool(void)&gt; &amp;callback=[] {return true ;}, const std::function&lt; bool(void)&gt; &amp;unchecked_callback=[] {return true ;})</td></tr>
<tr class="memdesc:a32afb7010725031f3242e0c51c56a4ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a menu in order from the top. <br /></td></tr>
<tr class="separator:a32afb7010725031f3242e0c51c56a4ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
Expand Down Expand Up @@ -178,8 +178,8 @@
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Class with information on the entire tray. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a63a9dd95b682b2a0ff45b4c7e3dd5877" name="a63a9dd95b682b2a0ff45b4c7e3dd5877"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a63a9dd95b682b2a0ff45b4c7e3dd5877">&#9670;&#160;</a></span>FluentTray() <span class="overload">[1/3]</span></h2>
<a id="af8f0e2ea4e4c511b3afbd3e7469f46aa" name="af8f0e2ea4e4c511b3afbd3e7469f46aa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af8f0e2ea4e4c511b3afbd3e7469f46aa">&#9670;&#160;</a></span>FluentTray() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
Expand All @@ -190,7 +190,27 @@ <h2 class="memtitle"><span class="permalink"><a href="#a63a9dd95b682b2a0ff45b4c7
<tr>
<td class="memname">fluent_tray::FluentTray::FluentTray </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>message_id_offset</em><span class="paramdefsep"> = </span><span class="paramdefval">25</span>, </span></td>
<td class="paramtype">LONG</td> <td class="paramname"><span class="paramname"><em>menu_x_margin</em><span class="paramdefsep"> = </span><span class="paramdefval">5</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">LONG</td> <td class="paramname"><span class="paramname"><em>menu_y_margin</em><span class="paramdefsep"> = </span><span class="paramdefval">5</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">LONG</td> <td class="paramname"><span class="paramname"><em>menu_x_pad</em><span class="paramdefsep"> = </span><span class="paramdefval">10</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">LONG</td> <td class="paramname"><span class="paramname"><em>menu_y_pad</em><span class="paramdefsep"> = </span><span class="paramdefval">5</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned char</td> <td class="paramname"><span class="paramname"><em>autofadedborder_from_backcolor</em><span class="paramdefsep"> = </span><span class="paramdefval">10</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
Expand All @@ -200,7 +220,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#a63a9dd95b682b2a0ff45b4c7
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned char</td> <td class="paramname"><span class="paramname"><em>autofadedborder_from_backcolor</em><span class="paramdefsep"> = </span><span class="paramdefval">10</span></span>&#160;)</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>message_id_offset</em><span class="paramdefsep"> = </span><span class="paramdefval">25</span></span>&#160;)</td>
</tr>
</table>
</td>
Expand All @@ -213,9 +233,13 @@ <h2 class="memtitle"><span class="permalink"><a href="#a63a9dd95b682b2a0ff45b4c7
<p>Create tray object. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">message_id_offset</td><td>Unique message identifier. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">autocolorpick_offset</td><td>Pixel offset to determine the background color. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">menu_x_margin</td><td>Horizontal margins outside menus. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">menu_y_margin</td><td>Vertical margins outside menus. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">menu_x_pad</td><td>Horizontal paddings inside menus. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">menu_y_pad</td><td>Vertical paddings inside menus. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">autofadedborder_from_backcolor</td><td>Decay value from the background color to determine the background color of the currently selected menu and the color of the separator line. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">autocolorpick_offset</td><td>Pixel offset to determine the background color. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">message_id_offset</td><td>Unique message identifier. </td></tr>
</table>
</dd>
</dl>
Expand Down Expand Up @@ -584,8 +608,8 @@ <h2 class="memtitle"><span class="permalink"><a href="#a6e7ec8d9589d3b1fdb148853

</div>
</div>
<a id="a1ce960696567087f55044e711ed4ef21" name="a1ce960696567087f55044e711ed4ef21"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1ce960696567087f55044e711ed4ef21">&#9670;&#160;</a></span>create_tray()</h2>
<a id="af7428f277fb0061101367ef3d1e084ba" name="af7428f277fb0061101367ef3d1e084ba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af7428f277fb0061101367ef3d1e084ba">&#9670;&#160;</a></span>create_tray()</h2>

<div class="memitem">
<div class="memproto">
Expand All @@ -603,26 +627,6 @@ <h2 class="memtitle"><span class="permalink"><a href="#a1ce960696567087f55044e71
<td></td>
<td class="paramtype">const std::string &amp;</td> <td class="paramname"><span class="paramname"><em>icon_path</em><span class="paramdefsep"> = </span><span class="paramdefval">&quot;&quot;</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">LONG</td> <td class="paramname"><span class="paramname"><em>menu_x_margin</em><span class="paramdefsep"> = </span><span class="paramdefval">5</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">LONG</td> <td class="paramname"><span class="paramname"><em>menu_y_margin</em><span class="paramdefsep"> = </span><span class="paramdefval">5</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">LONG</td> <td class="paramname"><span class="paramname"><em>menu_x_pad</em><span class="paramdefsep"> = </span><span class="paramdefval">10</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">LONG</td> <td class="paramname"><span class="paramname"><em>menu_y_pad</em><span class="paramdefsep"> = </span><span class="paramdefval">5</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
Expand All @@ -646,10 +650,6 @@ <h2 class="memtitle"><span class="permalink"><a href="#a1ce960696567087f55044e71
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">app_name</td><td>The application name to be displayed as tooltip text. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">icon_path</td><td>A UTF-8 encoded path to the icon to be displayed in the system tray. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">menu_x_margin</td><td>Horizontal margins outside menus. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">menu_y_margin</td><td>Vertical margins outside menus. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">menu_x_pad</td><td>Horizontal paddings inside menus. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">menu_y_pad</td><td>Vertical paddings inside menus. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">opacity</td><td>Menu opacity from 0 to 255. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">round_corner</td><td>Option to round the corners of the menu window (Windows 11 only) </td></tr>
</table>
Expand Down
Loading

0 comments on commit 90f6bfe

Please sign in to comment.