00001 //================================================================================================== 00002 // Copyright (C) 2010 Brian Tietz sdbtietz at yahoo dot com 00003 // 00004 // This program is free software; you can redistribute it and/or modify it under the terms of the 00005 // GNU General Public License as published by the Free Software Foundation, version 2.0 of the 00006 // License. 00007 // 00008 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 00009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00010 // General Public License for more details. 00011 // 00012 // You should have received a copy of the GNU General Public License along with this program; if 00013 // not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00014 // 02110-1301, USA. 00015 // 00016 // For commercial software, the copyright holder (Brian Tietz, email sdbtietz at yahoo dot com) 00017 // reserves the right and is willing to waive the proprietary source code disclosure aspects of that 00018 // license as applied to the UT library in exchange for either substantial contributions to the 00019 // development of the UT library or other forms of compensation. Any such waiver must be 00020 // established in writing between the copyright holder and the commercial entity obtaining such a 00021 // waiver. 00022 //================================================================================================== 00023 00024 00025 //================================================================================================== 00026 //=== Project headers 00027 //================================================================================================== 00028 #include "UTMenu.h" 00029 #include "UTGUIPoolAllocator.h" 00030 00031 00032 //================================================================================================== 00033 //=== Forward name declarations 00034 //================================================================================================== 00035 class Menu_t; 00036 class MenuNode_t; 00037 00038 00039 // \cond DOXYGEN_DOCUMENT_NEVER 00040 00041 //================================================================================================== 00042 class MergedMenuNode_t 00043 //================================================================================================== 00044 : public LinkedListNode_t<MergedMenuNode_t> 00045 { 00046 //---------------------------------------------------------------------------------------------- 00047 public: 00048 //---------------------------------------------------------------------------------------------- 00049 inline MergedMenuNode_t(); 00050 inline MergedMenuNode_t(MenuNode_t* real_node); 00051 inline ~MergedMenuNode_t(); 00052 00053 void MakeEmpty(); 00054 00055 void Merge( Menu_t* app_menu, 00056 Menu_t* win_menu, 00057 bool menus_only ); 00058 00059 inline int CountItems() const; 00060 inline MergedMenuNode_t* Head() const; 00061 00062 inline void* operator new(size_t size); 00063 inline void operator delete(void* block); 00064 00065 //---------------------------------------------------------------------------------------------- 00066 private: 00067 //---------------------------------------------------------------------------------------------- 00068 MenuNode_t* m_real_node; 00069 uint m_real_node_token; 00070 OwnedLinkedList_t<MergedMenuNode_t> m_contents; 00071 00072 friend class MenuBar_t; 00073 }; 00074 00075 00076 00077 00078 //================================================================================================== 00079 //================================================================================================== 00080 //=== 00081 //=== Inline function implementations 00082 //=== 00083 //================================================================================================== 00084 //================================================================================================== 00085 inline 00086 MergedMenuNode_t::MergedMenuNode_t() 00087 { 00088 m_real_node = NULL; 00089 m_real_node_token = 0; 00090 } 00091 00092 00093 inline 00094 MergedMenuNode_t::MergedMenuNode_t(MenuNode_t* real_node) 00095 { 00096 m_real_node = real_node; 00097 m_real_node_token = real_node->m_token; 00098 } 00099 00100 00101 inline 00102 MergedMenuNode_t::~MergedMenuNode_t() 00103 { 00104 // Nothing to do 00105 } 00106 00107 00108 inline int 00109 MergedMenuNode_t::CountItems() const 00110 { 00111 return m_contents.CountItems(); 00112 } 00113 00114 00115 inline MergedMenuNode_t* 00116 MergedMenuNode_t::Head() const 00117 { 00118 return m_contents.Head(); 00119 } 00120 00121 00122 inline void* 00123 MergedMenuNode_t::operator new(size_t size) 00124 { 00125 return g_gui_pool_allocator.Allocate(size); 00126 } 00127 00128 00129 inline void 00130 MergedMenuNode_t::operator delete(void* block) 00131 { 00132 g_gui_pool_allocator.Release(block); 00133 } 00134 00135 00136 // \endcond