Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
ImGuiStorage Struct Reference

#include <src/imgui/imgui.h>

+ Collaboration diagram for ImGuiStorage:

Classes

struct  ImGuiStoragePair
 
union  ImGuiStoragePair.__unnamed674__
 

Public Member Functions

void Clear ()
 
IMGUI_API int GetInt (ImGuiID key, int default_val=0) const
 
IMGUI_API void SetInt (ImGuiID key, int val)
 
IMGUI_API bool GetBool (ImGuiID key, bool default_val=false) const
 
IMGUI_API void SetBool (ImGuiID key, bool val)
 
IMGUI_API float GetFloat (ImGuiID key, float default_val=0.0f) const
 
IMGUI_API void SetFloat (ImGuiID key, float val)
 
IMGUI_API voidGetVoidPtr (ImGuiID key) const
 
IMGUI_API void SetVoidPtr (ImGuiID key, void *val)
 
IMGUI_API int * GetIntRef (ImGuiID key, int default_val=0)
 
IMGUI_API bool * GetBoolRef (ImGuiID key, bool default_val=false)
 
IMGUI_API float * GetFloatRef (ImGuiID key, float default_val=0.0f)
 
IMGUI_API void ** GetVoidPtrRef (ImGuiID key, void *default_val=NULL)
 
IMGUI_API void SetAllInt (int val)
 
IMGUI_API void BuildSortByKey ()
 

Public Attributes

ImVector< ImGuiStoragePairData
 

Detailed Description


Class Documentation

◆ ImGuiStorage::ImGuiStoragePair.__unnamed674__

union ImGuiStorage::ImGuiStoragePair.__unnamed674__
Class Members
float val_f
int val_i
void * val_p

Member Function Documentation

◆ BuildSortByKey()

void ImGuiStorage::BuildSortByKey ( )
1900{
1901 struct StaticFunc
1902 {
1903 static int IMGUI_CDECL PairCompareByID(const void* lhs, const void* rhs)
1904 {
1905 // We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.
1906 if (((const ImGuiStoragePair*)lhs)->key > ((const ImGuiStoragePair*)rhs)->key) return +1;
1907 if (((const ImGuiStoragePair*)lhs)->key < ((const ImGuiStoragePair*)rhs)->key) return -1;
1908 return 0;
1909 }
1910 };
1911 if (Data.Size > 1)
1912 ImQsort(Data.Data, (size_t)Data.Size, sizeof(ImGuiStoragePair), StaticFunc::PairCompareByID);
1913}
#define IMGUI_CDECL
Definition imgui_demo.cpp:163
#define ImQsort
Definition imgui_internal.h:292
ImVector< ImGuiStoragePair > Data
Definition imgui.h:2089

References Data, IMGUI_CDECL, and ImQsort.

◆ Clear()

void ImGuiStorage::Clear ( )
inline
2094{ Data.clear(); }

References ImVector< T >::clear().

Referenced by ImPool< T >::Clear(), and ImGui::Shutdown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBool()

bool ImGuiStorage::GetBool ( ImGuiID  key,
bool  default_val = false 
) const
1924{
1925 return GetInt(key, default_val ? 1 : 0) != 0;
1926}
IMGUI_API int GetInt(ImGuiID key, int default_val=0) const
Definition imgui.cpp:1915

References GetInt().

+ Here is the call graph for this function:

◆ GetBoolRef()

bool * ImGuiStorage::GetBoolRef ( ImGuiID  key,
bool  default_val = false 
)
1954{
1955 return (bool*)GetIntRef(key, default_val ? 1 : 0);
1956}
IMGUI_API int * GetIntRef(ImGuiID key, int default_val=0)
Definition imgui.cpp:1945

References GetIntRef().

+ Here is the call graph for this function:

◆ GetFloat()

float ImGuiStorage::GetFloat ( ImGuiID  key,
float  default_val = 0.0f 
) const
1929{
1930 ImGuiStoragePair* it = LowerBound(const_cast<ImVector<ImGuiStoragePair>&>(Data), key);
1931 if (it == Data.end() || it->key != key)
1932 return default_val;
1933 return it->val_f;
1934}
static ImGuiStorage::ImGuiStoragePair * LowerBound(ImVector< ImGuiStorage::ImGuiStoragePair > &data, ImGuiID key)
Definition imgui.cpp:1876
Definition imgui.h:1654

References Data, ImGuiStorage::ImGuiStoragePair::key, and LowerBound().

+ Here is the call graph for this function:

◆ GetFloatRef()

float * ImGuiStorage::GetFloatRef ( ImGuiID  key,
float  default_val = 0.0f 
)
1959{
1960 ImGuiStoragePair* it = LowerBound(Data, key);
1961 if (it == Data.end() || it->key != key)
1962 it = Data.insert(it, ImGuiStoragePair(key, default_val));
1963 return &it->val_f;
1964}

References Data, ImGuiStorage::ImGuiStoragePair::key, and LowerBound().

+ Here is the call graph for this function:

◆ GetInt()

int ImGuiStorage::GetInt ( ImGuiID  key,
int  default_val = 0 
) const
1916{
1917 ImGuiStoragePair* it = LowerBound(const_cast<ImVector<ImGuiStoragePair>&>(Data), key);
1918 if (it == Data.end() || it->key != key)
1919 return default_val;
1920 return it->val_i;
1921}

References Data, ImGuiStorage::ImGuiStoragePair::key, and LowerBound().

Referenced by GetBool(), ImPool< T >::GetByKey(), and ImGui::TreeNodeBehaviorIsOpen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetIntRef()

int * ImGuiStorage::GetIntRef ( ImGuiID  key,
int  default_val = 0 
)
1946{
1947 ImGuiStoragePair* it = LowerBound(Data, key);
1948 if (it == Data.end() || it->key != key)
1949 it = Data.insert(it, ImGuiStoragePair(key, default_val));
1950 return &it->val_i;
1951}

References Data, ImGuiStorage::ImGuiStoragePair::key, and LowerBound().

Referenced by GetBoolRef(), and ImPool< T >::GetOrAddByKey().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVoidPtr()

void * ImGuiStorage::GetVoidPtr ( ImGuiID  key) const
1937{
1938 ImGuiStoragePair* it = LowerBound(const_cast<ImVector<ImGuiStoragePair>&>(Data), key);
1939 if (it == Data.end() || it->key != key)
1940 return NULL;
1941 return it->val_p;
1942}

References Data, ImGuiStorage::ImGuiStoragePair::key, and LowerBound().

Referenced by ImGui::FindWindowByID().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVoidPtrRef()

void ** ImGuiStorage::GetVoidPtrRef ( ImGuiID  key,
void default_val = NULL 
)
1967{
1968 ImGuiStoragePair* it = LowerBound(Data, key);
1969 if (it == Data.end() || it->key != key)
1970 it = Data.insert(it, ImGuiStoragePair(key, default_val));
1971 return &it->val_p;
1972}

References Data, ImGuiStorage::ImGuiStoragePair::key, and LowerBound().

+ Here is the call graph for this function:

◆ SetAllInt()

void ImGuiStorage::SetAllInt ( int  val)
2014{
2015 for (int i = 0; i < Data.Size; i++)
2016 Data[i].val_i = v;
2017}

References Data.

◆ SetBool()

void ImGuiStorage::SetBool ( ImGuiID  key,
bool  val 
)
1987{
1988 SetInt(key, val ? 1 : 0);
1989}
IMGUI_API void SetInt(ImGuiID key, int val)
Definition imgui.cpp:1975

References SetInt().

+ Here is the call graph for this function:

◆ SetFloat()

void ImGuiStorage::SetFloat ( ImGuiID  key,
float  val 
)
1992{
1993 ImGuiStoragePair* it = LowerBound(Data, key);
1994 if (it == Data.end() || it->key != key)
1995 {
1996 Data.insert(it, ImGuiStoragePair(key, val));
1997 return;
1998 }
1999 it->val_f = val;
2000}

References Data, ImGuiStorage::ImGuiStoragePair::key, and LowerBound().

+ Here is the call graph for this function:

◆ SetInt()

void ImGuiStorage::SetInt ( ImGuiID  key,
int  val 
)
1976{
1977 ImGuiStoragePair* it = LowerBound(Data, key);
1978 if (it == Data.end() || it->key != key)
1979 {
1980 Data.insert(it, ImGuiStoragePair(key, val));
1981 return;
1982 }
1983 it->val_i = val;
1984}

References Data, ImGuiStorage::ImGuiStoragePair::key, and LowerBound().

Referenced by ImPool< T >::Remove(), SetBool(), ImGui::TreeNodeBehavior(), and ImGui::TreeNodeBehaviorIsOpen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetVoidPtr()

void ImGuiStorage::SetVoidPtr ( ImGuiID  key,
void val 
)
2003{
2004 ImGuiStoragePair* it = LowerBound(Data, key);
2005 if (it == Data.end() || it->key != key)
2006 {
2007 Data.insert(it, ImGuiStoragePair(key, val));
2008 return;
2009 }
2010 it->val_p = val;
2011}

References Data, ImGuiStorage::ImGuiStoragePair::key, and LowerBound().

Referenced by CreateNewWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ Data


The documentation for this struct was generated from the following files: