ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

taskbarlist.c
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009 Henri Verbeet for CodeWeavers
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  *
00018  */
00019 
00020 #include "config.h"
00021 #include "wine/port.h"
00022 #include "wine/debug.h"
00023 
00024 #include "shdocvw.h"
00025 
00026 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
00027 
00028 struct taskbar_list
00029 {
00030     const struct ITaskbarListVtbl *lpVtbl;
00031     LONG refcount;
00032 };
00033 
00034 /* IUnknown methods */
00035 
00036 static HRESULT STDMETHODCALLTYPE taskbar_list_QueryInterface(ITaskbarList *iface, REFIID riid, void **object)
00037 {
00038     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
00039 
00040     if (IsEqualGUID(riid, &IID_ITaskbarList)
00041             || IsEqualGUID(riid, &IID_IUnknown))
00042     {
00043         IUnknown_AddRef(iface);
00044         *object = iface;
00045         return S_OK;
00046     }
00047 
00048     WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
00049 
00050     *object = NULL;
00051     return E_NOINTERFACE;
00052 }
00053 
00054 static ULONG STDMETHODCALLTYPE taskbar_list_AddRef(ITaskbarList *iface)
00055 {
00056     struct taskbar_list *This = (struct taskbar_list *)iface;
00057     ULONG refcount = InterlockedIncrement(&This->refcount);
00058 
00059     TRACE("%p increasing refcount to %u\n", This, refcount);
00060 
00061     return refcount;
00062 }
00063 
00064 static ULONG STDMETHODCALLTYPE taskbar_list_Release(ITaskbarList *iface)
00065 {
00066     struct taskbar_list *This = (struct taskbar_list *)iface;
00067     ULONG refcount = InterlockedDecrement(&This->refcount);
00068 
00069     TRACE("%p decreasing refcount to %u\n", This, refcount);
00070 
00071     if (!refcount)
00072     {
00073         HeapFree(GetProcessHeap(), 0, This);
00074         SHDOCVW_UnlockModule();
00075     }
00076 
00077     return refcount;
00078 }
00079 
00080 /* ITaskbarList methods */
00081 
00082 static HRESULT STDMETHODCALLTYPE taskbar_list_HrInit(ITaskbarList *iface)
00083 {
00084     TRACE("iface %p\n", iface);
00085 
00086     return S_OK;
00087 }
00088 
00089 static HRESULT STDMETHODCALLTYPE taskbar_list_AddTab(ITaskbarList *iface, HWND hwnd)
00090 {
00091     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
00092 
00093     return E_NOTIMPL;
00094 }
00095 
00096 static HRESULT STDMETHODCALLTYPE taskbar_list_DeleteTab(ITaskbarList *iface, HWND hwnd)
00097 {
00098     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
00099 
00100     return E_NOTIMPL;
00101 }
00102 
00103 static HRESULT STDMETHODCALLTYPE taskbar_list_ActivateTab(ITaskbarList *iface, HWND hwnd)
00104 {
00105     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
00106 
00107     return E_NOTIMPL;
00108 }
00109 
00110 static HRESULT STDMETHODCALLTYPE taskbar_list_SetActiveAlt(ITaskbarList *iface, HWND hwnd)
00111 {
00112     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
00113 
00114     return E_NOTIMPL;
00115 }
00116 
00117 static const struct ITaskbarListVtbl taskbar_list_vtbl =
00118 {
00119     /* IUnknown methods */
00120     taskbar_list_QueryInterface,
00121     taskbar_list_AddRef,
00122     taskbar_list_Release,
00123     /* ITaskbarList methods */
00124     taskbar_list_HrInit,
00125     taskbar_list_AddTab,
00126     taskbar_list_DeleteTab,
00127     taskbar_list_ActivateTab,
00128     taskbar_list_SetActiveAlt,
00129 };
00130 
00131 HRESULT TaskbarList_Create(IUnknown *outer, REFIID riid, void **taskbar_list)
00132 {
00133     struct taskbar_list *object;
00134     HRESULT hr;
00135 
00136     TRACE("outer %p, riid %s, taskbar_list %p\n", outer, debugstr_guid(riid), taskbar_list);
00137 
00138     if (outer)
00139     {
00140         WARN("Aggregation not supported\n");
00141         *taskbar_list = NULL;
00142         return CLASS_E_NOAGGREGATION;
00143     }
00144 
00145     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
00146     if (!object)
00147     {
00148         ERR("Failed to allocate taskbar list object memory\n");
00149         *taskbar_list = NULL;
00150         return E_OUTOFMEMORY;
00151     }
00152 
00153     object->lpVtbl = &taskbar_list_vtbl;
00154     object->refcount = 0;
00155 
00156     TRACE("Created ITaskbarList %p\n", object);
00157 
00158     hr = ITaskbarList_QueryInterface((ITaskbarList *)object, riid, taskbar_list);
00159     if (FAILED(hr))
00160     {
00161         HeapFree(GetProcessHeap(), 0, object);
00162         return hr;
00163     }
00164 
00165     SHDOCVW_LockModule();
00166 
00167     return S_OK;
00168 }

Generated on Mon May 28 2012 04:25:55 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.