mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 18:40:38 +00:00
Fix some bugs
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2516 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
18b1cf147c
commit
578e55e628
5 changed files with 20 additions and 7 deletions
|
@ -37,6 +37,7 @@
|
|||
#include <AppKit/NSEvent.h>
|
||||
#include <AppKit/NSFont.h>
|
||||
#include <AppKit/NSMenu.h>
|
||||
#include <math.h>
|
||||
|
||||
#define ASSIGN(variable, value) \
|
||||
[value retain]; \
|
||||
|
@ -207,12 +208,15 @@ static NSFont* menuFont = nil;
|
|||
int max, howMany;
|
||||
NSRect intRect = {{0, 0}, {0, 0}};
|
||||
|
||||
max = count - rect.origin.y / (cellSize.height + INTERCELL_SPACE);
|
||||
howMany = rect.size.height / (cellSize.height + INTERCELL_SPACE);
|
||||
// If there are no cells then just return
|
||||
if (count == 0) return;
|
||||
|
||||
max = ceil((float)count - rect.origin.y / (cellSize.height + INTERCELL_SPACE));
|
||||
howMany = ceil(rect.size.height / (cellSize.height + INTERCELL_SPACE));
|
||||
|
||||
intRect.origin.y = (count - max) * (cellSize.height + INTERCELL_SPACE);
|
||||
intRect.size = cellSize;
|
||||
for (i = max - 1; howMany >= 0; i--, howMany--) {
|
||||
for (i = max - 1; howMany > 0; i--, howMany--) {
|
||||
id aCell = [cells objectAtIndex:i];
|
||||
|
||||
[aCell drawWithFrame:intRect inView:self];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue