summaryrefslogtreecommitdiff
path: root/src/gui/widgets/window.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-04-25GUI: Added support for multiple color palettes to ThemeThorbjørn Lindeijer1-8/+10
Each Skin can point to a different palette, which can be used to tweak text colors where necessary. For now there is no generic solution for this, instead a number of locations have been adjusted to take the palette into account: * ChatWindow sets its palette on the BrowserBox used in its tabs. * Popup sets its palette on child widgets when they are added (covering BrowserBox, Label and TextBox). * ItemPopup now uses its palette when looking up colors. The BrowserBox now retrieves its numbered text colors from the theme. Also added OLDCHAT, AWAYCHAT and GLOBAL theme colors, with ##g, ##o and ##a to choose these colors respectively. Fixed ImageRect move constructor. TextPreview class was cleaned up from unused functionality. Being name colors are no longer different between the name shown on the being and the name shown in the SpeechDialog.
2025-04-25Jewelry: Fixed sticky button positionThorbjørn Lindeijer1-18/+18
Used "spacing" to store the additional space between the sticky button and the edge of the window (or the close button). Adjusted Popup and ToolWindow skins by one pixel to make the sticky button align the same way as for the Window skin.
2025-04-25GUI: Allow theme to skin item slots and equipment boxesThorbjørn Lindeijer1-2/+4
* Added EquipmentBox and ItemSlot skin types. * Allowed rectangles drawn by the theme to be not filled. * Added width/height attributes to skin element since we needed a way to specify the size of the item slots and equipment boxes.
2025-04-25GUI: Allow customizing the SkinType used by a WindowThorbjørn Lindeijer1-7/+10
Now different windows can use different skin types. This also introduces a new ToolWindow skin type, which is generally a window without title bar nor close button. Customized windows are: * Chat -> Popup skin * MiniMap -> Popup skin * ShortcutWindow (items and emotes) -> ToolWindow skin Even though the MiniMap now appears as a Popup, it does have a title, so appropriate attributes have been added to this skin type.
2025-04-02Use a consistent naming style for enum class valuesThorbjørn Lindeijer1-8/+8
Sometimes I've used CamelCase and sometimes SNAKE_CASE for these values. Since "enum class" values are always prefixed with the enum name, which uses CamelCase, I find it more fitting to use it for the values as well. Also fixes compilation on Windows where 'ERROR' was conflicting with a define.
2025-04-02Fixed minimum width of the Social windowThorbjørn Lindeijer1-2/+12
Needs to allow space for all three buttons, especially since they are no longer clipped to the window.
2025-03-31GUI: Support customizing widget text format through themeThorbjørn Lindeijer1-10/+22
The following widgets now support setting the font, text color, outline color and shadow color through the theme: * Button * Tab * Window (title) * ProgressBar The text format can be specified differently per skin state.
2025-03-31GUI: De-hardcode the window title offsetsThorbjørn Lindeijer1-2/+14
2025-03-24Expanded GUI theming capabilitiesThorbjørn Lindeijer1-72/+90
* Moved previously hardcoded values for frame size, padding and title bar height to the Skin. * Added support for rendering colored rectangles (used for scroll bar background). * Scroll bar width is now determined by its skin. * Added separate skins for horizontal and vertical scroll bars and horizontal and vertical scroll markers and added a skin for the shortcut box. * Added support for hovered state on window close button.
2025-03-24Define the GUI theme in XMLThorbjørn Lindeijer1-40/+41
Now all images used by the various UI widgets are defined in a `theme.xml`, removing hardcoded requirements on the size of images, borders and sub-images and their locations. The `colors.xml` file was merged into this new file as well. The `<img>` element defines either a plain image, or a 9-scale that is automatically rendered at the size of the widget when any of the `left`, `right`, `top` or `bottom` attributes are given. The `x`, `y`, `width` and `height` attributes determine the sub-rectangle within the image referenced by `src`. `x` and `y` default to 0 and `width` and `height` default to the imge size. The `<state>` element defines in which state its images are used by setting its `selected`, `disabled`, `hovered` or `focused` attributes to either `true` or `false`. Only the first matching state is rendered. The `Text` and `SpeechBubble` classes now use the same skin to draw the bubble, as well as using a newly introduced `BUBBLE_TEXT` color from the theme palette.
2025-03-14Moved widget drawing code into ThemeThorbjørn Lindeijer1-2/+2
This is cleaner overall since now each widget type no longer needs to keep track of its own instances and updating of the GUI alpha. It also introduces a single point from where the GUI theme support can be enhanced. Theme is no longer a singleton, though for now there is a single instance owned by the Gui singleton. Widgets adjusted to delegate their painting to the Theme: * Button * Tab * TextField * CheckBox * RadioButton * Slider * DropDown * ProgressBar * ScrollArea * ResizeGrip * PlayerBox (by subclassing ScrollArea) The Window and Popup widgets already use the theme through the Skin class. They can actually use a different skin per instance, though this feature is only used by the SpeechBubble.
2025-01-20Made client config statically typedThorbjørn Lindeijer1-43/+36
This makes accessing the config values much faster, since it no longer needs to do a lookup nor string conversion, which means we could remove some needless copying of the values. Overall it makes it easier to find out where settings are used and it puts the defaults along with the declaration. Options with default values are no longer saved to the config file. This does not include unrecognized options, which are kept around to provide some compatibility with older clients. While most basic options have kept the same name, more complicated settings like window geometry, shortcuts, outfits, etc. now have their own XML elements. Older clients will ignore these and erase them when saving the configuration.
2024-10-26Fixed FPS limit being enabled by defaultThorbjørn Lindeijer1-1/+1
There were some inconsistencies between the values set up in `Client::initConfiguration` and those in `getConfigDefaults`. These duplicates have now been removed. For some of these settings the code getting the values had to be adjusted to use getBoolValue, to actually rely on the provided default instead of one provided as a parameter.
2024-10-18Added small grabbable margin to Shortcuts windowThorbjørn Lindeijer1-25/+19
The Shortcuts window could no longer be moved since adding support for resizing windows at the top edge. Now there is again a bit of space where the window can be grabbed. Included some related cleanups.
2024-09-02Added a hand mouse cursor, used when hovering linksThorbjørn Lindeijer1-10/+11
InputEvent::mIsConsumed is used to tell the Window it should not change the mouse cursor as well. This change also adds a closed hand mouse cursor, though this is unused for now (might be useful when dragging stuff around). The new cursors are by meway.
2024-08-15Fixed resize border width on bottom and right sidesThorbjørn Lindeijer1-4/+4
2024-08-04Reuse Window::ensureOnScreenThorbjørn Lindeijer1-17/+7
Less code duplication.
2024-06-09Enable resizing windows from all sidesThorbjørn Lindeijer1-4/+12
Previously, the top edge of windows could not be dragged. Now you can also resize windows by their top edge, as well as the top-left and top-right corners.
2024-03-11Implemented ability to open external links in news and chatThorbjørn Lindeijer1-1/+4
* Use ConfirmDialog to confirm the opening of the external link. * ConfirmDialog now centers on its parent window when provided. * Reset hovered link when mouse exits the BrowserBox.
2024-03-02Updated mouse cursors to latest versionThorbjørn Lindeijer1-9/+9
The new cursor types are not used yet for now.
2024-02-13General code cleanupsThorbjørn Lindeijer1-16/+7
* Removing unused includes * Use member initialization * Use range-based for loops * Use nullptr * Removed no longer used aliases * Use override * Don't use else after return * Use '= delete' to remove implicit members * Use std::string::empty instead of comparing to ""
2024-01-26Apply C++11 fixitsThorbjørn Lindeijer1-5/+5
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer1-1/+1
2012-01-22Allow resizing of the game in windowed modeThorbjørn Lindeijer1-53/+32
Window positions are semi-smartly corrected as a result of the resize. Not supported when using OpenGL on Windows for now. Reviewed-by: Yohann Ferreira
2010-08-03Move Theme and UserPalette to the resources folderJared Adams1-1/+1
Reviewed-by: Yohann Ferreira
2010-07-28Centralized configuration default values using the VariableData system.Yohann Ferreira1-2/+2
Please note that I didn't turned all the getValue() call into new ones, simply because I have to have config object initiated which is not forcefully the case the branding file. Resolves: Manasource Mantis #170.
2010-03-31Removed the ability to assign custom skins to windows/popupsThorbjørn Lindeijer1-12/+1
Old settings are causing it to fall back on the wrong combination of files if old data is in the search path. Reviewed-by: Jared Adams
2010-03-12Split Palette into Theme and UserPaletteJared Adams1-1/+1
Themes can now control the colors they use. Colors in the Viewport (being names, particles, etc) can still be changed by the user. Also make ProgressBars more easily colored. DyePalette was made more flexible in the process. Also fixes comparing strings of different lengths insensitively. Reviewed-by: Thorbjørn Lindeijer
2010-03-05Rename SkinLoader to ThemeJared Adams1-4/+4
Also merge the guialpha ConfigListener into Theme. Reviewed-by: Thorbjørn Lindeijer
2010-03-02Revert "Merge WindowContainer into Viewport and remove extra members"Jared Adams1-7/+14
This reverts commit 67e678094b9fddd21fb3c690130e772937ab2746. Conflicts: src/gui/gui.cpp src/gui/viewport.cpp
2010-03-01Merge WindowContainer into Viewport and remove extra membersJared Adams1-14/+7
Reviewed-by: Chuck Miller
2010-03-01Hide BeingPopup when mouseover WindowsJared Adams1-0/+4
Reviewed-by: Thorbjørn Lindeijer Reviewed-by: Chuck Miller
2010-02-22Modify copyright headersFreeyorp1-1/+2
2010-02-20License header update for The Mana ClientThorbjørn Lindeijer1-4/+3
2010-02-14Remove focus from a window's internal widgets on hiding.Tametomo1-0/+9
Signed-off-by: Tametomo <irarice@gmail.com>
2010-02-07Updated Copyright year to 2010!Bertram1-1/+1
Also added the update copyright tool from the Wormux Team. ( And not forgetting credit's due. :P )
2010-01-11Cleanup GUI classesJared Adams1-5/+5
Moved remaining widgets into widgets folder, standardized include order, moved TextRenderer out.
2009-12-04Don't process redudant visibility calls in WindowJared Adams1-0/+3
2009-12-04Reset the cursor when a window is hiddenJared Adams1-0/+8
2009-09-03Resolved Mantis #847: Login stage Windows won't go less than the default gui ↵Bertram1-1/+2
opacity. Of course, in-game, the wanted opacity still shows up.
2009-09-02Added a minimum alpha opacity value handle in SkinLoader and made use of it.Bertram1-1/+1
Part 1 of 3 for Mantis #847 Only a few controls follow minimum opacity value at login stage. Part 2 will make all other controls do the same. Part 3 will try to set default gui opacity value as a constant.
2009-07-30Fixed windows loss when changing to a lowered resolution. (Mantis 776)Bertram1-0/+67
2009-05-10Fixed the resize grip of the party windowBjørn Lindeijer1-7/+11
It wasn't re-added after doing a clear. Also, don't leak all the PartyMember and Avatar instances.
2009-05-09Increased the distance between head and overhead text a bitBjørn Lindeijer1-0/+1
Plus some small code cleanups.
2009-05-09Fix some memory leaksJared Adams1-1/+0
In doing so, NPC Dialogs now show the resize grip again.
2009-05-01Merge the NPC dialogs into oneJared Adams1-0/+24
Also add support for the new TMWServ NPC packets
2009-04-20Fix up window visibility saving/restoringJared Adams1-3/+5
2009-04-20Removed the unused itemshortcutwindow.{h,cpp}Bjørn Lindeijer1-1/+2
2009-04-20Repaired table and listbox scrolling when using the keyboard.Ira Rice1-6/+0
Signed-off-by: Tametomo <irarice@gmail.com> Signed-off-by: Bjørn Lindeijer <bjorn@lindeijer.nl>
2009-04-19Made ItemContainer wrap items depending on its width againBjørn Lindeijer1-1/+2
This is instead of taking a fixed number of rows and columns. The inventory and trade window are now resizable again. Other smaller changes: * Don't use bold font for the labels in the item container * Changed "(Eq)" back to "Eq." * Removed the ugly grid lines