本文整理汇总了Java中com.sun.jna.platform.win32.WinDef.HMENU属性的典型用法代码示例。如果您正苦于以下问题:Java WinDef.HMENU属性的具体用法?Java WinDef.HMENU怎么用?Java WinDef.HMENU使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.jna.platform.win32.WinDef
的用法示例。
在下文中一共展示了WinDef.HMENU属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reloadSessions
private void reloadSessions() {
WinDef.HWND hwnd = new WinDef.HWND(Native.getWindowPointer(MainFrame.this));
WinDef.HMENU systemMenu = user32.GetSystemMenu(hwnd, new WinDef.BOOL(0));
if (sessionsSeparatorPos > 0) {
for (int i = sessionsSeparatorPos; i >= 0; i--) {
user32.DeleteMenu(systemMenu, new WinDef.UINT(i), User32.MF_BYPOSITION);
}
}
mapCustomMenuHandlers.clear();
sessionsSeparatorPos = 0;
try {
File kittyHomeFile = new File(kittyHome);
if (kittyHomeFile.isDirectory()) {
for (File sessions : kittyHomeFile.listFiles()) {
if (sessions.isDirectory() && "Sessions".equals(sessions.getName())) {
sessionsSeparatorPos = loadSessions(systemMenu, mapCustomMenuHandlers, "", sessions, 0);
if (sessionsSeparatorPos > 0) {
WinUtil.InsertMenuSeparator(systemMenu, sessionsSeparatorPos, ++CUSTOM_MENU_LAST_ID);
}
}
}
}
} catch (UnsupportedEncodingException ex) {
throw new RuntimeException("Error reloading esssions!", ex);
}
}
示例2: loadSessions
private int loadSessions(WinDef.HMENU menu, Map<Integer, CustomMenuActionListener> mapListeners, String currentFolder, File root, int position) throws UnsupportedEncodingException {
List<File> files = new ArrayList<>(Arrays.asList(root.listFiles()));
Collections.sort(files, new Comparator<File>() {
@Override
public int compare(File o1, File o2) {
if (o1.isDirectory() && o2.isFile()) {
return -1;
}
if (o1.isFile() && o2.isDirectory()) {
return 1;
}
return o1.getName().compareToIgnoreCase(o2.getName());
}
});
for (File file : files) {
String text = URLDecoder.decode(file.getName(), "cp1252");
if (file.isFile()) {
if ("Default Settings".equals(text)) {
continue;
}
mapListeners.put(++CUSTOM_MENU_LAST_ID, new CustomMenuActionListener() {
@Override
public void actionPerformed() {
new KittyPanel(tabManager, kittyHome, (currentFolder.length() > 1) ? (" -folder \"" + currentFolder.substring(1) + "\"") : "", " -load \"" + text + "\"");
}
});
WinUtil.InsertMenuItem(menu, position++, CUSTOM_MENU_LAST_ID, text);
} else if (file.isDirectory()) {
WinDef.HMENU popup = user32.CreatePopupMenu();
loadSessions(popup, mapListeners, currentFolder + "\\" + text, file, 0);
WinUtil.InsertMenuPopup(menu, position++, popup, text);
}
}
return position;
}
示例3: InsertMenuSeparator
public static void InsertMenuSeparator(WinDef.HMENU menu, int position, int id) {
user32.InsertMenu(menu, new WinDef.UINT(position), WinUtil.orUINT(User32.MF_BYPOSITION, User32.MF_SEPARATOR), new WinDef.UINT_PTR(id), "");
}
示例4: InsertMenuItem
public static void InsertMenuItem(WinDef.HMENU menu, int position, int id, String text) {
user32.InsertMenu(menu, new WinDef.UINT(position), WinUtil.orUINT(User32.MF_BYPOSITION, User32.MF_STRING), new WinDef.UINT_PTR(id), text);
}
示例5: InsertMenuPopup
public static void InsertMenuPopup(WinDef.HMENU menu, int position, WinDef.HMENU popup, String text) {
user32.InsertMenu(menu, new WinDef.UINT(position), WinUtil.orUINT(User32.MF_BYPOSITION, User32.MF_POPUP), new WinDef.UINT_PTR(Pointer.nativeValue(popup.getPointer())), text);
}
示例6: GetSystemMenu
public WinDef.HMENU GetSystemMenu(WinDef.HWND hWnd, WinDef.BOOL bRevert);
示例7: InsertMenu
public WinDef.BOOL InsertMenu(WinDef.HMENU hMenu, WinDef.UINT uPosition, WinDef.UINT uFlags, WinDef.UINT_PTR uIDNewItem, String lpNewItem);
示例8: CreatePopupMenu
public WinDef.HMENU CreatePopupMenu();
示例9: TrackPopupMenu
public WinDef.BOOL TrackPopupMenu(WinDef.HMENU hMenu, WinDef.UINT uFlags, int x, int y, int nReserved, WinDef.HWND hWnd, WinDef.RECT prcRect);
示例10: DeleteMenu
public WinDef.BOOL DeleteMenu(WinDef.HMENU hMenu, WinDef.UINT uPosition, WinDef.UINT uFlags);