mirror of https://gitlab.com/nakst/essence
update window border style
This commit is contained in:
parent
424d65d8c4
commit
5a6e642fce
|
@ -208,6 +208,7 @@ void EmbeddedWindowDestroyed(EsObjectID id);
|
|||
void ConfigurationWriteToFile();
|
||||
void OpenDocumentOpenReference(EsObjectID id);
|
||||
void OpenDocumentCloseReference(EsObjectID id);
|
||||
void WallpaperLoad(EsGeneric);
|
||||
|
||||
#include "settings.cpp"
|
||||
|
||||
|
@ -1901,6 +1902,7 @@ void DesktopSetup() {
|
|||
|
||||
EsWindow *window = desktop.setupDesktopUIComplete ? desktop.taskBar.window : EsWindowCreate(nullptr, ES_WINDOW_PLAIN);
|
||||
window->messageUser = TaskBarWindowMessage;
|
||||
window->appearActivated = true;
|
||||
window->StartAnimating();
|
||||
EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, ES_WINDOW_SOLID_TRUE | ES_WINDOW_SOLID_NO_ACTIVATE, 0, ES_WINDOW_PROPERTY_SOLID);
|
||||
EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, BLEND_WINDOW_MATERIAL_GLASS, 0, ES_WINDOW_PROPERTY_MATERIAL);
|
||||
|
|
|
@ -425,7 +425,7 @@ struct EsWindow : EsElement {
|
|||
|
||||
bool willUpdate, toolbarFillMode, destroyInstanceAfterClose, hasDialog, doNotPaint;
|
||||
bool restoreOnNextMove, resetPositionOnNextMove, receivedFirstResize, isMaximised;
|
||||
bool hovering, activated;
|
||||
bool hovering, activated, appearActivated;
|
||||
bool visualizeRepaints, visualizeLayoutBounds, visualizePaintSteps; // Inspector properties.
|
||||
|
||||
EsElement *mainPanel, *toolbar;
|
||||
|
@ -919,7 +919,7 @@ EsWindow *EsWindowCreate(EsInstance *instance, EsWindowStyle style) {
|
|||
EsSyscall(ES_SYSCALL_WINDOW_MOVE, window->handle, (uintptr_t) &bounds, 0, ES_FLAGS_DEFAULT);
|
||||
EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, 0, 0, ES_WINDOW_PROPERTY_FOCUSED);
|
||||
window->mainPanel = EsPanelCreate(window, ES_ELEMENT_NON_CLIENT | ES_CELL_FILL, ES_STYLE_PANEL_CONTAINER_WINDOW_ROOT);
|
||||
window->SetStyle(ES_STYLE_CONTAINER_WINDOW_ACTIVE);
|
||||
window->SetStyle(ES_STYLE_CONTAINER_WINDOW);
|
||||
EsMessage m = { .type = ES_MSG_UI_SCALE_CHANGED };
|
||||
EsMessageSend(window, &m);
|
||||
} else if (style == ES_WINDOW_INSPECTOR) {
|
||||
|
@ -1799,6 +1799,8 @@ bool EsElement::RefreshStyleState() {
|
|||
|
||||
if (flags & ES_ELEMENT_DISABLED) {
|
||||
styleStateFlags |= THEME_PRIMARY_STATE_DISABLED;
|
||||
} else if (window && !window->activated && !window->appearActivated) {
|
||||
styleStateFlags |= THEME_PRIMARY_STATE_INACTIVE;
|
||||
} else {
|
||||
if (((state & UI_STATE_LEFT_PRESSED) && ((state & UI_STATE_HOVERED) || gui.draggingStarted || (state & UI_STATE_STRONG_PRESSED)))
|
||||
|| (state & UI_STATE_MENU_SOURCE)) {
|
||||
|
@ -5917,6 +5919,14 @@ void UIScaleChanged(EsElement *element, EsMessage *message) {
|
|||
}
|
||||
}
|
||||
|
||||
void UIMaybeRefreshStyleAll(EsElement *element) {
|
||||
element->MaybeRefreshStyle();
|
||||
|
||||
for (uintptr_t i = 0; i < element->children.Length(); i++) {
|
||||
UIMaybeRefreshStyleAll(element->children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void EsElementGetSize(EsElement *element, int *width, int *height) {
|
||||
EsMessageMutexCheck();
|
||||
|
||||
|
@ -6884,10 +6894,6 @@ void UIProcessWindowManagerMessage(EsWindow *window, EsMessage *message, Process
|
|||
|
||||
if (window->windowStyle == ES_WINDOW_MENU) {
|
||||
window->Destroy();
|
||||
} else if (window->windowStyle == ES_WINDOW_CONTAINER) {
|
||||
// Redraw window borders.
|
||||
window->SetStyle(ES_STYLE_CONTAINER_WINDOW_INACTIVE);
|
||||
window->Repaint(true);
|
||||
}
|
||||
|
||||
window->activated = false;
|
||||
|
@ -6901,6 +6907,7 @@ void UIProcessWindowManagerMessage(EsWindow *window, EsMessage *message, Process
|
|||
}
|
||||
|
||||
EsMessageSend(window, message);
|
||||
UIMaybeRefreshStyleAll(window);
|
||||
} else if (message->type == ES_MSG_WINDOW_ACTIVATED) {
|
||||
AccessKeyModeExit();
|
||||
|
||||
|
@ -6911,12 +6918,6 @@ void UIProcessWindowManagerMessage(EsWindow *window, EsMessage *message, Process
|
|||
EsMessage m = { ES_MSG_WINDOW_ACTIVATED };
|
||||
EsMessageSend(window, &m);
|
||||
|
||||
if (window->windowStyle == ES_WINDOW_CONTAINER) {
|
||||
// Redraw window borders.
|
||||
window->SetStyle(ES_STYLE_CONTAINER_WINDOW_ACTIVE);
|
||||
window->Repaint(true);
|
||||
}
|
||||
|
||||
if (!window->focused && window->inactiveFocus) {
|
||||
EsElementFocus(window->inactiveFocus, false);
|
||||
window->inactiveFocus->Repaint(true);
|
||||
|
@ -6924,6 +6925,7 @@ void UIProcessWindowManagerMessage(EsWindow *window, EsMessage *message, Process
|
|||
}
|
||||
|
||||
UIRefreshPrimaryClipboard(window);
|
||||
UIMaybeRefreshStyleAll(window);
|
||||
}
|
||||
|
||||
skipInputMessage:;
|
||||
|
|
|
@ -538,6 +538,8 @@ void SettingsPageKeyboard(EsElement *element, SettingsPage *page) {
|
|||
}
|
||||
|
||||
void SettingsPageDisplay(EsElement *element, SettingsPage *page) {
|
||||
// TODO.
|
||||
|
||||
EsElementSetHidden(((SettingsInstance *) element->instance)->undoButton, false);
|
||||
|
||||
EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO, &styleNewTabContent);
|
||||
|
@ -554,6 +556,49 @@ void SettingsPageDisplay(EsElement *element, SettingsPage *page) {
|
|||
100, 400, INTERFACE_STRING(CommonUnitPercent), 0.05, 5);
|
||||
}
|
||||
|
||||
void SettingsPageTheme(EsElement *element, SettingsPage *page) {
|
||||
// TODO.
|
||||
|
||||
EsElementSetHidden(((SettingsInstance *) element->instance)->undoButton, false);
|
||||
|
||||
EsPanel *content = EsPanelCreate(element, ES_CELL_FILL | ES_PANEL_V_SCROLL_AUTO, &styleNewTabContent);
|
||||
EsPanel *container = EsPanelCreate(content, ES_PANEL_VERTICAL | ES_CELL_H_SHRINK, &styleSettingsGroupContainer2);
|
||||
SettingsAddTitle(container, page);
|
||||
|
||||
EsPanel *warningRow = EsPanelCreate(container, ES_CELL_H_CENTER | ES_PANEL_HORIZONTAL, &styleSettingsTable);
|
||||
EsIconDisplayCreate(warningRow, ES_FLAGS_DEFAULT, 0, ES_ICON_DIALOG_WARNING);
|
||||
EsTextDisplayCreate(warningRow, ES_FLAGS_DEFAULT, 0, "Work in progress" ELLIPSIS);
|
||||
|
||||
EsPanel *table = EsPanelCreate(container, ES_CELL_H_FILL | ES_PANEL_TABLE | ES_PANEL_HORIZONTAL, &styleSettingsTable);
|
||||
EsPanelSetBands(table, 2);
|
||||
EsTextDisplayCreate(table, ES_CELL_H_RIGHT, 0, "Wallpaper:", -1);
|
||||
EsTextbox *textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_CELL_H_PUSH | ES_TEXTBOX_EDIT_BASED | ES_ELEMENT_FREE_USER_DATA, ES_STYLE_TEXTBOX_BORDERED_SINGLE);
|
||||
|
||||
textbox->messageUser = [] (EsElement *element, EsMessage *message) {
|
||||
if (message->type == ES_MSG_TEXTBOX_EDIT_END) {
|
||||
EsMutexAcquire(&api.systemConfigurationMutex);
|
||||
|
||||
EsSystemConfigurationGroup *group = SystemConfigurationGetGroup("general", -1, true);
|
||||
|
||||
if (group) {
|
||||
EsSystemConfigurationItem *item = SystemConfigurationGetItem(group, "wallpaper", -1, true);
|
||||
|
||||
if (item) {
|
||||
EsHeapFree(item->value);
|
||||
item->value = EsTextboxGetContents((EsTextbox *) element, &item->valueBytes);
|
||||
desktop.configurationModified = true;
|
||||
EsThreadCreate(WallpaperLoad, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
EsMutexRelease(&api.systemConfigurationMutex);
|
||||
return ES_HANDLED;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
SettingsPage settingsPages[] = {
|
||||
{ INTERFACE_STRING(DesktopSettingsAccessibility), ES_ICON_PREFERENCES_DESKTOP_ACCESSIBILITY, SettingsPageUnimplemented, 'A' }, // TODO.
|
||||
{ INTERFACE_STRING(DesktopSettingsDateAndTime), ES_ICON_PREFERENCES_SYSTEM_TIME, SettingsPageUnimplemented, 'C' }, // TODO.
|
||||
|
@ -564,7 +609,7 @@ SettingsPage settingsPages[] = {
|
|||
{ INTERFACE_STRING(DesktopSettingsNetwork), ES_ICON_PREFERENCES_SYSTEM_NETWORK, SettingsPageUnimplemented, 'H' }, // TODO.
|
||||
{ INTERFACE_STRING(DesktopSettingsPower), ES_ICON_PREFERENCES_SYSTEM_POWER, SettingsPageUnimplemented, 'J' }, // TODO.
|
||||
{ INTERFACE_STRING(DesktopSettingsSound), ES_ICON_PREFERENCES_DESKTOP_SOUND, SettingsPageUnimplemented, 'K' }, // TODO.
|
||||
{ INTERFACE_STRING(DesktopSettingsTheme), ES_ICON_APPLICATIONS_INTERFACEDESIGN, SettingsPageUnimplemented, 'M' }, // TODO.
|
||||
{ INTERFACE_STRING(DesktopSettingsTheme), ES_ICON_APPLICATIONS_INTERFACEDESIGN, SettingsPageTheme, 'M' },
|
||||
};
|
||||
|
||||
void SettingsButtonPressed(EsInstance *_instance, EsElement *element, EsCommand *) {
|
||||
|
|
|
@ -16,8 +16,7 @@ define_private ES_STYLE_COLOR_CIRCLE (ES_STYLE_CAST(1243))
|
|||
define_private ES_STYLE_COLOR_HEX_TEXTBOX (ES_STYLE_CAST(1245))
|
||||
define_private ES_STYLE_COLOR_PICKER_MAIN_PANEL (ES_STYLE_CAST(1247))
|
||||
define_private ES_STYLE_COLOR_SLIDER (ES_STYLE_CAST(1249))
|
||||
define_private ES_STYLE_CONTAINER_WINDOW_ACTIVE (ES_STYLE_CAST(1251))
|
||||
define_private ES_STYLE_CONTAINER_WINDOW_INACTIVE (ES_STYLE_CAST(1255))
|
||||
define_private ES_STYLE_CONTAINER_WINDOW (ES_STYLE_CAST(1251))
|
||||
define_private ES_STYLE_CURSOR_LOCATOR (ES_STYLE_CAST(1591))
|
||||
define ES_STYLE_DIALOG_BUTTON_AREA (ES_STYLE_CAST(1259))
|
||||
define ES_STYLE_DIALOG_CONTENT (ES_STYLE_CAST(1261))
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#define THEME_PRIMARY_STATE_HOVERED (2)
|
||||
#define THEME_PRIMARY_STATE_PRESSED (3)
|
||||
#define THEME_PRIMARY_STATE_DISABLED (4)
|
||||
#define THEME_PRIMARY_STATE_INACTIVE (5) // When the window has been deactivated.
|
||||
#define THEME_PRIMARY_STATE_MASK (0x000F)
|
||||
|
||||
#define THEME_STATE_FOCUSED (1 << 15)
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -207,6 +207,7 @@ UIButton *previewPrimaryStateIdle;
|
|||
UIButton *previewPrimaryStateHovered;
|
||||
UIButton *previewPrimaryStatePressed;
|
||||
UIButton *previewPrimaryStateDisabled;
|
||||
UIButton *previewPrimaryStateInactive;
|
||||
UIButton *previewStateFocused;
|
||||
UIButton *previewStateChecked;
|
||||
UIButton *previewStateIndeterminate;
|
||||
|
@ -5507,6 +5508,9 @@ int main(int argc, char **argv)
|
|||
previewPrimaryStateDisabled = UIButtonCreate(0, UI_BUTTON_SMALL, "Disabled", -1);
|
||||
previewPrimaryStateDisabled->invoke = PreviewSetPrimaryState;
|
||||
previewPrimaryStateDisabled->e.cp = (void *) PRIMARY_STATE_DISABLED;
|
||||
previewPrimaryStateInactive = UIButtonCreate(0, UI_BUTTON_SMALL, "Inactive", -1);
|
||||
previewPrimaryStateInactive->invoke = PreviewSetPrimaryState;
|
||||
previewPrimaryStateInactive->e.cp = (void *) PRIMARY_STATE_INACTIVE;
|
||||
UIParentPop();
|
||||
|
||||
UIPanelCreate(0, UI_PANEL_HORIZONTAL | UI_ELEMENT_PARENT_PUSH);
|
||||
|
|
|
@ -294,6 +294,7 @@ enum PrimaryState_Type StyleEnumOp {
|
|||
PRIMARY_STATE_HOVERED #StringOption { "Hovered" };
|
||||
PRIMARY_STATE_PRESSED #StringOption { "Pressed" };
|
||||
PRIMARY_STATE_DISABLED #StringOption { "Disabled" };
|
||||
PRIMARY_STATE_INACTIVE #StringOption { "Inactive" };
|
||||
};
|
||||
|
||||
struct Sequence Sequence_Type RfStructOp {
|
||||
|
|
Loading…
Reference in New Issue