#define INTERIM_MENU (isMenuBar || interim)
//#define INTERIM_MENU interim
-static int strcmpTillTab(char * a, char * b)
+static int strcmpTillTab(const char * a, const char * b)
{
if(a && !b) return 1;
else if(b && !a) return -1;
}
}
};
- property char * text
+ property const char * text
{
set
{
if(copyText)
{
- delete text;
+ delete (char *)text;
text = CopyString(value);
}
else
strcat(accelString, "0");
else if(value.code >= k1 && value.code <= k9)
{
- accelString[strlen(accelString)] = '1' + (char)(value.code - k1);
+ accelString[strlen(accelString)] = (char)('1' + value.code - k1);
accelString[strlen(accelString)+1] = 0;
}
else
Key accel = value.code;
bool needClass = false;
char tempString[50];
- char * result = accel.OnGetString(tempString, null, &needClass);
+ const char * result = accel.OnGetString(tempString, null, &needClass);
int len = strlen(accelString);
if(result) strcpy(accelString + len, result);
// accelString[len] = toupper(accelString[len]);
memcpy(newText, text, length);
newText[length] = 0;
strcat(newText, accelString);
- if(copyText) delete text;
+ if(copyText) delete (void *)text;
text = newText;
copyText = true;
}
}
else
{
- if(text && copyText)
- delete text;
+ if(copyText)
+ delete (void *)text;
}
copyText = value;
}
uint64 id;
Key hotKey;
Key accelerator;
- char * text;
+ const char * text;
BitmapResource bitmaps[3];
bool checkable, radio;
bool checked;
{
if(copyText)
// delete ITEM_TEXT(this);
- delete text;
+ delete (void *)text;
delete subMenu;
delete bitmaps[0];
delete bitmaps[1];
public:
/*
property Menu parent { set {} };
- property char * text { set {} };
+ property const char * text { set {} };
property Key hotKey { set {} };
*/
};
}
}
- if(!beingMergedItem.isDivider || (previous.item && !previous.item.isDivider))
+ if(!beingMergedItem.isDivider || !previous || (previous.item && !previous.item.isDivider))
{
mergeIntoItemPtr = ItemPtr { };
items.Insert(previous, mergeIntoItemPtr);
}
}
- Menu FindMenu(char * name)
+ Menu FindMenu(const char * name)
{
ItemPtr ptr;
}
property Menu parent { set { if(value) value.AddSubMenu(this); } };
- property char * text { set { text = value; /* CopyString(value);*/ } };
+ property const char * text { set { text = (char *)value; /* CopyString(value);*/ } };
property Key hotKey { set { hotKey = value; } };
property bool hasMargin { set { hasMargin = value; } };
bool mouseInput;
Time unpressedTime;
- void (* FontExtent)(Display display, Font font, char * text, int len, int * width, int * height);
+ void (* FontExtent)(Display display, Font font, const char * text, int len, int * width, int * height);
FontResource boldFont { faceName = font.faceName, font.size, bold = true, window = this };
BitmapResource subArrow { fileName = "<:ecere>elements/arrowRight.png", window = this };
{
bool result;
PopupMenu window = this, master;
- PopupMenu popupMenu;
for(; (master = (PopupMenu)window.master); window = master)
{
}
else
{
- char * text = ITEM_TEXT(item);
+ const char * text = ITEM_TEXT(item);
FontExtent(display, fontObject, text, text ? strlen(text) : 0, &len, null);
if((mx >= x - 16 && mx < x + len + 16))
{
bool systemButtons = activeClient && activeClient.state == maximized;
int bitmapOffset = 0;
bool hasBitmap = false;
+ bool isRadio = false;
surface.TextFont(fontObject);
surface.TextExtent(" ", 1, null, &height);
break;
}
}
+
+ for(ptr = menu.items.first; ptr; ptr = ptr.next)
+ {
+ if(ptr.item.radio)
+ {
+ isRadio = true;
+ break;
+ }
+ }
}
if(guiApp.textMode)
bitmapOffset = 16;
else
bitmapOffset = hasMargin ? 27 : (hasBitmap ? 18 : 12);
+ if(hasBitmap && isRadio)
+ bitmapOffset += 18;
}
else if(guiApp.textMode)
bitmapOffset = 8;
{
Bitmap icon = bitmap.bitmap;
if(icon)
- surface.Blit(icon, x + hasMargin ? 5 : 3, y + (rh - icon.height)/2, 0,0, icon.width, icon.height);
+ surface.Blit(icon, x + (isRadio ? 18 : 0) + (hasMargin ? 5 : 3), y + (rh - icon.height)/2, 0,0, icon.width, icon.height);
}
if(item.bold)
if(strstr(ITEM_TEXT(item), "\t"))
width += 8;
}
+ if(item.bitmap && item.radio)
+ width += 20;
if(item.subMenu) width += 20;
if(!guiApp.textMode)
height += 6;
bool OnMouseMove(int mx, int my, Modifiers mods)
{
int selectedX, selectedY;
+ ItemPtr selected;
+
+ if(mods.isSideEffect) return true;
- ItemPtr selected = FindSelected(mx, my, &selectedX, &selectedY);
+ selected = FindSelected(mx, my, &selectedX, &selectedY);
if((!mods.isSideEffect || !this.selected) && (/*selected && */
selected != this.selected && (!selected || !ITEM_DISABLED(selected.item)) && (selected || !keyboardFocus)))
{
if(isMenuBar)
{
- Time t = GetTime(), u = unpressedTime;
// Had to boost this to 0.1 for Windows Basic / XP theme / Remote Desktop
// Aero & Classic were fast enough for 0.01
if(GetTime() - unpressedTime < 0.1)