aboutsummaryrefslogtreecommitdiff
path: root/src/gui
ModeNameSize
-rw-r--r--CMakeLists.txt663logplain
-rw-r--r--guiChatConsole.cpp16581logplain
-rw-r--r--guiChatConsole.h3965logplain
-rw-r--r--guiConfirmRegistration.cpp7241logplain
-rw-r--r--guiConfirmRegistration.h1863logplain
-rw-r--r--guiEditBoxWithScrollbar.cpp40726logplain
-rw-r--r--guiEditBoxWithScrollbar.h6499logplain
-rw-r--r--guiEngine.cpp16867logplain
-rw-r--r--guiEngine.h8876logplain
-rw-r--r--guiFormSpecMenu.cpp105169logplain
-rw-r--r--guiFormSpecMenu.h14432logplain
-rw-r--r--guiKeyChangeMenu.cpp13593logplain
-rw-r--r--guiKeyChangeMenu.h2044logplain
-rw-r--r--guiMainMenu.h1514logplain
-rw-r--r--guiPasswordChange.cpp7502logplain
-rw-r--r--guiPasswordChange.h1657logplain
-rw-r--r--guiPathSelectMenu.cpp3034logplain
-rw-r--r--guiPathSelectMenu.h1724logplain
-rw-r--r--guiTable.cpp34848logplain
-rw-r--r--guiTable.h7316logplain
-rw-r--r--guiVolumeChange.cpp5420logplain
-rw-r--r--guiVolumeChange.h1516logplain
-rw-r--r--intlGUIEditBox.cpp36803logplain
-rw-r--r--intlGUIEditBox.h6702logplain
-rw-r--r--mainmenumanager.h3511logplain
-rw-r--r--modalMenu.cpp7751logplain
-rw-r--r--modalMenu.h2423logplain
-rw-r--r--profilergraph.cpp4570logplain
-rw-r--r--profilergraph.h1553logplain
-rw-r--r--touchscreengui.cpp36930logplain
-rw-r--r--touchscreengui.h7481logplain
opt">} bool operator==(T *t) { return ptr == t; } T & operator[](unsigned int i) { return ptr[i]; } private: void drop() { assert((*refcount) > 0); (*refcount)--; if(*refcount == 0) { delete refcount; if(ptr != NULL) delete ptr; } } T *ptr; int *refcount; }; template <typename T> class Buffer { public: Buffer() { m_size = 0; data = NULL; } Buffer(unsigned int size) { m_size = size; if(size != 0) data = new T[size]; else data = NULL; } Buffer(const Buffer &buffer) { m_size = buffer.m_size; if(m_size != 0) { data = new T[buffer.m_size]; memcpy(data, buffer.data, buffer.m_size); } else data = NULL; } Buffer(const T *t, unsigned int size) { m_size = size; if(size != 0) { data = new T[size]; memcpy(data, t, size); } else data = NULL; } ~Buffer() { drop(); } Buffer& operator=(const Buffer &buffer) { if(this == &buffer) return *this; drop(); m_size = buffer.m_size; if(m_size != 0) { data = new T[buffer.m_size]; memcpy(data, buffer.data, buffer.m_size); } else data = NULL; return *this; } T & operator[](unsigned int i) const { return data[i]; } T * operator*() const { return data; } unsigned int getSize() const { return m_size; } private: void drop() { if(data) delete[] data; } T *data; unsigned int m_size; }; template <typename T> class SharedBuffer { public: SharedBuffer() { m_size = 0; data = NULL; refcount = new unsigned int; (*refcount) = 1; } SharedBuffer(unsigned int size) { m_size = size; if(m_size != 0) data = new T[m_size]; else data = NULL; refcount = new unsigned int; memset(data,0,sizeof(T)*m_size); (*refcount) = 1; } SharedBuffer(const SharedBuffer &buffer) { //std::cout<<"SharedBuffer(const SharedBuffer &buffer)"<<std::endl; m_size = buffer.m_size; data = buffer.data; refcount = buffer.refcount; (*refcount)++; } SharedBuffer & operator=(const SharedBuffer & buffer) { //std::cout<<"SharedBuffer & operator=(const SharedBuffer & buffer)"<<std::endl; if(this == &buffer) return *this; drop(); m_size = buffer.m_size; data = buffer.data; refcount = buffer.refcount; (*refcount)++; return *this; } /* Copies whole buffer */ SharedBuffer(const T *t, unsigned int size) { m_size = size; if(m_size != 0) { data = new T[m_size]; memcpy(data, t, m_size); } else data = NULL; refcount = new unsigned int; (*refcount) = 1; } /* Copies whole buffer */ SharedBuffer(const Buffer<T> &buffer) { m_size = buffer.getSize(); if(m_size != 0) { data = new T[m_size]; memcpy(data, *buffer, buffer.getSize()); } else data = NULL; refcount = new unsigned int; (*refcount) = 1; } ~SharedBuffer() { drop(); } T & operator[](unsigned int i) const { //assert(i < m_size) return data[i]; } T * operator*() const { return data; } unsigned int getSize() const { return m_size; } operator Buffer<T>() const { return Buffer<T>(data, m_size); } private: void drop() { assert((*refcount) > 0); (*refcount)--; if(*refcount == 0) { if(data) delete[] data; delete refcount; } } T *data; unsigned int m_size; unsigned int *refcount; }; inline SharedBuffer<u8> SharedBufferFromString(const char *string) { SharedBuffer<u8> b((u8*)string, strlen(string)+1); return b; } #endif