Skip to content

Commit

Permalink
Fix: Remove unused parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkulling committed Jan 3, 2025
1 parent 6b9cdfb commit 2cec28f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions samples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ int updateProgressbar(uint32_t id, void *instance) {
return ErrorCode;
}

Widget *widget = (Widget*) instance;
FilledState *state = (FilledState*) widget->mContent;
auto *widget = (Widget*) instance;
auto *state = (FilledState*) widget->mContent;
state->filledState++;
if (state->filledState > 100) state->filledState = 0;

Expand Down
28 changes: 18 additions & 10 deletions src/tinyui.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,24 +270,34 @@ struct CallbackI {
clear();
}

/// @brief The class constructor
/// @param callbackFunc The callback function.
/// @param instance The instance to use.
/// @param eventType The event type to use.
CallbackI(funcCallback callbackFunc, void *instance, size_t eventType = Events::MouseButtonDownEvent) :
mfuncCallback{ nullptr }, mInstance(instance) {
clear();
mfuncCallback[eventType] = callbackFunc;
}

/// @brief The class destructor.
~CallbackI() = default;

/// @brief Will clear all callback functions.
void clear() {
for (size_t i = 0; i < Events::NumEvents; ++i) {
mfuncCallback[i] = nullptr;
}
}
};

/// @brief The event callback array.
using EventCallbackArray = std::vector<CallbackI*>;

/// @brief The event dispatch map.
using EventDispatchMap = std::map<int32_t, EventCallbackArray>;

/// @brief Function pointer declaration for callbacks.
typedef void (*tui_log_func) (LogSeverity severity, const char *message);

struct SDLContext {
Expand All @@ -306,14 +316,14 @@ struct SDLContext {
using UpdateCallbackList = std::list<CallbackI*>;

struct Context {
bool mCreated;
bool mRequestShutdown;
const char *mAppTitle;
const char *mWindowsTitle;
SDLContext mSDLContext;
Style mStyle;
bool mCreated;
bool mRequestShutdown;
const char *mAppTitle;
const char *mWindowsTitle;
SDLContext mSDLContext;
Style mStyle;
Widget *mRoot;
tui_log_func mLogger;
tui_log_func mLogger = nullptr;
EventDispatchMap mEventDispatchMap;
FontCache mFontCache;
ImageCache mImageCache;
Expand All @@ -331,9 +341,7 @@ struct Context {
mWindowsTitle(nullptr),
mSDLContext(),
mStyle(),
mRoot(nullptr),
mLogger(nullptr),
mUpdateCallbackList() {
mRoot(nullptr) {
// empty
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ ret_code Widgets::button(Context &ctx, Id id, Id parentId, const char *text, con
return ResultOk;
}

ret_code Widgets::box(Context &ctx, Id id, Id parentId, const Rect &rect,const Color4 &color, bool filled) {
ret_code Widgets::box(Context &ctx, Id id, Id parentId, const Rect &rect, bool filled) {
if (ctx.mSDLContext.mRenderer == nullptr) {
return ErrorCode;
}
Expand Down
3 changes: 1 addition & 2 deletions src/widgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,9 @@ struct Widgets {
/// @param id The unique id of the widget.
/// @param parentId The parent id of the widget.
/// @param rect The rect of the widget.
/// @param bg The background color of the widget.
/// @param filled The filled state of the widget.
/// @return ResultOk if the widget was created, ErrorCode if not.
static ret_code box(Context &ctx, Id id, Id parentId, const Rect &rect, const Color4 &bg, bool filled);
static ret_code box(Context &ctx, Id id, Id parentId, const Rect &rect, bool filled);

/// @brief Will look for a widget by its id.
/// @param id The id of the widget to look for.
Expand Down

0 comments on commit 2cec28f

Please sign in to comment.